https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CHInterfaceBase< T > Class Template Reference

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

#include <CHInterfaceBase.h>

Inheritance diagram for CHInterfaceBase< T >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 CHInterfaceBase (const InputParameters &parameters)
 
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 Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

const MaterialProperty< Real > & _kappa
 
unsigned int _nvar
 Number of variables.
 
std::vector< const VariableGradient * > _coupled_grad_vars
 Coupled variables used in mobility.
 
const MaterialProperty< T > & _M
 
const MaterialProperty< T > & _dMdc
 
const MaterialProperty< T > & _d2Mdc2
 
const VariableSecond_second_u
 
const VariableTestSecond_second_test
 
const VariablePhiSecond_second_phi
 
std::vector< const MaterialProperty< T > * > _dMdarg
 
std::vector< const MaterialProperty< T > * > _d2Mdcdarg
 
std::vector< std::vector< const MaterialProperty< T > * > > _d2Mdargdarg
 

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

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

See M.R. Tonks et al. / Computational Materials Science 51 (2012) 20-29 for more information.

Definition at line 23 of file CHInterfaceBase.h.

Constructor & Destructor Documentation

◆ CHInterfaceBase()

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

Definition at line 66 of file CHInterfaceBase.h.

68 _kappa(getMaterialProperty<Real>("kappa_name")),
69 _M(getMaterialProperty<T>("mob_name")),
70 _dMdc(getMaterialPropertyDerivative<T>("mob_name", _var.name())),
71 _d2Mdc2(getMaterialPropertyDerivative<T>("mob_name", _var.name(), _var.name())),
72 _second_u(second()),
73 _second_test(secondTest()),
74 _second_phi(secondPhi()),
75 _nvar(_coupled_moose_vars.size()),
80{
81 // Iterate over all coupled variables
82 for (unsigned int i = 0; i < _nvar; ++i)
83 {
84 // Set material property values
85 _dMdarg[i] = &getMaterialPropertyDerivative<T>("mob_name", _coupled_moose_vars[i]->name());
86 _d2Mdcdarg[i] =
87 &getMaterialPropertyDerivative<T>("mob_name", _var.name(), _coupled_moose_vars[i]->name());
88 _d2Mdargdarg[i].resize(_nvar);
89 for (unsigned int j = 0; j < _nvar; ++j)
90 _d2Mdargdarg[i][j] = &getMaterialPropertyDerivative<T>(
91 "mob_name", _coupled_moose_vars[i]->name(), _coupled_moose_vars[j]->name());
92
93 // Set coupled variable gradients
94 _coupled_grad_vars[i] = &coupledGradient("coupled_variables", i);
95 }
96}
const std::string name
Definition Setup.h:21
std::vector< std::vector< const MaterialProperty< T > * > > _d2Mdargdarg
unsigned int _nvar
Number of variables.
const VariableSecond & _second_u
std::vector< const MaterialProperty< T > * > _d2Mdcdarg
const VariableTestSecond & _second_test
const MaterialProperty< T > & _dMdc
const MaterialProperty< Real > & _kappa
const VariablePhiSecond & _second_phi
const MaterialProperty< T > & _M
const MaterialProperty< T > & _d2Mdc2
std::vector< const VariableGradient * > _coupled_grad_vars
Coupled variables used in mobility.
std::vector< const MaterialProperty< T > * > _dMdarg

Member Function Documentation

◆ computeQpJacobian()

template<typename T >
Real CHInterfaceBase< T >::computeQpJacobian ( )
protectedvirtual

Definition at line 124 of file CHInterfaceBase.h.

125{
126 // Set the gradient and gradient derivative values
127 RealGradient grad_M = _dMdc[_qp] * _grad_u[_qp];
128
129 RealGradient dgrad_Mdc =
130 _d2Mdc2[_qp] * _phi[_j][_qp] * _grad_u[_qp] + _dMdc[_qp] * _grad_phi[_j][_qp];
131
132 for (unsigned int i = 0; i < _nvar; ++i)
133 {
134 grad_M += (*_dMdarg[i])[_qp] * (*_coupled_grad_vars[i])[_qp];
135 dgrad_Mdc += (*_d2Mdcdarg[i])[_qp] * _phi[_j][_qp] * (*_coupled_grad_vars[i])[_qp];
136 }
137
138 // Jacobian value using product rule
139 Real value = _kappa[_qp] * _second_phi[_j][_qp].tr() *
140 ((_M[_qp] * _second_test[_i][_qp]).tr() + grad_M * _grad_test[_i][_qp]) +
141 _kappa[_qp] * _second_u[_qp].tr() *
142 ((_dMdc[_qp] * _second_test[_i][_qp]).tr() * _phi[_j][_qp] +
143 dgrad_Mdc * _grad_test[_i][_qp]);
144
145 return value;
146}
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
RealVectorValue RealGradient
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ computeQpOffDiagJacobian()

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

Definition at line 150 of file CHInterfaceBase.h.

151{
152 // get the coupled variable jvar is referring to
153 const unsigned int cvar = mapJvarToCvar(jvar);
154
155 // Set the gradient derivative
156 RealGradient dgrad_Mdarg = (*_d2Mdcdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] +
157 (*_dMdarg[cvar])[_qp] * _grad_phi[_j][_qp];
158
159 for (unsigned int i = 0; i < _nvar; ++i)
160 dgrad_Mdarg += (*_d2Mdargdarg[cvar][i])[_qp] * _phi[_j][_qp] * (*_coupled_grad_vars[cvar])[_qp];
161
162 // Jacobian value using product rule
163 Real value = _kappa[_qp] * _second_u[_qp].tr() *
164 (((*_dMdarg[cvar])[_qp] * _second_test[_i][_qp]).tr() * _phi[_j][_qp] +
165 dgrad_Mdarg * _grad_test[_i][_qp]);
166
167 return value;
168}

◆ computeQpResidual()

template<typename T >
Real CHInterfaceBase< T >::computeQpResidual ( )
protectedvirtual

Definition at line 112 of file CHInterfaceBase.h.

113{
114 RealGradient grad_M = _dMdc[_qp] * _grad_u[_qp];
115 for (unsigned int i = 0; i < _nvar; ++i)
116 grad_M += (*_dMdarg[i])[_qp] * (*_coupled_grad_vars[i])[_qp];
117
118 return _kappa[_qp] * _second_u[_qp].tr() *
119 ((_M[_qp] * _second_test[_i][_qp]).tr() + grad_M * _grad_test[_i][_qp]);
120}

◆ validParams()

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

Definition at line 100 of file CHInterfaceBase.h.

101{
103 params.addClassDescription("Gradient energy Cahn-Hilliard base Kernel");
104 params.addRequiredParam<MaterialPropertyName>("kappa_name", "The kappa used with the kernel");
105 params.addRequiredParam<MaterialPropertyName>("mob_name", "The mobility used with the kernel");
106 params.addCoupledVar("coupled_variables", "Vector of variable arguments of the mobility");
107 return params;
108}
void addRequiredParam(const std::string &name, 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 CHInterface::validParams(), and CHInterfaceAniso::validParams().

Member Data Documentation

◆ _coupled_grad_vars

template<typename T >
std::vector<const VariableGradient *> CHInterfaceBase< T >::_coupled_grad_vars
protected

Coupled variables used in mobility.

Definition at line 62 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::CHInterfaceBase().

◆ _d2Mdargdarg

template<typename T >
std::vector<std::vector<const MaterialProperty<T> *> > CHInterfaceBase< T >::_d2Mdargdarg
protected

Definition at line 58 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::CHInterfaceBase().

◆ _d2Mdc2

template<typename T >
const MaterialProperty<T>& CHInterfaceBase< T >::_d2Mdc2
protected

Definition at line 41 of file CHInterfaceBase.h.

◆ _d2Mdcdarg

template<typename T >
std::vector<const MaterialProperty<T> *> CHInterfaceBase< T >::_d2Mdcdarg
protected

Definition at line 57 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::CHInterfaceBase().

◆ _dMdarg

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

Mobility derivatives w.r.t. its dependent variables

Definition at line 56 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::CHInterfaceBase().

◆ _dMdc

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

Definition at line 40 of file CHInterfaceBase.h.

◆ _kappa

template<typename T >
const MaterialProperty<Real>& CHInterfaceBase< T >::_kappa
protected

Definition at line 35 of file CHInterfaceBase.h.

◆ _M

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

Mobility material property value and concentration derivatives

Definition at line 39 of file CHInterfaceBase.h.

◆ _nvar

template<typename T >
unsigned int CHInterfaceBase< T >::_nvar
protected

Number of variables.

Definition at line 52 of file CHInterfaceBase.h.

Referenced by CHInterfaceBase< T >::CHInterfaceBase().

◆ _second_phi

template<typename T >
const VariablePhiSecond& CHInterfaceBase< T >::_second_phi
protected

Definition at line 48 of file CHInterfaceBase.h.

◆ _second_test

template<typename T >
const VariableTestSecond& CHInterfaceBase< T >::_second_test
protected

Definition at line 47 of file CHInterfaceBase.h.

◆ _second_u

template<typename T >
const VariableSecond& CHInterfaceBase< T >::_second_u
protected

Variables for second order derivatives

Definition at line 46 of file CHInterfaceBase.h.


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