www.mooseframework.org
ACInterfaceKobayashi1.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 "ACInterfaceKobayashi1.h"
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<KernelGrad>();
19  params.addClassDescription("Anisotropic gradient energy Allen-Cahn Kernel Part 1");
20  params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel");
21  params.addParam<MaterialPropertyName>("eps_name", "eps", "The anisotropic interface parameter");
22  params.addParam<MaterialPropertyName>(
23  "deps_name",
24  "deps",
25  "The derivative of the anisotropic interface parameter with respect to angle");
26  params.addParam<MaterialPropertyName>(
27  "depsdgrad_op_name",
28  "depsdgrad_op",
29  "The derivative of the anisotropic interface parameter eps with respect to grad_op");
30  params.addParam<MaterialPropertyName>(
31  "ddepsdgrad_op_name", "ddepsdgrad_op", "The derivative of deps with respect to grad_op");
32  params.addCoupledVar("args", "Vector of nonlinear variable arguments this object depends on");
33  return params;
34 }
35 
36 ACInterfaceKobayashi1::ACInterfaceKobayashi1(const InputParameters & parameters)
37  : DerivativeMaterialInterface<JvarMapKernelInterface<KernelGrad>>(parameters),
38  _L(getMaterialProperty<Real>("mob_name")),
39  _dLdop(getMaterialPropertyDerivative<Real>("mob_name", _var.name())),
40  _eps(getMaterialProperty<Real>("eps_name")),
41  _deps(getMaterialProperty<Real>("deps_name")),
42  _depsdgrad_op(getMaterialProperty<RealGradient>("depsdgrad_op_name")),
43  _ddepsdgrad_op(getMaterialProperty<RealGradient>("ddepsdgrad_op_name"))
44 {
45  // Get number of coupled variables
46  unsigned int nvar = _coupled_moose_vars.size();
47 
48  // reserve space for derivatives
49  _dLdarg.resize(nvar);
50  _depsdarg.resize(nvar);
51  _ddepsdarg.resize(nvar);
52 
53  // Iterate over all coupled variables
54  for (unsigned int i = 0; i < nvar; ++i)
55  {
56  const VariableName iname = _coupled_moose_vars[i]->name();
57  _dLdarg[i] = &getMaterialPropertyDerivative<Real>("mob_name", iname);
58  _depsdarg[i] = &getMaterialPropertyDerivative<Real>("eps_name", iname);
59  _ddepsdarg[i] = &getMaterialPropertyDerivative<Real>("deps_name", iname);
60  }
61 }
62 
65 {
66  // Set modified gradient vector
67  const RealGradient v(-_grad_u[_qp](1), _grad_u[_qp](0), 0);
68 
69  // Define anisotropic interface residual
70  return _eps[_qp] * _deps[_qp] * _L[_qp] * v;
71 }
72 
75 {
76  // Set modified gradient vector
77  const RealGradient v(-_grad_u[_qp](1), _grad_u[_qp](0), 0);
78 
79  // dvdgrad_op*_grad_phi
80  const RealGradient dv(-_grad_phi[_j][_qp](1), _grad_phi[_j][_qp](0), 0);
81 
82  // Derivative of epsilon wrt nodal op values
83  Real depsdop_i = _depsdgrad_op[_qp] * _grad_phi[_j][_qp];
84  Real ddepsdop_i = _ddepsdgrad_op[_qp] * _grad_phi[_j][_qp];
85  ;
86 
87  // Set the Jacobian
88  RealGradient jac1 = _eps[_qp] * _deps[_qp] * dv;
89  RealGradient jac2 = _deps[_qp] * depsdop_i * v;
90  RealGradient jac3 = _eps[_qp] * ddepsdop_i * v;
91 
92  return _L[_qp] * (jac1 + jac2 + jac3);
93 }
94 
95 Real
97 {
98  // get the coupled variable jvar is referring to
99  const unsigned int cvar = mapJvarToCvar(jvar);
100 
101  // Set modified gradient vector
102  const RealGradient v(-_grad_u[_qp](1), _grad_u[_qp](0), 0);
103 
104  // Set off-diagonal jaocbian terms from mobility dependence
105  Real dsum =
106  _L[_qp] * (_deps[_qp] * (*_depsdarg[cvar])[_qp] * _phi[_j][_qp] * v * _grad_test[_i][_qp]);
107  dsum +=
108  _L[_qp] * (_eps[_qp] * (*_ddepsdarg[cvar])[_qp] * _phi[_j][_qp] * v * _grad_test[_i][_qp]);
109  dsum += (*_dLdarg[cvar])[_qp] * _phi[_j][_qp] * _eps[_qp] * _deps[_qp] * v * _grad_test[_i][_qp];
110 
111  return dsum;
112 }
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
ACInterfaceKobayashi1::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACInterfaceKobayashi1.C:96
ACInterfaceKobayashi1::_ddepsdgrad_op
const MaterialProperty< RealGradient > & _ddepsdgrad_op
Definition: ACInterfaceKobayashi1.h:44
validParams< ACInterfaceKobayashi1 >
InputParameters validParams< ACInterfaceKobayashi1 >()
Definition: ACInterfaceKobayashi1.C:16
ACInterfaceKobayashi1::_ddepsdarg
std::vector< const MaterialProperty< Real > * > _ddepsdarg
Definition: ACInterfaceKobayashi1.h:49
ACInterfaceKobayashi1::_dLdarg
std::vector< const MaterialProperty< Real > * > _dLdarg
Mobility derivative w.r.t. other coupled variables.
Definition: ACInterfaceKobayashi1.h:47
registerMooseObject
registerMooseObject("PhaseFieldApp", ACInterfaceKobayashi1)
ACInterfaceKobayashi1
Kernel 1 of 2 for interfacial energy anisotropy in the Allen-Cahn equation as implemented in R.
Definition: ACInterfaceKobayashi1.h:27
ACInterfaceKobayashi1::_L
const MaterialProperty< Real > & _L
Mobility.
Definition: ACInterfaceKobayashi1.h:39
ACInterfaceKobayashi1::_depsdarg
std::vector< const MaterialProperty< Real > * > _depsdarg
Definition: ACInterfaceKobayashi1.h:48
ACInterfaceKobayashi1::precomputeQpJacobian
virtual RealGradient precomputeQpJacobian()
Definition: ACInterfaceKobayashi1.C:74
ACInterfaceKobayashi1::_depsdgrad_op
const MaterialProperty< RealGradient > & _depsdgrad_op
Definition: ACInterfaceKobayashi1.h:43
name
const std::string name
Definition: Setup.h:21
ACInterfaceKobayashi1::_eps
const MaterialProperty< Real > & _eps
Definition: ACInterfaceKobayashi1.h:41
ACInterfaceKobayashi1.h
ACInterfaceKobayashi1::_deps
const MaterialProperty< Real > & _deps
Definition: ACInterfaceKobayashi1.h:42
ACInterfaceKobayashi1::precomputeQpResidual
virtual RealGradient precomputeQpResidual()
Enum of computeDFDOP inputs.
Definition: ACInterfaceKobayashi1.C:64
ACInterfaceKobayashi1::ACInterfaceKobayashi1
ACInterfaceKobayashi1(const InputParameters &parameters)
Definition: ACInterfaceKobayashi1.C:36