https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private 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.
 
const MaterialProperty< T > & _dMdc
 Mobility derivative w.r.t. concentration.
 
std::vector< const MaterialProperty< T > * > _dMdarg
 Mobility derivative w.r.t coupled variables.
 

Private Member Functions

bool haveMaterialProperty (const std::string &prop_name)
 
std::vector< VariableName > buildVariableVector (const VariableName &c1, const VariableName &c2, const VariableName &c3)
 
void validateCouplingHelper (const MaterialPropertyName &base, const std::vector< VariableName > &c, const System &system, std::vector< VariableName > &missing)
 
bool isNotObjectVariable (const VariableName &name)
 

Private Attributes

FEProblemBase_dmi_fe_problem
 

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 {
42 };
@ Jacobian
Definition CHBulk.h:40

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 std::string name
Definition Setup.h:21
std::vector< const MaterialProperty< T > * > _dMdarg
Mobility derivative w.r.t coupled variables.
Definition CHBulk.h:53
const MaterialProperty< T > & _M
Mobility.
Definition CHBulk.h:47
const MaterialProperty< T > & _dMdc
Mobility derivative w.r.t. concentration.
Definition CHBulk.h:50
virtual unsigned int size() const override final

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 CahnHilliardBase< T >, CahnHilliardBase< Real >, CahnHilliardBase< RealTensorValue >, and KKSCHBulk.

Definition at line 110 of file CHBulk.h.

111{
112 // get the coupled variable jvar is referring to
113 const unsigned int cvar = mapJvarToCvar(jvar);
114
115 return (*_dMdarg[cvar])[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual) * _grad_test[_i][_qp];
116}
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0

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

◆ initialSetup()

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

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

Definition at line 86 of file CHBulk.h.

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

◆ precomputeQpJacobian()

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

Definition at line 100 of file CHBulk.h.

101{
102 RealGradient grad_value = _M[_qp] * computeGradDFDCons(Jacobian) +
103 _dMdc[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual);
104
105 return grad_value;
106}
RealVectorValue RealGradient

◆ precomputeQpResidual()

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

Definition at line 93 of file CHBulk.h.

94{
95 return _M[_qp] * computeGradDFDCons(Residual);
96}

◆ validParams()

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

Definition at line 75 of file CHBulk.h.

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

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

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< T >::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: