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