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
KKSMultiACBulkC Class Referenceabstract

KKSACBulkBase child class for the phase concentration term \( - \sum_j \frac{dF_1}{dc_1} \frac{dh_j}{d\eta_i} (c_j) \) in the the Allen-Cahn bulk residual. More...

#include <KKSMultiACBulkC.h>

Inheritance diagram for KKSMultiACBulkC:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 KKSMultiACBulkC (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
 

Protected Member Functions

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

Protected Attributes

MaterialPropertyName _c1_name
 Names of phase concentration variables.
 
const std::vector< const VariableValue * > _cjs
 
const std::vector< unsigned int_cjs_var
 
const MaterialProperty< Real > & _prop_dF1dc1
 Derivative of the free energy function \( \frac d{dc_1} F_1 \).
 
const MaterialProperty< Real > & _prop_d2F1dc12
 Second derivative of the free energy function \( \frac {d^2}{dc_1^2} F_1 \).
 
std::vector< const MaterialProperty< Real > * > _prop_d2F1dc1darg
 Mixed partial derivatives of the free energy function wrt c1 and any other coupled variables \( \frac {d^2}{dc_1 dv} F_1 \).
 
VariableName _etai_name
 name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material properties)
 
unsigned int _etai_var
 index of order parameter that derivatives are taken wrt
 
std::vector< MaterialPropertyName > _Fj_names
 Names of free energy functions for each phase \( F_j \).
 
unsigned int _num_j
 
std::vector< const MaterialProperty< Real > * > _prop_Fj
 Values of the free energy functions for each phase \( F_j \).
 
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
 Derivatives of the free energy functions (needed for off-diagonal Jacobians)
 
std::vector< MaterialPropertyName > _hj_names
 switching function names
 
std::vector< const MaterialProperty< Real > * > _prop_hj
 Values of the switching functions for each phase \( h_j \).
 
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
 Derivatives of the switching functions wrt the order parameter for this kernel.
 
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
 Second derivatives of the switching functions wrt the order parameter for this kernel.
 
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
 Second derivatives of the switching functions (needed for off-diagonal Jacobians)
 
const MaterialProperty< Real > & _L
 Mobility.
 
const MaterialProperty< Real > & _dLdop
 Mobility derivative w.r.t. order parameter.
 
std::vector< const MaterialProperty< Real > * > _dLdarg
 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

KKSACBulkBase child class for the phase concentration term \( - \sum_j \frac{dF_1}{dc_1} \frac{dh_j}{d\eta_i} (c_j) \) in the the Allen-Cahn bulk residual.

The non-linear variable for this Kernel is the order parameter 'eta_i'.

Definition at line 23 of file KKSMultiACBulkC.h.

Member Enumeration Documentation

◆ PFFunctionType

enum ACBulk::PFFunctionType
protectedinherited

Definition at line 37 of file ACBulk.h.

38 {
41 };

Constructor & Destructor Documentation

◆ KKSMultiACBulkC()

KKSMultiACBulkC::KKSMultiACBulkC ( const InputParameters parameters)

Definition at line 25 of file KKSMultiACBulkC.C.

26 : KKSMultiACBulkBase(parameters),
27 // Can use any dFj/dcj since they are equal so pick first cj in the list
28 _c1_name(coupledName("cj_names", 0)),
29 _cjs(coupledValues("cj_names")),
30 _cjs_var(coupledIndices("cj_names")),
31 _prop_dF1dc1(getMaterialPropertyDerivative<Real>(_Fj_names[0],
32 _c1_name)), // Use first Fj in list for dFj/dcj
33 _prop_d2F1dc12(getMaterialPropertyDerivative<Real>(_Fj_names[0], _c1_name, _c1_name)),
34 _prop_d2F1dc1darg(_n_args)
35{
36 if (_num_j != coupledComponents("cj_names"))
37 paramError("cj_names", "Need to pass in as many cj_names as Fj_names");
38
39 // get second partial derivatives wrt c1 and other coupled variable
40 for (unsigned int i = 0; i < _n_args; ++i)
41 _prop_d2F1dc1darg[i] = &getMaterialPropertyDerivative<Real>(_Fj_names[0], _c1_name, i);
42}
ACBulk child class that sets up necessary variables and materials for calculation of residual contrib...
std::vector< MaterialPropertyName > _Fj_names
Names of free energy functions for each phase .
const MaterialProperty< Real > & _prop_dF1dc1
Derivative of the free energy function .
const std::vector< unsigned int > _cjs_var
MaterialPropertyName _c1_name
Names of phase concentration variables.
std::vector< const MaterialProperty< Real > * > _prop_d2F1dc1darg
Mixed partial derivatives of the free energy function wrt c1 and any other coupled variables .
const std::vector< const VariableValue * > _cjs
const MaterialProperty< Real > & _prop_d2F1dc12
Second derivative of the free energy function .

Member Function Documentation

◆ computeDFDOP() [1/2]

Real KKSMultiACBulkC::computeDFDOP ( PFFunctionType  type)
protectedvirtual

Definition at line 45 of file KKSMultiACBulkC.C.

46{
47 Real sum = 0.0;
48
49 switch (type)
50 {
51 case Residual:
52 for (unsigned int n = 0; n < _num_j; ++n)
53 sum += (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
54
55 return -_prop_dF1dc1[_qp] * sum;
56
57 case Jacobian:
58 // For when this kernel is used in the Lagrange multiplier equation
59 // In that case the Lagrange multiplier is the nonlinear variable
60 if (_etai_var != _var.number())
61 return 0.0;
62
63 // For when eta_i is the nonlinear variable
64 for (unsigned int n = 0; n < _num_j; ++n)
65 sum += (*_prop_d2hjdetai2[n])[_qp] * (*_cjs[n])[_qp];
66
67 return -_phi[_j][_qp] * _prop_dF1dc1[_qp] * sum;
68 }
69
70 mooseError("Invalid type passed in");
71}
void mooseError(Args &&... args)
unsigned int _etai_var
index of order parameter that derivatives are taken wrt
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ computeDFDOP() [2/2]

virtual Real ACBulk< Real >::computeDFDOP ( PFFunctionType  type)
protectedpure virtualinherited

◆ computeQpOffDiagJacobian()

Real KKSMultiACBulkC::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented from ACBulk< Real >.

Definition at line 74 of file KKSMultiACBulkC.C.

75{
76 // first get dependence of mobility _L on other variables using parent class
77 // member function
79
80 Real sum = 0.0;
81 // Then add dependence of KKSACBulkC on other variables
82 // Treat cj variables specially, as they appear in the residual
83 if (jvar == _cjs_var[0])
84 {
85 for (unsigned int n = 0; n < _num_j; ++n)
86 sum += (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
87
88 res -= _L[_qp] * (sum * _prop_d2F1dc12[_qp] + _prop_dF1dc1[_qp] * (*_prop_dhjdetai[0])[_qp]) *
89 _phi[_j][_qp] * _test[_i][_qp];
90 return res;
91 }
92
93 for (unsigned int i = 1; i < _num_j; ++i)
94 {
95 if (jvar == _cjs_var[i])
96 {
97 res -=
98 _L[_qp] * _prop_dF1dc1[_qp] * (*_prop_dhjdetai[i])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
99 return res;
100 }
101 }
102
103 // for all other vars get the coupled variable jvar is referring to
104 const unsigned int cvar = mapJvarToCvar(jvar);
105
106 for (unsigned int n = 0; n < _num_j; ++n)
107 sum += _prop_dF1dc1[_qp] * (*_prop_d2hjdetaidarg[n][cvar])[_qp] * (*_cjs[n])[_qp] +
108 (*_prop_d2F1dc1darg[cvar])[_qp] * (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
109
110 res -= _L[_qp] * sum * _phi[_j][_qp] * _test[_i][_qp];
111
112 return res;
113}
const MaterialProperty< Real > & _L
Mobility.
Definition ACBulk.h:46
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACBulk.h:110
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians)

◆ initialSetup()

void KKSMultiACBulkBase::initialSetup ( )
virtualinherited

Reimplemented from ACBulk< Real >.

Definition at line 72 of file KKSMultiACBulkBase.C.

73{
75
76 for (unsigned int n = 0; n < _num_j; ++n)
77 {
78 validateNonlinearCoupling<Real>(_Fj_names[n]);
79 validateNonlinearCoupling<Real>(_hj_names[n]);
80 }
81}
virtual void initialSetup()
Definition ACBulk.h:79
std::vector< MaterialPropertyName > _hj_names
switching function names

◆ precomputeQpJacobian()

Real ACBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited

Definition at line 34 of file ACBulk.h.

98{
99 // Get free energy derivative and Jacobian
100 Real dFdop = computeDFDOP(Residual);
101
102 Real JdFdop = computeDFDOP(Jacobian);
103
104 // Set Jacobian value using product rule
105 return _L[_qp] * JdFdop + _dLdop[_qp] * _phi[_j][_qp] * dFdop;
106}
virtual Real computeDFDOP(PFFunctionType type)=0
const MaterialProperty< Real > & _dLdop
Mobility derivative w.r.t. order parameter.
Definition ACBulk.h:49

◆ precomputeQpResidual()

Real ACBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited

Definition at line 33 of file ACBulk.h.

87{
88 // Get free energy derivative from function
89 Real dFdop = computeDFDOP(Residual);
90
91 // Set residual
92 return _L[_qp] * dFdop;
93}

◆ validParams()

InputParameters KKSMultiACBulkC::validParams ( )
static

Definition at line 15 of file KKSMultiACBulkC.C.

16{
18 params.addClassDescription("Multi-phase KKS model kernel (part 2 of 2) for the Bulk Allen-Cahn. "
19 "This includes all terms dependent on chemical potential.");
21 "cj_names", "Array of phase concentrations cj. Place in same order as Fj_names!");
22 return params;
23}
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _c1_name

MaterialPropertyName KKSMultiACBulkC::_c1_name
protected

Names of phase concentration variables.

Definition at line 35 of file KKSMultiACBulkC.h.

Referenced by KKSMultiACBulkC().

◆ _cjs

const std::vector<const VariableValue *> KKSMultiACBulkC::_cjs
protected

Definition at line 36 of file KKSMultiACBulkC.h.

Referenced by computeDFDOP(), and computeQpOffDiagJacobian().

◆ _cjs_var

const std::vector<unsigned int> KKSMultiACBulkC::_cjs_var
protected

Definition at line 37 of file KKSMultiACBulkC.h.

Referenced by computeQpOffDiagJacobian().

◆ _dLdarg

std::vector<const MaterialProperty<Real > *> ACBulk< Real >::_dLdarg
protectedinherited

Mobility derivative w.r.t coupled variables.

Definition at line 52 of file ACBulk.h.

◆ _dLdop

const MaterialProperty<Real >& ACBulk< Real >::_dLdop
protectedinherited

Mobility derivative w.r.t. order parameter.

Definition at line 49 of file ACBulk.h.

◆ _etai_name

VariableName KKSMultiACBulkBase::_etai_name
protectedinherited

name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material properties)

Definition at line 34 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase().

◆ _etai_var

unsigned int KKSMultiACBulkBase::_etai_var
protectedinherited

◆ _Fj_names

std::vector<MaterialPropertyName> KKSMultiACBulkBase::_Fj_names
protectedinherited

◆ _hj_names

std::vector<MaterialPropertyName> KKSMultiACBulkBase::_hj_names
protectedinherited

◆ _L

const MaterialProperty<Real >& ACBulk< Real >::_L
protectedinherited

Mobility.

Definition at line 46 of file ACBulk.h.

◆ _num_j

unsigned int KKSMultiACBulkBase::_num_j
protectedinherited

◆ _prop_d2F1dc12

const MaterialProperty<Real>& KKSMultiACBulkC::_prop_d2F1dc12
protected

Second derivative of the free energy function \( \frac {d^2}{dc_1^2} F_1 \).

Definition at line 42 of file KKSMultiACBulkC.h.

Referenced by computeQpOffDiagJacobian().

◆ _prop_d2F1dc1darg

std::vector<const MaterialProperty<Real> *> KKSMultiACBulkC::_prop_d2F1dc1darg
protected

Mixed partial derivatives of the free energy function wrt c1 and any other coupled variables \( \frac {d^2}{dc_1 dv} F_1 \).

Definition at line 45 of file KKSMultiACBulkC.h.

Referenced by computeQpOffDiagJacobian(), and KKSMultiACBulkC().

◆ _prop_d2hjdetai2

std::vector<const MaterialProperty<Real> *> KKSMultiACBulkBase::_prop_d2hjdetai2
protectedinherited

Second derivatives of the switching functions wrt the order parameter for this kernel.

Definition at line 59 of file KKSMultiACBulkBase.h.

Referenced by computeDFDOP(), KKSMultiACBulkF::computeDFDOP(), and KKSMultiACBulkBase::KKSMultiACBulkBase().

◆ _prop_d2hjdetaidarg

std::vector<std::vector<const MaterialProperty<Real> *> > KKSMultiACBulkBase::_prop_d2hjdetaidarg
protectedinherited

Second derivatives of the switching functions (needed for off-diagonal Jacobians)

Definition at line 62 of file KKSMultiACBulkBase.h.

Referenced by computeQpOffDiagJacobian(), KKSMultiACBulkF::computeQpOffDiagJacobian(), and KKSMultiACBulkBase::KKSMultiACBulkBase().

◆ _prop_dF1dc1

const MaterialProperty<Real>& KKSMultiACBulkC::_prop_dF1dc1
protected

Derivative of the free energy function \( \frac d{dc_1} F_1 \).

Definition at line 40 of file KKSMultiACBulkC.h.

Referenced by computeDFDOP(), and computeQpOffDiagJacobian().

◆ _prop_dFjdarg

std::vector<std::vector<const MaterialProperty<Real> *> > KKSMultiACBulkBase::_prop_dFjdarg
protectedinherited

Derivatives of the free energy functions (needed for off-diagonal Jacobians)

Definition at line 47 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkF::computeQpOffDiagJacobian(), and KKSMultiACBulkBase::KKSMultiACBulkBase().

◆ _prop_dhjdetai

std::vector<const MaterialProperty<Real> *> KKSMultiACBulkBase::_prop_dhjdetai
protectedinherited

◆ _prop_Fj

std::vector<const MaterialProperty<Real> *> KKSMultiACBulkBase::_prop_Fj
protectedinherited

◆ _prop_hj

std::vector<const MaterialProperty<Real> *> KKSMultiACBulkBase::_prop_hj
protectedinherited

Values of the switching functions for each phase \( h_j \).

Definition at line 53 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase().


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