www.mooseframework.org
ACInterfaceKobayashi2.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<KernelGrad>();
14  params.addClassDescription("Anisotropic Gradient energy Allen-Cahn Kernel Part 2");
15  params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
16  params.addParam<MaterialPropertyName>("eps_name", "eps", "The anisotropic parameter");
17  params.addParam<MaterialPropertyName>(
18  "depsdgrad_op_name",
19  "depsdgrad_op",
20  "The derivative of the anisotropic interface parameter eps with respect to grad_op");
21  params.addCoupledVar("args", "Vector of nonlinear variable arguments this object depends on");
22  return params;
23 }
24 
25 ACInterfaceKobayashi2::ACInterfaceKobayashi2(const InputParameters & parameters)
26  : DerivativeMaterialInterface<JvarMapKernelInterface<KernelGrad>>(parameters),
27  _L(getMaterialProperty<Real>("mob_name")),
28  _dLdop(getMaterialPropertyDerivative<Real>("mob_name", _var.name())),
29  _eps(getMaterialProperty<Real>("eps_name")),
30  _depsdgrad_op(getMaterialProperty<RealGradient>("depsdgrad_op_name"))
31 {
32  // Get number of coupled variables
33  unsigned int nvar = _coupled_moose_vars.size();
34 
35  // reserve space for derivatives
36  _dLdarg.resize(nvar);
37  _depsdarg.resize(nvar);
38 
39  // Iterate over all coupled variables
40  for (unsigned int i = 0; i < nvar; ++i)
41  {
42  const VariableName iname = _coupled_moose_vars[i]->name();
43  _dLdarg[i] = &getMaterialPropertyDerivative<Real>("mob_name", iname);
44  _depsdarg[i] = &getMaterialPropertyDerivative<Real>("eps_name", iname);
45  }
46 }
47 
48 RealGradient
50 {
51  // Set interfacial part of residual
52  return _eps[_qp] * _eps[_qp] * _L[_qp] * _grad_u[_qp];
53 }
54 
55 RealGradient
57 {
58  // Calculate depsdop_i
59  Real depsdop_i = _depsdgrad_op[_qp] * _grad_phi[_j][_qp];
60 
61  // Set Jacobian using product rule
62  return _L[_qp] *
63  (_eps[_qp] * _eps[_qp] * _grad_phi[_j][_qp] + 2.0 * _eps[_qp] * depsdop_i * _grad_u[_qp]);
64 }
65 
66 Real
68 {
69  // get the coupled variable jvar is referring to
70  const unsigned int cvar = mapJvarToCvar(jvar);
71 
72  // Set off-diagonal jaocbian terms from mobility and epsilon dependence
73  Real dsum = _L[_qp] * 2.0 * _eps[_qp] * (*_depsdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] *
74  _grad_test[_i][_qp];
75  dsum += _eps[_qp] * _eps[_qp] * (*_dLdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] *
76  _grad_test[_i][_qp];
77 
78  return dsum;
79 }
ACInterfaceKobayashi2(const InputParameters &parameters)
virtual RealGradient precomputeQpResidual()
const MaterialProperty< RealGradient > & _depsdgrad_op
const MaterialProperty< Real > & _L
Mobility.
const MaterialProperty< Real > & _eps
Interfacial parameter.
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
std::vector< const MaterialProperty< Real > * > _depsdarg
InputParameters validParams< ACInterfaceKobayashi2 >()
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
virtual RealGradient precomputeQpJacobian()