www.mooseframework.org
AllenCahn.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 /****************************************************************/
7 #include "AllenCahn.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = ACBulk<Real>::validParams();
14  params.addClassDescription("Allen-Cahn Kernel that uses a DerivativeMaterial Free Energy");
15  params.addRequiredParam<MaterialPropertyName>(
16  "f_name", "Base name of the free energy function F defined in a DerivativeParsedMaterial");
17  return params;
18 }
19 
20 AllenCahn::AllenCahn(const InputParameters & parameters)
21  : ACBulk<Real>(parameters),
22  _nvar(_coupled_moose_vars.size()),
23  _dFdEta(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
24  _d2FdEta2(getMaterialPropertyDerivative<Real>("f_name", _var.name(), _var.name())),
25  _d2FdEtadarg(_nvar)
26 {
27  // Iterate over all coupled variables
28  for (unsigned int i = 0; i < _nvar; ++i)
29  _d2FdEtadarg[i] =
30  &getMaterialPropertyDerivative<Real>("f_name", _var.name(), _coupled_moose_vars[i]->name());
31 }
32 
33 void
35 {
37  validateNonlinearCoupling<Real>("f_name");
38  validateDerivativeMaterialPropertyBase<Real>("f_name");
39 }
40 
41 Real
43 {
44  switch (type)
45  {
46  case Residual:
47  return _dFdEta[_qp];
48 
49  case Jacobian:
50  return _d2FdEta2[_qp] * _phi[_j][_qp];
51  }
52 
53  mooseError("Internal error");
54 }
55 
56 Real
58 {
59  // get the coupled variable jvar is referring to
60  const unsigned int cvar = mapJvarToCvar(jvar);
61 
63  _L[_qp] * (*_d2FdEtadarg[cvar])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
64 }
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:44
std::vector< const MaterialProperty< Real > * > _d2FdEtadarg
Definition: AllenCahn.h:38
AllenCahn(const InputParameters &parameters)
Definition: AllenCahn.C:20
virtual void initialSetup()
Definition: ACBulk.h:83
const MaterialProperty< Real > & _dFdEta
Definition: AllenCahn.h:35
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition: ACBulk.h:22
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: AllenCahn.C:57
virtual Real computeDFDOP(PFFunctionType type)
Definition: AllenCahn.C:42
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACBulk.h:114
const MaterialProperty< Real > & _d2FdEta2
Definition: AllenCahn.h:36
const unsigned int _nvar
Definition: AllenCahn.h:34
virtual void initialSetup()
Definition: AllenCahn.C:34
InputParameters validParams< AllenCahn >()
Definition: AllenCahn.C:11
static InputParameters validParams()
Definition: ACBulk.h:72