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

This kernel implements a term in the variationally-derived equivalent form of Poisson's equation for the electrochemical grand potential sintering model with dilute solution energetics. More...

#include <MaskedExponential.h>

Inheritance diagram for MaskedExponential:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 MaskedExponential (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 Member Functions

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

Protected Attributes

unsigned int _w_var
 Chemical potential.
 
const VariableValue_w
 
std::string _temp_name
 Temperature.
 
unsigned int _temp_var
 
const VariableValue_temp
 
const MaterialProperty< Real > & _mask
 Mask.
 
std::vector< const MaterialProperty< Real > * > _prop_dmaskdarg
 
const MaterialProperty< Real > & _n_eq
 Equilibrium defect concentration.
 
const MaterialProperty< Real > & _prop_dn_eqdT
 
std::vector< const MaterialProperty< Real > * > _prop_dn_eqdarg
 
const int _z
 Species charge.
 
const Real _kB
 Boltzmann constant.
 
const Real _e
 Electron charge.
 

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

This kernel implements a term in the variationally-derived equivalent form of Poisson's equation for the electrochemical grand potential sintering model with dilute solution energetics.

It acts on the electric potential.

Definition at line 21 of file MaskedExponential.h.

Constructor & Destructor Documentation

◆ MaskedExponential()

MaskedExponential::MaskedExponential ( const InputParameters parameters)

Definition at line 31 of file MaskedExponential.C.

33 _w_var(coupled("w")),
34 _w(coupledValue("w")),
35 _temp_name(coupledName("T", 0)),
36 _temp_var(coupled("T")),
37 _temp(coupledValue("T")),
38 _mask(getMaterialProperty<Real>("mask")),
39 _prop_dmaskdarg(_n_args),
40 _n_eq(getMaterialProperty<Real>("n_eq")),
41 _prop_dn_eqdT(getMaterialPropertyDerivative<Real>("n_eq", _temp_name)),
42 _prop_dn_eqdarg(_n_args),
43 _z(getParam<int>("species_charge")),
44 _kB(8.617343e-5), // eV/K
45 _e(1.0) // To put energy units in eV
46{
47 // Get derivatives of mask and equilibrium defect concentration
48 for (unsigned int i = 0; i < _n_args; ++i)
49 {
50 _prop_dmaskdarg[i] = &getMaterialPropertyDerivative<Real>("mask", i);
51 _prop_dn_eqdarg[i] = &getMaterialPropertyDerivative<Real>("n_eq", i);
52 }
53}
const Real _kB
Boltzmann constant.
const MaterialProperty< Real > & _mask
Mask.
const int _z
Species charge.
const Real _e
Electron charge.
std::string _temp_name
Temperature.
const VariableValue & _w
unsigned int _w_var
Chemical potential.
const MaterialProperty< Real > & _n_eq
Equilibrium defect concentration.
const MaterialProperty< Real > & _prop_dn_eqdT
std::vector< const MaterialProperty< Real > * > _prop_dn_eqdarg
std::vector< const MaterialProperty< Real > * > _prop_dmaskdarg
const VariableValue & _temp

Member Function Documentation

◆ computeQpJacobian()

Real MaskedExponential::computeQpJacobian ( )
protectedvirtual

Definition at line 70 of file MaskedExponential.C.

71{
72 return -_mask[_qp] * _z * _z * _e * _e / _kB / _temp[_qp] * _n_eq[_qp] * _test[_i][_qp] *
73 _phi[_j][_qp] * std::exp((_w[_qp] - _z * _e * _u[_qp]) / _kB / _temp[_qp]);
74}

◆ computeQpOffDiagJacobian()

Real MaskedExponential::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 77 of file MaskedExponential.C.

78{
79 // Handle chemical potential explicitly since it appears in the residual
80 if (jvar == _w_var)
81 return _mask[_qp] * _z * _e * _n_eq[_qp] / _kB / _temp[_qp] *
82 std::exp((_w[_qp] - _z * _e * _u[_qp]) / _kB / _temp[_qp]) * _phi[_j][_qp] *
83 _test[_i][_qp];
84
85 // Handle temperature explicitly since it appears in the residual
86 if (jvar == _temp_var)
87 return _mask[_qp] * _z * _e * std::exp((_w[_qp] - _z * _e * _u[_qp]) / _kB / _temp[_qp]) *
88 (_prop_dn_eqdT[_qp] -
89 _n_eq[_qp] * (_w[_qp] - _z * _e * _u[_qp]) / _kB / _temp[_qp] / _temp[_qp]) *
90 _phi[_j][_qp] * _test[_i][_qp];
91
92 // General expression for remaining variable dependencies that don't appear in the residual
93 // for all other vars get the coupled variable jvar is referring to
94 const unsigned int cvar = mapJvarToCvar(jvar);
95
96 return _z * _e * std::exp((_w[_qp] - _z * _e * _u[_qp]) / _kB / _temp[_qp]) *
97 ((*_prop_dmaskdarg[cvar])[_qp] + (*_prop_dn_eqdarg[cvar])[_qp]) * _test[_i][_qp] *
98 _phi[_j][_qp];
99}

◆ computeQpResidual()

Real MaskedExponential::computeQpResidual ( )
protectedvirtual

Definition at line 63 of file MaskedExponential.C.

64{
65 return _mask[_qp] * _z * _e * _n_eq[_qp] * _test[_i][_qp] *
66 std::exp((_w[_qp] - _z * _e * _u[_qp]) / _kB / _temp[_qp]);
67}

◆ initialSetup()

void MaskedExponential::initialSetup ( )
virtual

Definition at line 56 of file MaskedExponential.C.

57{
58 validateNonlinearCoupling<Real>("mask");
59 validateNonlinearCoupling<Real>("n_eq");
60}

◆ validParams()

InputParameters MaskedExponential::validParams ( )
static

Definition at line 15 of file MaskedExponential.C.

16{
18 params.addRequiredCoupledVar("w", "Chemical potential for the defect species");
19 params.addRequiredCoupledVar("T", "Temperature");
21 "Kernel to add dilute solution term to Poisson's equation for electrochemical sintering");
22 params.addParam<MaterialPropertyName>(
23 "mask", "hm", "Mask function that specifies where this kernel is active");
24 params.addRequiredParam<MaterialPropertyName>("n_eq", "Equilibrium defect concentration");
25 params.addRequiredParam<int>("species_charge", "Charge of species this kernel is being used for");
26 params.addCoupledVar("coupled_variables",
27 "Vector of nonlinear variable arguments this object depends on");
28 return params;
29}
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()

Member Data Documentation

◆ _e

const Real MaskedExponential::_e
protected

Electron charge.

Definition at line 59 of file MaskedExponential.h.

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

◆ _kB

const Real MaskedExponential::_kB
protected

Boltzmann constant.

Definition at line 56 of file MaskedExponential.h.

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

◆ _mask

const MaterialProperty<Real>& MaskedExponential::_mask
protected

Mask.

Definition at line 44 of file MaskedExponential.h.

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

◆ _n_eq

const MaterialProperty<Real>& MaskedExponential::_n_eq
protected

Equilibrium defect concentration.

Definition at line 48 of file MaskedExponential.h.

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

◆ _prop_dmaskdarg

std::vector<const MaterialProperty<Real> *> MaskedExponential::_prop_dmaskdarg
protected

Definition at line 45 of file MaskedExponential.h.

Referenced by computeQpOffDiagJacobian(), and MaskedExponential().

◆ _prop_dn_eqdarg

std::vector<const MaterialProperty<Real> *> MaskedExponential::_prop_dn_eqdarg
protected

Definition at line 50 of file MaskedExponential.h.

Referenced by computeQpOffDiagJacobian(), and MaskedExponential().

◆ _prop_dn_eqdT

const MaterialProperty<Real>& MaskedExponential::_prop_dn_eqdT
protected

Definition at line 49 of file MaskedExponential.h.

Referenced by computeQpOffDiagJacobian().

◆ _temp

const VariableValue& MaskedExponential::_temp
protected

◆ _temp_name

std::string MaskedExponential::_temp_name
protected

Temperature.

Definition at line 39 of file MaskedExponential.h.

◆ _temp_var

unsigned int MaskedExponential::_temp_var
protected

Definition at line 40 of file MaskedExponential.h.

Referenced by computeQpOffDiagJacobian().

◆ _w

const VariableValue& MaskedExponential::_w
protected

◆ _w_var

unsigned int MaskedExponential::_w_var
protected

Chemical potential.

Definition at line 35 of file MaskedExponential.h.

Referenced by computeQpOffDiagJacobian().

◆ _z

const int MaskedExponential::_z
protected

Species charge.

Definition at line 53 of file MaskedExponential.h.

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


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