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

Enforce the equality of the chemical potentials in the two phases. More...

#include <KKSPhaseChemicalPotential.h>

Inheritance diagram for KKSPhaseChemicalPotential:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 KKSPhaseChemicalPotential (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)
 
virtual void initialSetup ()
 

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

unsigned int _cb_var
 coupled variable for cb
 
VariableName _cb_name
 
const MaterialProperty< Real > & _dfadca
 material properties we need to access
 
const MaterialProperty< Real > & _dfbdcb
 
const MaterialProperty< Real > & _d2fadca2
 
const MaterialProperty< Real > & _d2fbdcbca
 
std::vector< const MaterialProperty< Real > * > _d2fadcadarg
 
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
 
FEProblemBase_dmi_fe_problem
 
const Real _ka
 site fractions
 
const Real _kb
 

Detailed Description

Enforce the equality of the chemical potentials in the two phases.

Eq. (21) in the original KKS paper.

\( dF_a/dc_a = dF_b/dc_b \)

We need to supply two free energy functions (i.e. KKSBaseMaterial) by giving two "base names" ('Fa', 'Fb'). We supply concentration \( c_a \) as the non-linear variable and \( c_b \) as a coupled variable (compare this to KKSPhaseConcentration, where the non-linear variable is the other phase concentration \( c_b \)!)

See also
KKSPhaseConcentration

Definition at line 32 of file KKSPhaseChemicalPotential.h.

Constructor & Destructor Documentation

◆ KKSPhaseChemicalPotential()

KKSPhaseChemicalPotential::KKSPhaseChemicalPotential ( const InputParameters parameters)

Definition at line 51 of file KKSPhaseChemicalPotential.C.

53 _cb_var(coupled("cb")),
54 _cb_name(coupledName("cb", 0)),
55 // first derivatives
56 _dfadca(getMaterialPropertyDerivative<Real>("fa_name", _var.name())),
57 _dfbdcb(getMaterialPropertyDerivative<Real>("fb_name", _cb_name)),
58 // second derivatives d2F/dx*dca for jacobian diagonal elements
59 _d2fadca2(getMaterialPropertyDerivative<Real>("fa_name", _var.name(), _var.name())),
60 _d2fbdcbca(getMaterialPropertyDerivative<Real>("fb_name", _cb_name, _var.name())),
61 _d2fadcadarg(_n_args),
62 _d2fbdcbdarg(_n_args),
63 // site fractions
64 _ka(getParam<Real>("ka")),
65 _kb(getParam<Real>("kb"))
66{
67#ifdef DEBUG
68 _console << "KKSPhaseChemicalPotential(" << name() << ") " << _var.name() << ' ' << _cb_name
69 << '\n';
70#endif
71
72 // lookup table for the material properties representing the derivatives needed for the
73 // off-diagonal jacobian
74 for (std::size_t i = 0; i < _n_args; ++i)
75 {
76 _d2fadcadarg[i] = &getMaterialPropertyDerivative<Real>("fa_name", _var.name(), i);
77 _d2fbdcbdarg[i] = &getMaterialPropertyDerivative<Real>("fb_name", _cb_name, i);
78 }
79}
const std::string name
Definition Setup.h:21
const MaterialProperty< Real > & _dfadca
material properties we need to access
const MaterialProperty< Real > & _dfbdcb
std::vector< const MaterialProperty< Real > * > _d2fbdcbdarg
const MaterialProperty< Real > & _d2fadca2
const MaterialProperty< Real > & _d2fbdcbca
unsigned int _cb_var
coupled variable for cb
std::vector< const MaterialProperty< Real > * > _d2fadcadarg

Member Function Documentation

◆ computeQpJacobian()

Real KKSPhaseChemicalPotential::computeQpJacobian ( )
protectedvirtual

Definition at line 96 of file KKSPhaseChemicalPotential.C.

97{
98 // for on diagonal we return the d/dca derivative of the residual
99 return _test[_i][_qp] * _phi[_j][_qp] * (_d2fadca2[_qp] / _ka - _d2fbdcbca[_qp] / _kb);
100}

◆ computeQpOffDiagJacobian()

Real KKSPhaseChemicalPotential::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 103 of file KKSPhaseChemicalPotential.C.

104{
105 // get the coupled variable jvar is referring to
106 const unsigned int cvar = mapJvarToCvar(jvar);
107
108 return _test[_i][_qp] * _phi[_j][_qp] *
109 ((*_d2fadcadarg[cvar])[_qp] / _ka - (*_d2fbdcbdarg[cvar])[_qp] / _kb);
110}

◆ computeQpResidual()

Real KKSPhaseChemicalPotential::computeQpResidual ( )
protectedvirtual

Definition at line 89 of file KKSPhaseChemicalPotential.C.

90{
91 // enforce _dfadca==_dfbdcb
92 return _test[_i][_qp] * (_dfadca[_qp] / _ka - _dfbdcb[_qp] / _kb);
93}

◆ initialSetup()

void KKSPhaseChemicalPotential::initialSetup ( )
protectedvirtual

Definition at line 82 of file KKSPhaseChemicalPotential.C.

83{
84 validateNonlinearCoupling<Real>("fa_name");
85 validateNonlinearCoupling<Real>("fb_name");
86}

◆ validParams()

InputParameters KKSPhaseChemicalPotential::validParams ( )
static

Definition at line 18 of file KKSPhaseChemicalPotential.C.

19{
21 params.addClassDescription("KKS model kernel to enforce the pointwise equality of phase chemical "
22 "potentials $dF_a/dc_a = dF_b/dc_b$. The non-linear variable of this "
23 "kernel is $c_a$.");
25 "cb", "Phase b concentration"); // note that ca is u, the non-linear variable!
26 params.addRequiredParam<MaterialPropertyName>("fa_name",
27 "Base name of the free energy function "
28 "Fa (f_name in the corresponding "
29 "derivative function material)");
30 params.addRequiredParam<MaterialPropertyName>("fb_name",
31 "Base name of the free energy function "
32 "Fb (f_name in the corresponding "
33 "derivative function material)");
34 params.addParam<Real>("ka",
35 1.0,
36 "Site fraction for the ca variable (specify this if ca is a sublattice "
37 "concentration, and make sure it is a true site fraction eg. 0.6666666) ");
38 params.addParam<Real>("kb",
39 1.0,
40 "Site fraction for the cb variable (specify this if ca is a sublattice "
41 "concentration, and make sure it is a true site fraction eg. 0.6666666) ");
42 params.addCoupledVar(
43 "args_a",
44 "Vector of further parameters to Fa (optional, to add in second cross derivatives of Fa)");
45 params.addCoupledVar(
46 "args_b",
47 "Vector of further parameters to Fb (optional, to add in second cross derivatives of Fb)");
48 return params;
49}
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Data Documentation

◆ _cb_name

VariableName KKSPhaseChemicalPotential::_cb_name
private

Definition at line 48 of file KKSPhaseChemicalPotential.h.

Referenced by KKSPhaseChemicalPotential().

◆ _cb_var

unsigned int KKSPhaseChemicalPotential::_cb_var
private

coupled variable for cb

Definition at line 47 of file KKSPhaseChemicalPotential.h.

◆ _d2fadca2

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fadca2
private

Definition at line 53 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian().

◆ _d2fadcadarg

std::vector<const MaterialProperty<Real> *> KKSPhaseChemicalPotential::_d2fadcadarg
private

◆ _d2fbdcbca

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_d2fbdcbca
private

Definition at line 54 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian().

◆ _d2fbdcbdarg

std::vector<const MaterialProperty<Real> *> KKSPhaseChemicalPotential::_d2fbdcbdarg
private

◆ _dfadca

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfadca
private

material properties we need to access

Definition at line 51 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().

◆ _dfbdcb

const MaterialProperty<Real>& KKSPhaseChemicalPotential::_dfbdcb
private

Definition at line 52 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpResidual().

◆ _ka

const Real KKSPhaseChemicalPotential::_ka
private

site fractions

Definition at line 60 of file KKSPhaseChemicalPotential.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _kb

const Real KKSPhaseChemicalPotential::_kb
private

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