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

Compute the Allen-Cahn interface term with the weak form residual \( \left( \kappa_i \nabla\eta_i, \nabla (L_i \psi) \right) \). More...

#include <ACInterface.h>

Inheritance diagram for ACInterface:
[legend]

Public Member Functions

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

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
RealGradient gradL ()
 
RealGradient gradKappa ()
 
RealGradient nablaLPsi ()
 the \( \nabla(L\psi) \) term More...
 
RealGradient kappaNablaLPsi ()
 the \( \kappa\nabla(L\psi) \) term More...
 

Protected Attributes

const MaterialProperty< Real > & _L
 Mobility. More...
 
const MaterialProperty< Real > & _kappa
 Interfacial parameter. More...
 
const bool _variable_L
 flag set if L is a function of non-linear variables in args More...
 
const MaterialProperty< Real > & _dkappadop
 kappa derivative w.r.t. order parameter More...
 
const unsigned int _nvar
 number of coupled variables More...
 
std::vector< const MaterialProperty< Real > * > _dkappadarg
 kappa derivative w.r.t. other coupled variables More...
 
std::vector< const VariableGradient * > _gradarg
 Gradients for all coupled variables. More...
 
const MaterialProperty< Real > & _dLdop
 Mobility derivatives w.r.t. order parameter. More...
 
const MaterialProperty< Real > & _d2Ldop2
 
std::vector< const MaterialProperty< Real > * > _dLdarg
 Mobility derivative w.r.t. other coupled variables. More...
 
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
 
std::vector< std::vector< const MaterialProperty< Real > * > > _d2Ldarg2
 

Detailed Description

Compute the Allen-Cahn interface term with the weak form residual \( \left( \kappa_i \nabla\eta_i, \nabla (L_i \psi) \right) \).

Definition at line 26 of file ACInterface.h.

Constructor & Destructor Documentation

◆ ACInterface()

ACInterface::ACInterface ( const InputParameters &  parameters)

Definition at line 31 of file ACInterface.C.

32  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
33  _L(getMaterialProperty<Real>("mob_name")),
34  _kappa(getMaterialProperty<Real>("kappa_name")),
35  _variable_L(getParam<bool>("variable_L")),
36  _dLdop(getMaterialPropertyDerivative<Real>("mob_name", _var.name())),
37  _d2Ldop2(getMaterialPropertyDerivative<Real>("mob_name", _var.name(), _var.name())),
38  _dkappadop(getMaterialPropertyDerivative<Real>("kappa_name", _var.name())),
39  _nvar(_coupled_moose_vars.size()),
40  _dLdarg(_nvar),
45 {
46  // Get mobility and kappa derivatives and coupled variable gradients
47  for (unsigned int i = 0; i < _nvar; ++i)
48  {
49  MooseVariable * ivar = _coupled_standard_moose_vars[i];
50  const VariableName iname = ivar->name();
51  if (iname == _var.name())
52  paramError("args",
53  "The kernel variable should not be specified in the coupled `args` parameter.");
54 
55  _dLdarg[i] = &getMaterialPropertyDerivative<Real>("mob_name", iname);
56  _dkappadarg[i] = &getMaterialPropertyDerivative<Real>("kappa_name", iname);
57 
58  _d2Ldargdop[i] = &getMaterialPropertyDerivative<Real>("mob_name", iname, _var.name());
59 
60  _gradarg[i] = &(ivar->gradSln());
61 
62  _d2Ldarg2[i].resize(_nvar);
63  for (unsigned int j = 0; j < _nvar; ++j)
64  _d2Ldarg2[i][j] =
65  &getMaterialPropertyDerivative<Real>("mob_name", iname, _coupled_moose_vars[j]->name());
66  }
67 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:75
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:47
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:52
const MaterialProperty< Real > & _dLdop
Mobility derivatives w.r.t. order parameter.
Definition: ACInterface.h:55
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
Definition: ACInterface.h:67
std::vector< const MaterialProperty< Real > * > _dkappadarg
kappa derivative w.r.t. other coupled variables
Definition: ACInterface.h:72
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:63
const std::string name
Definition: Setup.h:22
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterface.h:66
std::vector< std::vector< const MaterialProperty< Real > * > > _d2Ldarg2
Definition: ACInterface.h:68
const MaterialProperty< Real > & _dkappadop
kappa derivative w.r.t. order parameter
Definition: ACInterface.h:60
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:49
const MaterialProperty< Real > & _d2Ldop2
Definition: ACInterface.h:56

Member Function Documentation

◆ computeQpJacobian()

Real ACInterface::computeQpJacobian ( )
protectedvirtual

Reimplemented in ACInterface2DMultiPhase1, and ACInterface2DMultiPhase2.

Definition at line 110 of file ACInterface.C.

111 {
112  // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
113  RealGradient dsum =
114  (_dkappadop[_qp] * _L[_qp] + _kappa[_qp] * _dLdop[_qp]) * _phi[_j][_qp] * _grad_test[_i][_qp];
115 
116  // compute the derivative of the gradient of the mobility
117  if (_variable_L)
118  {
119  RealGradient dgradL =
120  _grad_phi[_j][_qp] * _dLdop[_qp] + _grad_u[_qp] * _phi[_j][_qp] * _d2Ldop2[_qp];
121 
122  for (unsigned int i = 0; i < _nvar; ++i)
123  dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[i])[_qp];
124 
125  dsum += (_kappa[_qp] * dgradL + _dkappadop[_qp] * _phi[_j][_qp] * gradL()) * _test[_i][_qp];
126  }
127 
128  return _grad_phi[_j][_qp] * kappaNablaLPsi() + _grad_u[_qp] * dsum;
129 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:75
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:47
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:52
RealGradient kappaNablaLPsi()
the term
Definition: ACInterface.C:98
const MaterialProperty< Real > & _dLdop
Mobility derivatives w.r.t. order parameter.
Definition: ACInterface.h:55
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
Definition: ACInterface.h:67
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:63
const MaterialProperty< Real > & _dkappadop
kappa derivative w.r.t. order parameter
Definition: ACInterface.h:60
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:49
const MaterialProperty< Real > & _d2Ldop2
Definition: ACInterface.h:56
RealGradient gradL()
Definition: ACInterface.C:77

◆ computeQpOffDiagJacobian()

Real ACInterface::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented in ACInterface2DMultiPhase1, and ACInterface2DMultiPhase2.

Definition at line 132 of file ACInterface.C.

133 {
134  // get the coupled variable jvar is referring to
135  const unsigned int cvar = mapJvarToCvar(jvar);
136 
137  // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
138  RealGradient dsum = ((*_dkappadarg[cvar])[_qp] * _L[_qp] + _kappa[_qp] * (*_dLdarg[cvar])[_qp]) *
139  _phi[_j][_qp] * _grad_test[_i][_qp];
140 
141  // compute the derivative of the gradient of the mobility
142  if (_variable_L)
143  {
144  RealGradient dgradL = _grad_phi[_j][_qp] * (*_dLdarg[cvar])[_qp] +
145  _grad_u[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[cvar])[_qp];
146 
147  for (unsigned int i = 0; i < _nvar; ++i)
148  dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldarg2[cvar][i])[_qp];
149 
150  dsum += (_kappa[_qp] * dgradL + _dkappadop[_qp] * _phi[_j][_qp] * gradL()) * _test[_i][_qp];
151  }
152 
153  return _grad_u[_qp] * dsum;
154 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:75
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:47
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:52
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
Definition: ACInterface.h:67
std::vector< const MaterialProperty< Real > * > _dkappadarg
kappa derivative w.r.t. other coupled variables
Definition: ACInterface.h:72
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:63
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterface.h:66
std::vector< std::vector< const MaterialProperty< Real > * > > _d2Ldarg2
Definition: ACInterface.h:68
const MaterialProperty< Real > & _dkappadop
kappa derivative w.r.t. order parameter
Definition: ACInterface.h:60
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:49
RealGradient gradL()
Definition: ACInterface.C:77

◆ computeQpResidual()

Real ACInterface::computeQpResidual ( )
protectedvirtual

Reimplemented in ACInterface2DMultiPhase1.

Definition at line 104 of file ACInterface.C.

105 {
106  return _grad_u[_qp] * kappaNablaLPsi();
107 }
RealGradient kappaNablaLPsi()
the term
Definition: ACInterface.C:98

◆ gradKappa()

RealGradient ACInterface::gradKappa ( )
protected

◆ gradL()

RealGradient ACInterface::gradL ( )
protected

Definition at line 77 of file ACInterface.C.

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

78 {
79  RealGradient g = _grad_u[_qp] * _dLdop[_qp];
80  for (unsigned int i = 0; i < _nvar; ++i)
81  g += (*_gradarg[i])[_qp] * (*_dLdarg[i])[_qp];
82  return g;
83 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:75
const MaterialProperty< Real > & _dLdop
Mobility derivatives w.r.t. order parameter.
Definition: ACInterface.h:55
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:63
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterface.h:66

◆ initialSetup()

void ACInterface::initialSetup ( )
virtual

Definition at line 70 of file ACInterface.C.

71 {
72  validateCoupling<Real>("mob_name");
73  validateCoupling<Real>("kappa_name");
74 }

◆ kappaNablaLPsi()

RealGradient ACInterface::kappaNablaLPsi ( )
protected

the \( \kappa\nabla(L\psi) \) term

Definition at line 98 of file ACInterface.C.

Referenced by computeQpJacobian(), and computeQpResidual().

99 {
100  return _kappa[_qp] * nablaLPsi();
101 }
RealGradient nablaLPsi()
the term
Definition: ACInterface.C:86
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:49

◆ nablaLPsi()

RealGradient ACInterface::nablaLPsi ( )
protected

the \( \nabla(L\psi) \) term

Definition at line 86 of file ACInterface.C.

Referenced by ACInterface2DMultiPhase1::computeQpJacobian(), ACInterface2DMultiPhase2::computeQpJacobian(), ACInterface2DMultiPhase1::computeQpOffDiagJacobian(), ACInterface2DMultiPhase2::computeQpOffDiagJacobian(), ACInterface2DMultiPhase1::computeQpResidual(), and kappaNablaLPsi().

87 {
88  // sum is the product rule gradient \f$ \nabla (L\psi) \f$
89  RealGradient sum = _L[_qp] * _grad_test[_i][_qp];
90 
91  if (_variable_L)
92  sum += gradL() * _test[_i][_qp];
93 
94  return sum;
95 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:47
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:52
RealGradient gradL()
Definition: ACInterface.C:77

Member Data Documentation

◆ _d2Ldarg2

std::vector<std::vector<const MaterialProperty<Real> *> > ACInterface::_d2Ldarg2
protected

◆ _d2Ldargdop

std::vector<const MaterialProperty<Real> *> ACInterface::_d2Ldargdop
protected

◆ _d2Ldop2

const MaterialProperty<Real>& ACInterface::_d2Ldop2
protected

◆ _dkappadarg

std::vector<const MaterialProperty<Real> *> ACInterface::_dkappadarg
protected

kappa derivative w.r.t. other coupled variables

Definition at line 72 of file ACInterface.h.

Referenced by ACInterface(), and computeQpOffDiagJacobian().

◆ _dkappadop

const MaterialProperty<Real>& ACInterface::_dkappadop
protected

kappa derivative w.r.t. order parameter

Definition at line 60 of file ACInterface.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

◆ _dLdarg

std::vector<const MaterialProperty<Real> *> ACInterface::_dLdarg
protected

Mobility derivative w.r.t. other coupled variables.

Definition at line 66 of file ACInterface.h.

Referenced by ACInterface(), computeQpOffDiagJacobian(), ACInterface2DMultiPhase1::computeQpOffDiagJacobian(), ACInterface2DMultiPhase2::computeQpOffDiagJacobian(), and gradL().

◆ _dLdop

const MaterialProperty<Real>& ACInterface::_dLdop
protected

Mobility derivatives w.r.t. order parameter.

Definition at line 55 of file ACInterface.h.

Referenced by computeQpJacobian(), ACInterface2DMultiPhase2::computeQpJacobian(), ACInterface2DMultiPhase1::computeQpJacobian(), and gradL().

◆ _gradarg

std::vector<const VariableGradient *> ACInterface::_gradarg
protected

◆ _kappa

const MaterialProperty<Real>& ACInterface::_kappa
protected

◆ _L

const MaterialProperty<Real>& ACInterface::_L
protected

Mobility.

Definition at line 47 of file ACInterface.h.

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

◆ _nvar

const unsigned int ACInterface::_nvar
protected

◆ _variable_L

const bool ACInterface::_variable_L
protected

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