www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CHBulk< T > Class Template Referenceabstract

This is the Cahn-Hilliard equation base class that implements the bulk or local energy term of the equation. More...

#include <CHBulk.h>

Inheritance diagram for CHBulk< T >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 CHBulk (const InputParameters &parameters)
 
virtual void initialSetup ()
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Types

enum  PFFunctionType { Jacobian, Residual }
 

Protected Member Functions

virtual RealGradient precomputeQpResidual ()
 
virtual RealGradient precomputeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
virtual RealGradient computeGradDFDCons (PFFunctionType type)=0
 

Protected Attributes

const MaterialProperty< T > & _M
 Mobility. More...
 
const MaterialProperty< T > & _dMdc
 Mobility derivative w.r.t. concentration. More...
 
std::vector< const MaterialProperty< T > * > _dMdarg
 Mobility derivative w.r.t coupled variables. More...
 

Detailed Description

template<typename T>
class CHBulk< T >

This is the Cahn-Hilliard equation base class that implements the bulk or local energy term of the equation.

It is templated on the type of the mobility, which can be either a number (Real) or a tensor (RealValueTensor). See M.R. Tonks et al. / Computational Materials Science 51 (2012) 20-29 for more information. Note that the function computeGradDFDCons MUST be overridden in any kernel that inherits from CHBulk. Use CHMath as an example of how this works.

Definition at line 25 of file CHBulk.h.

Member Enumeration Documentation

◆ PFFunctionType

template<typename T>
enum CHBulk::PFFunctionType
protected
Enumerator
Jacobian 
Residual 

Definition at line 38 of file CHBulk.h.

39  {
40  Jacobian,
41  Residual
42  };

Constructor & Destructor Documentation

◆ CHBulk()

template<typename T >
CHBulk< T >::CHBulk ( const InputParameters parameters)

Definition at line 57 of file CHBulk.h.

59  _M(getMaterialProperty<T>("mob_name")),
60  _dMdc(getMaterialPropertyDerivative<T>("mob_name", _var.name()))
61 {
62  // Get number of coupled variables
63  unsigned int nvar = _coupled_moose_vars.size();
64 
65  // reserve space for derivatives
66  _dMdarg.resize(nvar);
67 
68  // Iterate over all coupled variables
69  for (unsigned int i = 0; i < nvar; ++i)
70  _dMdarg[i] = &getMaterialPropertyDerivative<T>("mob_name", _coupled_moose_vars[i]->name());
71 }
const MaterialProperty< T > & _M
Mobility.
Definition: CHBulk.h:47
const MaterialProperty< T > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:50
const std::string name
Definition: Setup.h:20
std::vector< const MaterialProperty< T > * > _dMdarg
Mobility derivative w.r.t coupled variables.
Definition: CHBulk.h:53

Member Function Documentation

◆ computeGradDFDCons()

template<typename T>
virtual RealGradient CHBulk< T >::computeGradDFDCons ( PFFunctionType  type)
protectedpure virtual

◆ computeQpOffDiagJacobian()

template<typename T >
Real CHBulk< T >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented in KKSCHBulk, CahnHilliardBase< T >, CahnHilliardBase< RealTensorValue >, and CahnHilliardBase< Real >.

Definition at line 111 of file CHBulk.h.

Referenced by CahnHilliardBase< Real >::computeQpOffDiagJacobian().

112 {
113  // get the coupled variable jvar is referring to
114  const unsigned int cvar = mapJvarToCvar(jvar);
115 
116  return (*_dMdarg[cvar])[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual) * _grad_test[_i][_qp];
117 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
std::vector< const MaterialProperty< T > * > _dMdarg
Mobility derivative w.r.t coupled variables.
Definition: CHBulk.h:53

◆ initialSetup()

template<typename T >
void CHBulk< T >::initialSetup ( )
virtual

Reimplemented in CahnHilliardBase< T >, CahnHilliardBase< RealTensorValue >, and CahnHilliardBase< Real >.

Definition at line 87 of file CHBulk.h.

88 {
89  validateNonlinearCoupling<Real>("mob_name");
90 }

◆ precomputeQpJacobian()

template<typename T >
RealGradient CHBulk< T >::precomputeQpJacobian ( )
protectedvirtual

Definition at line 101 of file CHBulk.h.

102 {
103  RealGradient grad_value = _M[_qp] * computeGradDFDCons(Jacobian) +
104  _dMdc[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual);
105 
106  return grad_value;
107 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< T > & _M
Mobility.
Definition: CHBulk.h:47
const MaterialProperty< T > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:50

◆ precomputeQpResidual()

template<typename T >
RealGradient CHBulk< T >::precomputeQpResidual ( )
protectedvirtual

Definition at line 94 of file CHBulk.h.

95 {
96  return _M[_qp] * computeGradDFDCons(Residual);
97 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< T > & _M
Mobility.
Definition: CHBulk.h:47

◆ validParams()

template<typename T >
InputParameters CHBulk< T >::validParams ( )
static

Definition at line 75 of file CHBulk.h.

Referenced by CHBulkPFCTrad::validParams(), CHMath::validParams(), CahnHilliardBase< Real >::validParams(), and KKSCHBulk::validParams().

76 {
78  params.addClassDescription("Cahn-Hilliard base Kernel");
79  params.addParam<MaterialPropertyName>("mob_name", "M", "The mobility used with the kernel");
80  params.addCoupledVar("args", "Vector of variable arguments of the mobility");
81  params.deprecateCoupledVar("args", "coupled_variables", "02/27/2024");
82  return params;
83 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void addCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _dMdarg

template<typename T>
std::vector<const MaterialProperty<T> *> CHBulk< T >::_dMdarg
protected

Mobility derivative w.r.t coupled variables.

Definition at line 53 of file CHBulk.h.

Referenced by CHBulk< Real >::CHBulk().

◆ _dMdc

template<typename T>
const MaterialProperty<T>& CHBulk< T >::_dMdc
protected

Mobility derivative w.r.t. concentration.

Definition at line 50 of file CHBulk.h.

◆ _M

template<typename T>
const MaterialProperty<T>& CHBulk< T >::_M
protected

Mobility.

Definition at line 47 of file CHBulk.h.


The documentation for this class was generated from the following file: