www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected 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 Member Functions

 KKSMultiACBulkC (const InputParameters &parameters)
 
virtual void initialSetup ()
 

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

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 28 of file KKSMultiACBulkC.h.

Member Enumeration Documentation

◆ PFFunctionType

enum ACBulk::PFFunctionType
protectedinherited

Definition at line 38 of file ACBulk.h.

Constructor & Destructor Documentation

◆ KKSMultiACBulkC()

KKSMultiACBulkC::KKSMultiACBulkC ( const InputParameters &  parameters)

Definition at line 26 of file KKSMultiACBulkC.C.

27  : KKSMultiACBulkBase(parameters),
28  _c1_name(getVar("cj_names", 0)
29  ->name()), // Can use any dFj/dcj since they are equal so pick first cj in the list
30  _cjs(_num_j),
32  _prop_dF1dc1(getMaterialPropertyDerivative<Real>(_Fj_names[0],
33  _c1_name)), // Use first Fj in list for dFj/dcj
34  _prop_d2F1dc12(getMaterialPropertyDerivative<Real>(_Fj_names[0], _c1_name, _c1_name))
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  // Load concentration variables into the arrays
40  for (unsigned int i = 0; i < _num_j; ++i)
41  {
42  _cjs[i] = &coupledValue("cj_names", i);
43  _cjs_var[i] = coupled("cj_names", i);
44  }
45 
46  // Resize to number of coupled variables (_nvar from KKSMultiACBulkBase constructor)
47  _prop_d2F1dc1darg.resize(_nvar);
48 
49  // Iterate over all coupled variables
50  for (unsigned int i = 0; i < _nvar; ++i)
51  {
52  MooseVariableFEBase * cvar = _coupled_moose_vars[i];
53 
54  // get second partial derivatives wrt c1 and other coupled variable
56  &getMaterialPropertyDerivative<Real>(_Fj_names[0], _c1_name, cvar->name());
57  }
58 }
unsigned int _nvar
Number of coupled variables.
std::vector< const MaterialProperty< Real > * > _prop_d2F1dc1darg
Mixed partial derivatives of the free energy function wrt c1 and any other coupled variables ...
std::vector< MaterialPropertyName > _Fj_names
Names of free energy functions for each phase .
MaterialPropertyName _c1_name
Names of phase concentration variables.
std::vector< unsigned int > _cjs_var
const std::string name
Definition: Setup.h:22
std::vector< const VariableValue * > _cjs
const MaterialProperty< Real > & _prop_d2F1dc12
Second derivative of the free energy function .
const MaterialProperty< Real > & _prop_dF1dc1
Derivative of the free energy function .
KKSMultiACBulkBase(const InputParameters &parameters)

Member Function Documentation

◆ computeDFDOP() [1/2]

Real KKSMultiACBulkC::computeDFDOP ( PFFunctionType  type)
protectedvirtual

Definition at line 61 of file KKSMultiACBulkC.C.

62 {
63  Real sum = 0.0;
64 
65  switch (type)
66  {
67  case Residual:
68  for (unsigned int n = 0; n < _num_j; ++n)
69  sum += (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
70 
71  return -_prop_dF1dc1[_qp] * sum;
72 
73  case Jacobian:
74  // For when this kernel is used in the Lagrange multiplier equation
75  // In that case the Lagrange multiplier is the nonlinear variable
76  if (_etai_var != _var.number())
77  return 0.0;
78 
79  // For when eta_i is the nonlinear variable
80  for (unsigned int n = 0; n < _num_j; ++n)
81  sum += (*_prop_d2hjdetai2[n])[_qp] * (*_cjs[n])[_qp];
82 
83  return -_phi[_j][_qp] * _prop_dF1dc1[_qp] * sum;
84  }
85 
86  mooseError("Invalid type passed in");
87 }
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
std::vector< const VariableValue * > _cjs
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.
const MaterialProperty< Real > & _prop_dF1dc1
Derivative of the free energy function .
unsigned int _etai_var
index of order parameter that derivatives are taken wrt

◆ 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 90 of file KKSMultiACBulkC.C.

91 {
92  // first get dependence of mobility _L on other variables using parent class
93  // member function
95 
96  Real sum = 0.0;
97  // Then add dependence of KKSACBulkC on other variables
98  // Treat cj variables specially, as they appear in the residual
99  if (jvar == _cjs_var[0])
100  {
101  for (unsigned int n = 0; n < _num_j; ++n)
102  sum += (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
103 
104  res -= _L[_qp] * (sum * _prop_d2F1dc12[_qp] + _prop_dF1dc1[_qp] * (*_prop_dhjdetai[0])[_qp]) *
105  _phi[_j][_qp] * _test[_i][_qp];
106  return res;
107  }
108 
109  for (unsigned int i = 1; i < _num_j; ++i)
110  {
111  if (jvar == _cjs_var[i])
112  {
113  res -=
114  _L[_qp] * _prop_dF1dc1[_qp] * (*_prop_dhjdetai[i])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
115  return res;
116  }
117  }
118 
119  // for all other vars get the coupled variable jvar is referring to
120  const unsigned int cvar = mapJvarToCvar(jvar);
121 
122  for (unsigned int n = 0; n < _num_j; ++n)
123  sum += _prop_dF1dc1[_qp] * (*_prop_d2hjdetaidarg[n][cvar])[_qp] * (*_cjs[n])[_qp] +
124  (*_prop_d2F1dc1darg[cvar])[_qp] * (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
125 
126  res -= _L[_qp] * sum * _phi[_j][_qp] * _test[_i][_qp];
127 
128  return res;
129 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:47
std::vector< const MaterialProperty< Real > * > _prop_d2F1dc1darg
Mixed partial derivatives of the free energy function wrt c1 and any other coupled variables ...
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians) ...
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
std::vector< unsigned int > _cjs_var
std::vector< const VariableValue * > _cjs
const MaterialProperty< Real > & _prop_d2F1dc12
Second derivative of the free energy function .
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACBulk.h:117
const MaterialProperty< Real > & _prop_dF1dc1
Derivative of the free energy function .

◆ initialSetup()

void KKSMultiACBulkBase::initialSetup ( )
virtualinherited

Reimplemented from ACBulk< Real >.

Definition at line 76 of file KKSMultiACBulkBase.C.

77 {
79 
80  for (unsigned int n = 0; n < _num_j; ++n)
81  {
82  validateNonlinearCoupling<Real>(_Fj_names[n]);
83  validateNonlinearCoupling<Real>(_hj_names[n]);
84  }
85 }
virtual void initialSetup()
Definition: ACBulk.h:86
std::vector< MaterialPropertyName > _Fj_names
Names of free energy functions for each phase .
std::vector< MaterialPropertyName > _hj_names
switching function names

◆ precomputeQpJacobian()

Real ACBulk< Real >::precomputeQpJacobian ( )
protectedvirtualinherited

Definition at line 104 of file ACBulk.h.

105 {
106  // Get free energy derivative and Jacobian
107  Real dFdop = computeDFDOP(Residual);
108 
109  Real JdFdop = computeDFDOP(Jacobian);
110 
111  // Set Jacobian value using product rule
112  return _L[_qp] * JdFdop + _dLdop[_qp] * _phi[_j][_qp] * dFdop;
113 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:47
virtual Real computeDFDOP(PFFunctionType type)=0
const MaterialProperty< Real > & _dLdop
Mobility derivative w.r.t. order parameter.
Definition: ACBulk.h:50

◆ precomputeQpResidual()

Real ACBulk< Real >::precomputeQpResidual ( )
protectedvirtualinherited

Definition at line 93 of file ACBulk.h.

94 {
95  // Get free energy derivative from function
96  Real dFdop = computeDFDOP(Residual);
97 
98  // Set residual
99  return _L[_qp] * dFdop;
100 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:47
virtual Real computeDFDOP(PFFunctionType type)=0

◆ validParams()

InputParameters ACBulk< Real >::validParams ( )
staticinherited

Definition at line 75 of file ACBulk.h.

76 {
77  InputParameters params = ::validParams<KernelValue>();
78  params.addClassDescription("Allen-Cahn base Kernel");
79  params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
80  params.addCoupledVar("args", "Vector of arguments of the mobility");
81  return params;
82 }

Member Data Documentation

◆ _c1_name

MaterialPropertyName KKSMultiACBulkC::_c1_name
protected

Names of phase concentration variables.

Definition at line 38 of file KKSMultiACBulkC.h.

Referenced by KKSMultiACBulkC().

◆ _cjs

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

Definition at line 39 of file KKSMultiACBulkC.h.

Referenced by computeDFDOP(), computeQpOffDiagJacobian(), and KKSMultiACBulkC().

◆ _cjs_var

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

Definition at line 40 of file KKSMultiACBulkC.h.

Referenced by computeQpOffDiagJacobian(), and KKSMultiACBulkC().

◆ _dLdarg

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

Mobility derivative w.r.t coupled variables.

Definition at line 53 of file ACBulk.h.

◆ _dLdop

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

Mobility derivative w.r.t. order parameter.

Definition at line 50 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 40 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase().

◆ _etai_var

unsigned int KKSMultiACBulkBase::_etai_var
protectedinherited

index of order parameter that derivatives are taken wrt

Definition at line 43 of file KKSMultiACBulkBase.h.

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

◆ _Fj_names

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

Names of free energy functions for each phase \( F_j \).

Definition at line 46 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::initialSetup(), KKSMultiACBulkBase::KKSMultiACBulkBase(), and KKSMultiACBulkC().

◆ _hj_names

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

switching function names

Definition at line 56 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::initialSetup(), and KKSMultiACBulkBase::KKSMultiACBulkBase().

◆ _L

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

◆ _num_j

unsigned int KKSMultiACBulkBase::_num_j
protectedinherited

◆ _nvar

unsigned int KKSMultiACBulkBase::_nvar
protectedinherited

Number of coupled variables.

Definition at line 37 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase(), and KKSMultiACBulkC().

◆ _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 45 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 48 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 65 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 68 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 43 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 53 of file KKSMultiACBulkBase.h.

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

◆ _prop_dhjdetai

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

Derivatives of the switching functions wrt the order parameter for this kernel.

Definition at line 62 of file KKSMultiACBulkBase.h.

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

◆ _prop_Fj

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

Values of the free energy functions for each phase \( F_j \).

Definition at line 50 of file KKSMultiACBulkBase.h.

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

◆ _prop_hj

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

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

Definition at line 59 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase().


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