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

#include <KKSPhaseConcentrationDerivatives.h>

Inheritance diagram for KKSPhaseConcentrationDerivatives:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 KKSPhaseConcentrationDerivatives (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 void computeQpProperties () override
 

Protected Attributes

const unsigned int _num_c
 Number of global concentrations.
 
const std::vector< VariableName > _c_names
 Names of global concentrations.
 
const VariableName _eta_name
 Phase parameter.
 
std::vector< std::vector< std::vector< MaterialProperty< Real > * > > > _dcidb
 Derivative of phase concentrations wrt global concentrations \( \frac d{db} c_i \).
 
std::vector< std::vector< MaterialProperty< Real > * > > _dcideta
 Derivative of phase concentrations wrt eta \( \frac d{d{eta}} c_i \).
 
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _d2Fidcidbi
 Second derivative of phase concentrations wrt two phase concentrations \( \frac {d^2}{dc_i db_i} F_i \).
 
const MaterialProperty< Real > & _prop_h
 Switching function.
 
const MaterialProperty< Real > & _prop_dh
 Derivative of switching function.
 
const std::vector< MaterialPropertyName > _ci_names
 Phase concentrations.
 
std::vector< const MaterialProperty< Real > * > _prop_ci
 
const MaterialName _Fa_name
 Free energy names.
 
const MaterialName _Fb_name
 

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

Definition at line 15 of file KKSPhaseConcentrationDerivatives.h.

Constructor & Destructor Documentation

◆ KKSPhaseConcentrationDerivatives()

KKSPhaseConcentrationDerivatives::KKSPhaseConcentrationDerivatives ( const InputParameters parameters)

Second derivative of free energy wrt phase concentrations for use in this material. In _d2Fidcidbi[m][n][l], m is phase index of Fi, n is the species index of ci, l is the species index of bi.

Definition at line 35 of file KKSPhaseConcentrationDerivatives.C.

38 _num_c(coupledComponents("global_cs")),
39 _c_names(coupledNames("global_cs")),
40 _eta_name(getVar("eta", 0)->name()),
41 _ci_names(getParam<std::vector<MaterialPropertyName>>("ci_names")),
42 _prop_ci(_num_c * 2),
45 _Fa_name(getParam<MaterialName>("fa_name")),
46 _Fb_name(getParam<MaterialName>("fb_name")),
47 _d2Fidcidbi(2),
48 _prop_h(getMaterialProperty<Real>("h_name")),
49 _prop_dh(getMaterialPropertyDerivative<Real>("h_name", _eta_name))
50{
51 for (const auto m : make_range(_num_c * 2))
52 _prop_ci[m] = &getMaterialPropertyByName<Real>(_ci_names[m]);
53
54 for (const auto m : make_range(_num_c))
55 {
56 _dcideta[m].resize(2);
57 _dcidb[m].resize(2);
58 for (const auto n : make_range(2))
59 {
60 // Derivative of phase concentration wrt eta. In _dcideta[m][n], m is the species index of
61 // ci, n is the phase index of ci
62 _dcideta[m][n] = &declarePropertyDerivative<Real>(_ci_names[m * 2 + n], _eta_name);
63 _dcidb[m][n].resize(_num_c);
64
65 // Derivative of phase concentration wrt global concentration. In _dcidb[m][n][l], m is the
66 // species index of ci, n is the phase index of ci, l is the species index of b
67 for (const auto l : make_range(_num_c))
68 _dcidb[m][n][l] = &declarePropertyDerivative<Real>(_ci_names[m * 2 + n], _c_names[l]);
69 }
70 }
71
76 for (const auto m : make_range(2))
77 {
78 _d2Fidcidbi[m].resize(_num_c);
79 for (const auto n : make_range(_num_c))
80 {
81 _d2Fidcidbi[m][n].resize(_num_c);
82 for (const auto l : make_range(_num_c))
83 {
84 if (m == 0)
85 _d2Fidcidbi[0][n][l] =
86 &getMaterialPropertyDerivative<Real>(_Fa_name, _ci_names[n * 2], _ci_names[l * 2]);
87
88 else
89 _d2Fidcidbi[1][n][l] = &getMaterialPropertyDerivative<Real>(
90 _Fb_name, _ci_names[n * 2 + 1], _ci_names[l * 2 + 1]);
91 }
92 }
93 }
94}
const std::string name
Definition Setup.h:21
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative(const std::string &base, const std::vector< VariableName > &c)
const std::vector< MaterialPropertyName > _ci_names
Phase concentrations.
const unsigned int _num_c
Number of global concentrations.
std::vector< std::vector< std::vector< MaterialProperty< Real > * > > > _dcidb
Derivative of phase concentrations wrt global concentrations .
const MaterialProperty< Real > & _prop_dh
Derivative of switching function.
const MaterialName _Fa_name
Free energy names.
std::vector< const MaterialProperty< Real > * > _prop_ci
std::vector< std::vector< std::vector< const MaterialProperty< Real > * > > > _d2Fidcidbi
Second derivative of phase concentrations wrt two phase concentrations .
const VariableName _eta_name
Phase parameter.
std::vector< std::vector< MaterialProperty< Real > * > > _dcideta
Derivative of phase concentrations wrt eta .
const MaterialProperty< Real > & _prop_h
Switching function.
const std::vector< VariableName > _c_names
Names of global concentrations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)

Member Function Documentation

◆ computeQpProperties()

void KKSPhaseConcentrationDerivatives::computeQpProperties ( )
overrideprotectedvirtual

Definition at line 97 of file KKSPhaseConcentrationDerivatives.C.

98{
99 // declare Jacobian matrix A
100 Eigen::MatrixXd A(_num_c * 2, _num_c * 2);
101
102 A.setZero();
103
104 // fill in the non-zero elements in A
105 for (const auto m : make_range(_num_c))
106 {
107 for (const auto n : make_range(_num_c))
108 {
109 // equal chemical potential derivative equations
110 A(m * 2, n * 2) = (*_d2Fidcidbi[0][m][n])[_qp];
111 A(m * 2, n * 2 + 1) = -(*_d2Fidcidbi[1][m][n])[_qp];
112 }
113
114 // concentration conservation derivative equations
115 A(m * 2 + 1, m * 2) = 1 - _prop_h[_qp];
116 A(m * 2 + 1, m * 2 + 1) = _prop_h[_qp];
117 }
118
119 A = A.inverse();
120
121 // solve linear system of constraint derivatives wrt b for computing dcidb loop through
122 // derivatives wrt the ith component; they have the same A, but different k_c
123 for (const auto i : make_range(_num_c))
124 {
125 std::vector<Real> k_c(_num_c * 2);
126 std::vector<Real> x_c(_num_c * 2);
127
128 // assign the non-zero elements in k_c
129 k_c[i * 2 + 1] = 1;
130
131 // compute x_c
132 for (const auto m : make_range(_num_c * 2))
133 {
134 for (const auto n : make_range(_num_c * 2))
135 x_c[m] += A(m, n) * k_c[n];
136 }
137
138 // assign the values in x_c to _dcidb
139 for (const auto m : make_range(_num_c))
140 {
141 for (const auto n : make_range(2))
142 (*_dcidb[m][n][i])[_qp] = x_c[m * 2 + n];
143 }
144 }
145
146 // solve linear system of constraint derivatives wrt eta for computing dcideta use the same
147 // linear matrix as computing dcidb
148 std::vector<Real> k_eta(_num_c * 2);
149 std::vector<Real> x_eta(_num_c * 2);
150
151 // fill in k_eta
152 for (const auto m : make_range(_num_c))
153 {
154 k_eta[m * 2] = 0;
155 k_eta[m * 2 + 1] = _prop_dh[_qp] * ((*_prop_ci[m * 2])[_qp] - (*_prop_ci[m * 2 + 1])[_qp]);
156 }
157
158 // compute x_eta
159 for (const auto m : make_range(_num_c * 2))
160 {
161 for (const auto n : make_range(_num_c * 2))
162 x_eta[m] += A(m, n) * k_eta[n];
163 }
164
165 // assign the values in x_eta to _dcideta
166 for (const auto m : make_range(_num_c))
167 {
168 for (const auto n : make_range(2))
169 (*_dcideta[m][n])[_qp] = x_eta[m * 2 + n];
170 }
171}

◆ validParams()

InputParameters KKSPhaseConcentrationDerivatives::validParams ( )
static

Definition at line 16 of file KKSPhaseConcentrationDerivatives.C.

17{
20 "Computes the KKS phase concentration derivatives wrt global concentrations and order "
21 "parameters, which are used in the chain rules in the KKS kernels. This class is intended to "
22 "be used with KKSPhaseConcentrationMaterial.");
23 params.addRequiredCoupledVar("global_cs", "The interpolated concentrations c, b, etc");
24 params.addRequiredCoupledVar("eta", "Order parameter.");
25 params.addRequiredParam<std::vector<MaterialPropertyName>>(
26 "ci_names",
27 "Phase concentrations. The order must match Fa, Fb, and global_cs, for example, c1, "
28 "c2, b1, b2, etc");
29 params.addRequiredParam<MaterialName>("fa_name", "Fa material object.");
30 params.addRequiredParam<MaterialName>("fb_name", "Fb material object.");
31 params.addParam<MaterialPropertyName>("h_name", "h", "Switching function h(eta).");
32 return params;
33}
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)

Member Data Documentation

◆ _c_names

const std::vector<VariableName> KKSPhaseConcentrationDerivatives::_c_names
protected

Names of global concentrations.

Definition at line 29 of file KKSPhaseConcentrationDerivatives.h.

Referenced by KKSPhaseConcentrationDerivatives().

◆ _ci_names

const std::vector<MaterialPropertyName> KKSPhaseConcentrationDerivatives::_ci_names
protected

Phase concentrations.

Definition at line 35 of file KKSPhaseConcentrationDerivatives.h.

Referenced by KKSPhaseConcentrationDerivatives().

◆ _d2Fidcidbi

std::vector<std::vector<std::vector<const MaterialProperty<Real> *> > > KKSPhaseConcentrationDerivatives::_d2Fidcidbi
protected

Second derivative of phase concentrations wrt two phase concentrations \( \frac {d^2}{dc_i db_i} F_i \).

Definition at line 53 of file KKSPhaseConcentrationDerivatives.h.

Referenced by computeQpProperties(), and KKSPhaseConcentrationDerivatives().

◆ _dcidb

std::vector<std::vector<std::vector<MaterialProperty<Real> *> > > KKSPhaseConcentrationDerivatives::_dcidb
protected

Derivative of phase concentrations wrt global concentrations \( \frac d{db} c_i \).

Definition at line 40 of file KKSPhaseConcentrationDerivatives.h.

Referenced by computeQpProperties(), and KKSPhaseConcentrationDerivatives().

◆ _dcideta

std::vector<std::vector<MaterialProperty<Real> *> > KKSPhaseConcentrationDerivatives::_dcideta
protected

Derivative of phase concentrations wrt eta \( \frac d{d{eta}} c_i \).

Definition at line 43 of file KKSPhaseConcentrationDerivatives.h.

Referenced by computeQpProperties(), and KKSPhaseConcentrationDerivatives().

◆ _eta_name

const VariableName KKSPhaseConcentrationDerivatives::_eta_name
protected

Phase parameter.

Definition at line 32 of file KKSPhaseConcentrationDerivatives.h.

Referenced by KKSPhaseConcentrationDerivatives().

◆ _Fa_name

const MaterialName KKSPhaseConcentrationDerivatives::_Fa_name
protected

Free energy names.

Definition at line 46 of file KKSPhaseConcentrationDerivatives.h.

Referenced by KKSPhaseConcentrationDerivatives().

◆ _Fb_name

const MaterialName KKSPhaseConcentrationDerivatives::_Fb_name
protected

Definition at line 47 of file KKSPhaseConcentrationDerivatives.h.

Referenced by KKSPhaseConcentrationDerivatives().

◆ _num_c

const unsigned int KKSPhaseConcentrationDerivatives::_num_c
protected

Number of global concentrations.

Definition at line 26 of file KKSPhaseConcentrationDerivatives.h.

Referenced by computeQpProperties(), and KKSPhaseConcentrationDerivatives().

◆ _prop_ci

std::vector<const MaterialProperty<Real> *> KKSPhaseConcentrationDerivatives::_prop_ci
protected

◆ _prop_dh

const MaterialProperty<Real>& KKSPhaseConcentrationDerivatives::_prop_dh
protected

Derivative of switching function.

Definition at line 59 of file KKSPhaseConcentrationDerivatives.h.

Referenced by computeQpProperties().

◆ _prop_h

const MaterialProperty<Real>& KKSPhaseConcentrationDerivatives::_prop_h
protected

Switching function.

Definition at line 56 of file KKSPhaseConcentrationDerivatives.h.

Referenced by computeQpProperties().


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