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
SLKKSPhaseConcentration Class Reference

Enforce sum of phase concentrations to be the real concentration. More...

#include <SLKKSPhaseConcentration.h>

Inheritance diagram for SLKKSPhaseConcentration:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

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

Real _a_u
 sublattice fraction for the sublattice B concentration represented by the kernel variable
 
const MaterialProperty< Real > & _prop_h
 Switching function \( h(\eta) \).
 
const MaterialProperty< Real > & _prop_dh
 Derivative of the switching function \( \frac d{d\eta} h(\eta) \).
 
unsigned int _nca
 sublattice A variables
 
std::vector< const VariableValue * > _ca
 
std::vector< Real > _a_ca
 
const JvarMap & _ca_map
 
unsigned int _ncb
 sublattice B variables
 
std::vector< const VariableValue * > _cb
 
std::vector< Real > _a_cb
 
const JvarMap & _cb_map
 
const VariableValue_c
 global concentration variable
 
unsigned int _c_var
 
const VariableValue_eta
 phase order parameter
 
unsigned int _eta_var
 

Private Member Functions

void computeSums ()
 update the _casum and _cbsum members
 
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
 
Real _casum
 updated by computeSums
 
Real _cbsum
 

Detailed Description

Enforce sum of phase concentrations to be the real concentration.

\( c=h(\eta)c_a+\left(1-h(\eta)\right)c_b\)

The non-linear variable for this Kernel is the concentration \( c_b \), while \( c_a \) and \( c \) are supplied as coupled variables. (compare this to KKSPhaseChemicalPotential, where the non-linear variable is the other phase concentration \( c_a \)!) D. Schwen et al. https://doi.org/10.1016/j.commatsci.2021.110466

See also
KKSPhaseChemicalPotential
KKSHEtaPolyMaterial

Definition at line 30 of file SLKKSPhaseConcentration.h.

Constructor & Destructor Documentation

◆ SLKKSPhaseConcentration()

SLKKSPhaseConcentration::SLKKSPhaseConcentration ( const InputParameters parameters)

Definition at line 37 of file SLKKSPhaseConcentration.C.

39 _nca(coupledComponents("ca")),
40 _ca(_nca),
41 _a_ca(getParam<std::vector<Real>>("aa")),
42 _ca_map(getParameterJvarMap("ca")),
43 _ncb(coupledComponents("cb")),
44 _cb(_ncb),
45 _a_cb(getParam<std::vector<Real>>("ab")),
46 _cb_map(getParameterJvarMap("cb")),
47 _a_u(getParam<Real>("a")),
48 _c(coupledValue("c")),
49 _c_var(coupled("c")),
50 _eta(coupledValue("eta")),
51 _eta_var(coupled("eta")),
52 _prop_h(getMaterialProperty<Real>("h_name")),
53 _prop_dh(getMaterialPropertyDerivative<Real>("h_name", coupledName("eta", 0)))
54{
55 if (_a_ca.size() != _nca)
56 paramError("aa", "Specify one sublattice site fraction per sublattice concentration variable");
57 if (_a_cb.size() != _ncb)
58 paramError("ab", "Specify one sublattice site fraction per sublattice concentration variable");
59
60 // check and re-normalize sublattice A site fractions
61 Real sum = 0.0;
62 for (std::size_t i = 0; i < _nca; ++i)
63 sum += _a_ca[i];
64 if (sum <= 0.0)
65 paramError("aa", "The sum of the aa values must be greater than zero");
66 for (std::size_t i = 0; i < _nca; ++i)
67 _a_ca[i] /= sum;
68
69 // check and re-normalize sublattice B site fractions
70 sum = _a_u;
71 for (std::size_t i = 0; i < _ncb; ++i)
72 sum += _a_cb[i];
73 if (sum <= 0.0)
74 paramError("ab", "The sum of the ab values and k must be greater than zero");
75 for (std::size_t i = 0; i < _ncb; ++i)
76 _a_cb[i] /= sum;
77 _a_u /= sum;
78
79 // fetch coupled concentrations
80 for (std::size_t i = 0; i < _nca; ++i)
81 _ca[i] = &coupledValue("ca", i);
82 for (std::size_t i = 0; i < _ncb; ++i)
83 _cb[i] = &coupledValue("cb", i);
84}
const VariableValue & _c
global concentration variable
const MaterialProperty< Real > & _prop_h
Switching function .
const VariableValue & _eta
phase order parameter
std::vector< const VariableValue * > _cb
unsigned int _ncb
sublattice B variables
unsigned int _nca
sublattice A variables
Real _a_u
sublattice fraction for the sublattice B concentration represented by the kernel variable
const MaterialProperty< Real > & _prop_dh
Derivative of the switching function .
std::vector< const VariableValue * > _ca
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Function Documentation

◆ computeQpJacobian()

Real SLKKSPhaseConcentration::computeQpJacobian ( )
protectedvirtual

Definition at line 94 of file SLKKSPhaseConcentration.C.

95{
96 return _test[_i][_qp] * _prop_h[_qp] * _phi[_j][_qp] * _a_u;
97}

◆ computeQpOffDiagJacobian()

Real SLKKSPhaseConcentration::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 100 of file SLKKSPhaseConcentration.C.

101{
102 if (jvar == _c_var)
103 return -_test[_i][_qp] * _phi[_j][_qp];
104
105 if (jvar == _eta_var)
106 {
107 computeSums();
108 return _test[_i][_qp] * (_cbsum - _casum) * _prop_dh[_qp] * _phi[_j][_qp];
109 }
110
111 auto cavar = mapJvarToCvar(jvar, _ca_map);
112 if (cavar >= 0)
113 return _test[_i][_qp] * (1.0 - _prop_h[_qp]) * _phi[_j][_qp] * _a_ca[cavar];
114
115 auto cbvar = mapJvarToCvar(jvar, _cb_map);
116 if (cbvar >= 0)
117 return _test[_i][_qp] * _prop_h[_qp] * _phi[_j][_qp] * _a_cb[cbvar];
118
119 return 0.0;
120}
Real _casum
updated by computeSums
void computeSums()
update the _casum and _cbsum members

◆ computeQpResidual()

Real SLKKSPhaseConcentration::computeQpResidual ( )
protectedvirtual

Definition at line 87 of file SLKKSPhaseConcentration.C.

88{
90 return _test[_i][_qp] * ((1.0 - _prop_h[_qp]) * _casum + _prop_h[_qp] * _cbsum - _c[_qp]);
91}

◆ computeSums()

void SLKKSPhaseConcentration::computeSums ( )
private

update the _casum and _cbsum members

Definition at line 123 of file SLKKSPhaseConcentration.C.

124{
125 _casum = 0.0;
126 for (std::size_t i = 0; i < _nca; ++i)
127 _casum += (*_ca[i])[_qp] * _a_ca[i];
128
129 _cbsum = _u[_qp] * _a_u;
130 for (std::size_t i = 0; i < _ncb; ++i)
131 _cbsum += (*_cb[i])[_qp] * _a_cb[i];
132}

Referenced by computeQpOffDiagJacobian(), and computeQpResidual().

◆ validParams()

InputParameters SLKKSPhaseConcentration::validParams ( )
static

Definition at line 15 of file SLKKSPhaseConcentration.C.

16{
17 auto params = Kernel::validParams();
18 params.addClassDescription(
19 "Sublattice KKS model kernel to enforce the decomposition of concentration into "
20 "phase and sublattice concentrations The non-linear variable of this kernel is a sublattice "
21 "concentration of phase b.");
22 params.addRequiredCoupledVar("ca", "Phase a sublattice concentrations");
23 params.addRequiredParam<std::vector<Real>>("aa", "Phase a sublattice site fraction");
24 params.addRequiredCoupledVar(
25 "cb", "Phase b sublattice concentrations (except for the kernel variable)");
26 params.addRequiredParam<std::vector<Real>>("ab", "Phase b sublattice site fraction");
27 params.addRequiredParam<Real>("a",
28 "Sublattice site fraction for the kernel variable (in phase b)");
29 params.addRequiredCoupledVar("c", "Global concentration");
30 params.addRequiredCoupledVar("eta", "Phase a/b order parameter");
31 params.addParam<MaterialPropertyName>(
32 "h_name", "h", "Base name for the switching function h(eta)");
33 return params;
34}
static InputParameters validParams()

Member Data Documentation

◆ _a_ca

std::vector<Real> SLKKSPhaseConcentration::_a_ca
protected

◆ _a_cb

std::vector<Real> SLKKSPhaseConcentration::_a_cb
protected

◆ _a_u

Real SLKKSPhaseConcentration::_a_u
protected

sublattice fraction for the sublattice B concentration represented by the kernel variable

Definition at line 57 of file SLKKSPhaseConcentration.h.

Referenced by computeQpJacobian(), computeSums(), and SLKKSPhaseConcentration().

◆ _c

const VariableValue& SLKKSPhaseConcentration::_c
protected

global concentration variable

Definition at line 60 of file SLKKSPhaseConcentration.h.

Referenced by computeQpResidual().

◆ _c_var

unsigned int SLKKSPhaseConcentration::_c_var
protected

Definition at line 61 of file SLKKSPhaseConcentration.h.

Referenced by computeQpOffDiagJacobian().

◆ _ca

std::vector<const VariableValue *> SLKKSPhaseConcentration::_ca
protected

Definition at line 44 of file SLKKSPhaseConcentration.h.

Referenced by computeSums(), and SLKKSPhaseConcentration().

◆ _ca_map

const JvarMap& SLKKSPhaseConcentration::_ca_map
protected

Definition at line 46 of file SLKKSPhaseConcentration.h.

Referenced by computeQpOffDiagJacobian().

◆ _casum

Real SLKKSPhaseConcentration::_casum
private

updated by computeSums

Definition at line 80 of file SLKKSPhaseConcentration.h.

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

◆ _cb

std::vector<const VariableValue *> SLKKSPhaseConcentration::_cb
protected

Definition at line 51 of file SLKKSPhaseConcentration.h.

Referenced by computeSums(), and SLKKSPhaseConcentration().

◆ _cb_map

const JvarMap& SLKKSPhaseConcentration::_cb_map
protected

Definition at line 53 of file SLKKSPhaseConcentration.h.

Referenced by computeQpOffDiagJacobian().

◆ _cbsum

Real SLKKSPhaseConcentration::_cbsum
private

◆ _eta

const VariableValue& SLKKSPhaseConcentration::_eta
protected

phase order parameter

Definition at line 65 of file SLKKSPhaseConcentration.h.

◆ _eta_var

unsigned int SLKKSPhaseConcentration::_eta_var
protected

Definition at line 66 of file SLKKSPhaseConcentration.h.

Referenced by computeQpOffDiagJacobian().

◆ _nca

unsigned int SLKKSPhaseConcentration::_nca
protected

sublattice A variables

Definition at line 43 of file SLKKSPhaseConcentration.h.

Referenced by computeSums(), and SLKKSPhaseConcentration().

◆ _ncb

unsigned int SLKKSPhaseConcentration::_ncb
protected

sublattice B variables

Definition at line 50 of file SLKKSPhaseConcentration.h.

Referenced by computeSums(), and SLKKSPhaseConcentration().

◆ _prop_dh

const MaterialProperty<Real>& SLKKSPhaseConcentration::_prop_dh
protected

Derivative of the switching function \( \frac d{d\eta} h(\eta) \).

Definition at line 73 of file SLKKSPhaseConcentration.h.

Referenced by computeQpOffDiagJacobian().

◆ _prop_h

const MaterialProperty<Real>& SLKKSPhaseConcentration::_prop_h
protected

Switching function \( h(\eta) \).

Definition at line 70 of file SLKKSPhaseConcentration.h.

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


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