www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
KKSMultiACBulkC Class Reference

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

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

Member Enumeration Documentation

enum ACBulk::PFFunctionType
protectedinherited

Definition at line 35 of file ACBulk.h.

Constructor & Destructor Documentation

KKSMultiACBulkC::KKSMultiACBulkC ( const InputParameters &  parameters)

Definition at line 21 of file KKSMultiACBulkC.C.

22  : KKSMultiACBulkBase(parameters),
23  _c1_name(getVar("cj_names", 0)
24  ->name()), // Can use any dFj/dcj since they are equal so pick first cj in the list
25  _cjs(_num_j),
27  _prop_dF1dc1(getMaterialPropertyDerivative<Real>(_Fj_names[0],
28  _c1_name)), // Use first Fj in list for dFj/dcj
29  _prop_d2F1dc12(getMaterialPropertyDerivative<Real>(_Fj_names[0], _c1_name, _c1_name))
30 {
31  if (_num_j != coupledComponents("cj_names"))
32  mooseError("Need to pass in as many cj_names as Fj_names in KKSMultiACBulkC ", name());
33 
34  // Load concentration variables into the arrays
35  for (unsigned int i = 0; i < _num_j; ++i)
36  {
37  _cjs[i] = &coupledValue("cj_names", i);
38  _cjs_var[i] = coupled("cj_names", i);
39  }
40 
41  // Resize to number of coupled variables (_nvar from KKSMultiACBulkBase constructor)
42  _prop_d2F1dc1darg.resize(_nvar);
43 
44  // Iterate over all coupled variables
45  for (unsigned int i = 0; i < _nvar; ++i)
46  {
47  MooseVariable * cvar = _coupled_moose_vars[i];
48 
49  // get second partial derivatives wrt c1 and other coupled variable
51  &getMaterialPropertyDerivative<Real>(_Fj_names[0], _c1_name, cvar->name());
52  }
53 }
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
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

Real KKSMultiACBulkC::computeDFDOP ( PFFunctionType  type)
protectedvirtual

Implements ACBulk< Real >.

Definition at line 56 of file KKSMultiACBulkC.C.

57 {
58  Real sum = 0.0;
59 
60  switch (type)
61  {
62  case Residual:
63  for (unsigned int n = 0; n < _num_j; ++n)
64  sum += (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
65 
66  return -_prop_dF1dc1[_qp] * sum;
67 
68  case Jacobian:
69  // For when this kernel is used in the Lagrange multiplier equation
70  // In that case the Lagrange multiplier is the nonlinear variable
71  if (_etai_var != _var.number())
72  return 0.0;
73 
74  // For when eta_i is the nonlinear variable
75  for (unsigned int n = 0; n < _num_j; ++n)
76  sum += (*_prop_d2hjdetai2[n])[_qp] * (*_cjs[n])[_qp];
77 
78  return -_phi[_j][_qp] * _prop_dF1dc1[_qp] * sum;
79  }
80 
81  mooseError("Invalid type passed in");
82 }
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
Real KKSMultiACBulkC::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented from ACBulk< Real >.

Definition at line 85 of file KKSMultiACBulkC.C.

86 {
87  // first get dependence of mobility _L on other variables using parent class
88  // member function
90 
91  Real sum = 0.0;
92  // Then add dependence of KKSACBulkC on other variables
93  // Treat cj variables specially, as they appear in the residual
94  if (jvar == _cjs_var[0])
95  {
96  for (unsigned int n = 0; n < _num_j; ++n)
97  sum += (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
98 
99  res -= _L[_qp] * (sum * _prop_d2F1dc12[_qp] + _prop_dF1dc1[_qp] * (*_prop_dhjdetai[0])[_qp]) *
100  _phi[_j][_qp] * _test[_i][_qp];
101  return res;
102  }
103 
104  for (unsigned int i = 1; i < _num_j; ++i)
105  {
106  if (jvar == _cjs_var[i])
107  {
108  res -=
109  _L[_qp] * _prop_dF1dc1[_qp] * (*_prop_dhjdetai[i])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
110  return res;
111  }
112  }
113 
114  // for all other vars get the coupled variable jvar is referring to
115  const unsigned int cvar = mapJvarToCvar(jvar);
116 
117  for (unsigned int n = 0; n < _num_j; ++n)
118  sum += _prop_dF1dc1[_qp] * (*_prop_d2hjdetaidarg[n][cvar])[_qp] * (*_cjs[n])[_qp] +
119  (*_prop_d2F1dc1darg[cvar])[_qp] * (*_prop_dhjdetai[n])[_qp] * (*_cjs[n])[_qp];
120 
121  res -= _L[_qp] * sum * _phi[_j][_qp] * _test[_i][_qp];
122 
123  return res;
124 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:44
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:114
const MaterialProperty< Real > & _prop_dF1dc1
Derivative of the free energy function .
void KKSMultiACBulkBase::initialSetup ( )
virtualinherited

Reimplemented from ACBulk< Real >.

Definition at line 75 of file KKSMultiACBulkBase.C.

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

Member Data Documentation

MaterialPropertyName KKSMultiACBulkC::_c1_name
protected

Names of phase concentration variables.

Definition at line 35 of file KKSMultiACBulkC.h.

Referenced by KKSMultiACBulkC().

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

Definition at line 36 of file KKSMultiACBulkC.h.

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

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

Definition at line 37 of file KKSMultiACBulkC.h.

Referenced by computeQpOffDiagJacobian(), and KKSMultiACBulkC().

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

Mobility derivative w.r.t coupled variables.

Definition at line 50 of file ACBulk.h.

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

Mobility derivative w.r.t. order parameter.

Definition at line 47 of file ACBulk.h.

VariableName KKSMultiACBulkBase::_etai_name
protectedinherited

name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material properties)

Definition at line 37 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase().

unsigned int KKSMultiACBulkBase::_etai_var
protectedinherited

index of order parameter that derivatives are taken wrt

Definition at line 40 of file KKSMultiACBulkBase.h.

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

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

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

Definition at line 43 of file KKSMultiACBulkBase.h.

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

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

switching function names

Definition at line 53 of file KKSMultiACBulkBase.h.

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

const MaterialProperty<Real >& ACBulk< Real >::_L
protectedinherited
unsigned int KKSMultiACBulkBase::_num_j
protectedinherited
unsigned int KKSMultiACBulkBase::_nvar
protectedinherited

Number of coupled variables.

Definition at line 34 of file KKSMultiACBulkBase.h.

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

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

Referenced by computeQpOffDiagJacobian().

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

Referenced by computeQpOffDiagJacobian(), and KKSMultiACBulkC().

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 62 of file KKSMultiACBulkBase.h.

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

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 65 of file KKSMultiACBulkBase.h.

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

const MaterialProperty<Real>& KKSMultiACBulkC::_prop_dF1dc1
protected

Derivative of the free energy function \( \frac d{dc_1} F_1 \).

Definition at line 40 of file KKSMultiACBulkC.h.

Referenced by computeDFDOP(), and computeQpOffDiagJacobian().

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 50 of file KKSMultiACBulkBase.h.

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

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

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

Definition at line 59 of file KKSMultiACBulkBase.h.

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

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

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

Definition at line 47 of file KKSMultiACBulkBase.h.

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

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

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

Definition at line 56 of file KKSMultiACBulkBase.h.

Referenced by KKSMultiACBulkBase::KKSMultiACBulkBase().


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