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 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 23 of file ACInterface.h.

Constructor & Destructor Documentation

ACInterface::ACInterface ( const InputParameters &  parameters)

Definition at line 26 of file ACInterface.C.

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

Member Function Documentation

Real ACInterface::computeQpJacobian ( )
protectedvirtual

Definition at line 98 of file ACInterface.C.

99 {
100  // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
101  RealGradient dsum =
102  (_dkappadop[_qp] * _L[_qp] + _kappa[_qp] * _dLdop[_qp]) * _phi[_j][_qp] * _grad_test[_i][_qp];
103 
104  // compute the derivative of the gradient of the mobility
105  if (_variable_L)
106  {
107  RealGradient dgradL =
108  _grad_phi[_j][_qp] * _dLdop[_qp] + _grad_u[_qp] * _phi[_j][_qp] * _d2Ldop2[_qp];
109 
110  for (unsigned int i = 0; i < _nvar; ++i)
111  dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[i])[_qp];
112 
113  dsum += (_kappa[_qp] * dgradL + _dkappadop[_qp] * _phi[_j][_qp] * gradL()) * _test[_i][_qp];
114  }
115 
116  return _grad_phi[_j][_qp] * kappaNablaLPsi() + _grad_u[_qp] * dsum;
117 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:69
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:41
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:46
RealGradient kappaNablaLPsi()
the term
Definition: ACInterface.C:80
const MaterialProperty< Real > & _dLdop
Mobility derivatives w.r.t. order parameter.
Definition: ACInterface.h:49
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
Definition: ACInterface.h:61
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:57
const MaterialProperty< Real > & _dkappadop
kappa derivative w.r.t. order parameter
Definition: ACInterface.h:54
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:43
const MaterialProperty< Real > & _d2Ldop2
Definition: ACInterface.h:50
RealGradient gradL()
Definition: ACInterface.C:71
Real ACInterface::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 120 of file ACInterface.C.

121 {
122  // get the coupled variable jvar is referring to
123  const unsigned int cvar = mapJvarToCvar(jvar);
124 
125  // dsum is the derivative \f$ \frac\partial{\partial \eta} \left( \nabla (L\psi) \right) \f$
126  RealGradient dsum = ((*_dkappadarg[cvar])[_qp] * _L[_qp] + _kappa[_qp] * (*_dLdarg[cvar])[_qp]) *
127  _phi[_j][_qp] * _grad_test[_i][_qp];
128 
129  // compute the derivative of the gradient of the mobility
130  if (_variable_L)
131  {
132  RealGradient dgradL = _grad_phi[_j][_qp] * (*_dLdarg[cvar])[_qp] +
133  _grad_u[_qp] * _phi[_j][_qp] * (*_d2Ldargdop[cvar])[_qp];
134 
135  for (unsigned int i = 0; i < _nvar; ++i)
136  dgradL += (*_gradarg[i])[_qp] * _phi[_j][_qp] * (*_d2Ldarg2[cvar][i])[_qp];
137 
138  dsum += (_kappa[_qp] * dgradL + _dkappadop[_qp] * _phi[_j][_qp] * gradL()) * _test[_i][_qp];
139  }
140 
141  return _grad_u[_qp] * dsum;
142 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:69
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:41
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:46
std::vector< const MaterialProperty< Real > * > _d2Ldargdop
Definition: ACInterface.h:61
std::vector< const MaterialProperty< Real > * > _dkappadarg
kappa derivative w.r.t. other coupled variables
Definition: ACInterface.h:66
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:57
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterface.h:60
std::vector< std::vector< const MaterialProperty< Real > * > > _d2Ldarg2
Definition: ACInterface.h:62
const MaterialProperty< Real > & _dkappadop
kappa derivative w.r.t. order parameter
Definition: ACInterface.h:54
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:43
RealGradient gradL()
Definition: ACInterface.C:71
Real ACInterface::computeQpResidual ( )
protectedvirtual

Definition at line 92 of file ACInterface.C.

93 {
94  return _grad_u[_qp] * kappaNablaLPsi();
95 }
RealGradient kappaNablaLPsi()
the term
Definition: ACInterface.C:80
RealGradient ACInterface::gradKappa ( )
protected
RealGradient ACInterface::gradL ( )
protected

Definition at line 71 of file ACInterface.C.

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

72 {
73  RealGradient g = _grad_u[_qp] * _dLdop[_qp];
74  for (unsigned int i = 0; i < _nvar; ++i)
75  g += (*_gradarg[i])[_qp] * (*_dLdarg[i])[_qp];
76  return g;
77 }
std::vector< const VariableGradient * > _gradarg
Gradients for all coupled variables.
Definition: ACInterface.h:69
const MaterialProperty< Real > & _dLdop
Mobility derivatives w.r.t. order parameter.
Definition: ACInterface.h:49
const unsigned int _nvar
number of coupled variables
Definition: ACInterface.h:57
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterface.h:60
void ACInterface::initialSetup ( )
virtual

Definition at line 64 of file ACInterface.C.

65 {
66  validateCoupling<Real>("mob_name");
67  validateCoupling<Real>("kappa_name");
68 }
RealGradient ACInterface::kappaNablaLPsi ( )
protected

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

Definition at line 80 of file ACInterface.C.

Referenced by computeQpJacobian(), and computeQpResidual().

81 {
82  // sum is the product rule gradient \f$ \nabla (L\psi) \f$
83  RealGradient sum = _L[_qp] * _grad_test[_i][_qp];
84 
85  if (_variable_L)
86  sum += gradL() * _test[_i][_qp];
87 
88  return _kappa[_qp] * sum;
89 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterface.h:41
const bool _variable_L
flag set if L is a function of non-linear variables in args
Definition: ACInterface.h:46
const MaterialProperty< Real > & _kappa
Interfacial parameter.
Definition: ACInterface.h:43
RealGradient gradL()
Definition: ACInterface.C:71

Member Data Documentation

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

Definition at line 62 of file ACInterface.h.

Referenced by ACInterface(), and computeQpOffDiagJacobian().

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

Definition at line 61 of file ACInterface.h.

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

const MaterialProperty<Real>& ACInterface::_d2Ldop2
protected

Definition at line 50 of file ACInterface.h.

Referenced by computeQpJacobian().

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

kappa derivative w.r.t. other coupled variables

Definition at line 66 of file ACInterface.h.

Referenced by ACInterface(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& ACInterface::_dkappadop
protected

kappa derivative w.r.t. order parameter

Definition at line 54 of file ACInterface.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

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

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

Definition at line 60 of file ACInterface.h.

Referenced by ACInterface(), computeQpOffDiagJacobian(), and gradL().

const MaterialProperty<Real>& ACInterface::_dLdop
protected

Mobility derivatives w.r.t. order parameter.

Definition at line 49 of file ACInterface.h.

Referenced by computeQpJacobian(), and gradL().

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

Gradients for all coupled variables.

Definition at line 69 of file ACInterface.h.

Referenced by ACInterface(), computeQpJacobian(), computeQpOffDiagJacobian(), and gradL().

const MaterialProperty<Real>& ACInterface::_kappa
protected

Interfacial parameter.

Definition at line 43 of file ACInterface.h.

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

const MaterialProperty<Real>& ACInterface::_L
protected

Mobility.

Definition at line 41 of file ACInterface.h.

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

const unsigned int ACInterface::_nvar
protected

number of coupled variables

Definition at line 57 of file ACInterface.h.

Referenced by ACInterface(), computeQpJacobian(), computeQpOffDiagJacobian(), and gradL().

const bool ACInterface::_variable_L
protected

flag set if L is a function of non-linear variables in args

Definition at line 46 of file ACInterface.h.

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


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