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