www.mooseframework.org
ACInterfaceKobayashi2.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "ACInterfaceKobayashi2.h"
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<KernelGrad>();
19  params.addClassDescription("Anisotropic Gradient energy Allen-Cahn Kernel Part 2");
20  params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
21  params.addParam<MaterialPropertyName>("eps_name", "eps", "The anisotropic parameter");
22  params.addParam<MaterialPropertyName>(
23  "depsdgrad_op_name",
24  "depsdgrad_op",
25  "The derivative of the anisotropic interface parameter eps with respect to grad_op");
26  params.addCoupledVar("args", "Vector of nonlinear variable arguments this object depends on");
27  return params;
28 }
29 
30 ACInterfaceKobayashi2::ACInterfaceKobayashi2(const InputParameters & parameters)
31  : DerivativeMaterialInterface<JvarMapKernelInterface<KernelGrad>>(parameters),
32  _L(getMaterialProperty<Real>("mob_name")),
33  _dLdop(getMaterialPropertyDerivative<Real>("mob_name", _var.name())),
34  _eps(getMaterialProperty<Real>("eps_name")),
35  _depsdgrad_op(getMaterialProperty<RealGradient>("depsdgrad_op_name"))
36 {
37  // Get number of coupled variables
38  unsigned int nvar = _coupled_moose_vars.size();
39 
40  // reserve space for derivatives
41  _dLdarg.resize(nvar);
42  _depsdarg.resize(nvar);
43 
44  // Iterate over all coupled variables
45  for (unsigned int i = 0; i < nvar; ++i)
46  {
47  const VariableName iname = _coupled_moose_vars[i]->name();
48  _dLdarg[i] = &getMaterialPropertyDerivative<Real>("mob_name", iname);
49  _depsdarg[i] = &getMaterialPropertyDerivative<Real>("eps_name", iname);
50  }
51 }
52 
55 {
56  // Set interfacial part of residual
57  return _eps[_qp] * _eps[_qp] * _L[_qp] * _grad_u[_qp];
58 }
59 
62 {
63  // Calculate depsdop_i
64  Real depsdop_i = _depsdgrad_op[_qp] * _grad_phi[_j][_qp];
65 
66  // Set Jacobian using product rule
67  return _L[_qp] *
68  (_eps[_qp] * _eps[_qp] * _grad_phi[_j][_qp] + 2.0 * _eps[_qp] * depsdop_i * _grad_u[_qp]);
69 }
70 
71 Real
73 {
74  // get the coupled variable jvar is referring to
75  const unsigned int cvar = mapJvarToCvar(jvar);
76 
77  // Set off-diagonal jaocbian terms from mobility and epsilon dependence
78  Real dsum = _L[_qp] * 2.0 * _eps[_qp] * (*_depsdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] *
79  _grad_test[_i][_qp];
80  dsum += _eps[_qp] * _eps[_qp] * (*_dLdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_u[_qp] *
81  _grad_test[_i][_qp];
82 
83  return dsum;
84 }
ACInterfaceKobayashi2::precomputeQpJacobian
virtual RealGradient precomputeQpJacobian()
Definition: ACInterfaceKobayashi2.C:61
ACInterfaceKobayashi2::_depsdarg
std::vector< const MaterialProperty< Real > * > _depsdarg
Definition: ACInterfaceKobayashi2.h:47
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
validParams< ACInterfaceKobayashi2 >
InputParameters validParams< ACInterfaceKobayashi2 >()
Definition: ACInterfaceKobayashi2.C:16
registerMooseObject
registerMooseObject("PhaseFieldApp", ACInterfaceKobayashi2)
ACInterfaceKobayashi2::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACInterfaceKobayashi2.C:72
ACInterfaceKobayashi2::ACInterfaceKobayashi2
ACInterfaceKobayashi2(const InputParameters &parameters)
Definition: ACInterfaceKobayashi2.C:30
ACInterfaceKobayashi2::precomputeQpResidual
virtual RealGradient precomputeQpResidual()
Definition: ACInterfaceKobayashi2.C:54
ACInterfaceKobayashi2::_eps
const MaterialProperty< Real > & _eps
Interfacial parameter.
Definition: ACInterfaceKobayashi2.h:42
name
const std::string name
Definition: Setup.h:21
ACInterfaceKobayashi2
Kernel 2 of 2 for interfacial energy anisotropy in the Allen-Cahn equation as implemented in R.
Definition: ACInterfaceKobayashi2.h:27
ACInterfaceKobayashi2::_L
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterfaceKobayashi2.h:38
ACInterfaceKobayashi2::_depsdgrad_op
const MaterialProperty< RealGradient > & _depsdgrad_op
Definition: ACInterfaceKobayashi2.h:43
ACInterfaceKobayashi2.h
ACInterfaceKobayashi2::_dLdarg
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterfaceKobayashi2.h:46