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 
16 {
18  params.addClassDescription("Allen-Cahn Kernel that uses a DerivativeMaterial Free Energy");
19  params.addRequiredParam<MaterialPropertyName>(
20  "f_name", "Base name of the free energy function F defined in a DerivativeParsedMaterial");
21  return params;
22 }
23 
25  : ACBulk<Real>(parameters),
26  _dFdEta(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
27  _d2FdEta2(getMaterialPropertyDerivative<Real>("f_name", _var.name(), _var.name())),
28  _d2FdEtadarg(_n_args)
29 {
30  // Iterate over all coupled variables
31  for (unsigned int i = 0; i < _n_args; ++i)
32  _d2FdEtadarg[i] = &getMaterialPropertyDerivative<Real>("f_name", _var.name(), i);
33 }
34 
35 void
37 {
39  validateNonlinearCoupling<Real>("f_name");
40  validateDerivativeMaterialPropertyBase<Real>("f_name");
41 }
42 
43 Real
45 {
46  switch (type)
47  {
48  case Residual:
49  return _dFdEta[_qp];
50 
51  case Jacobian:
52  return _d2FdEta2[_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] * (*_d2FdEtadarg[cvar])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
66 }
AllenCahn uses the Free Energy function and derivatives provided by a DerivativeParsedMaterial to com...
Definition: AllenCahn.h:19
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:46
static InputParameters validParams()
Definition: AllenCahn.C:15
std::vector< const MaterialProperty< Real > * > _d2FdEtadarg
Definition: AllenCahn.h:35
AllenCahn(const InputParameters &parameters)
Definition: AllenCahn.C:24
void mooseError(Args &&... args)
virtual void initialSetup()
Definition: ACBulk.h:79
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _dFdEta
Definition: AllenCahn.h:32
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition: ACBulk.h:24
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: AllenCahn.C:59
const std::string name
Definition: Setup.h:20
registerMooseObject("PhaseFieldApp", AllenCahn)
virtual Real computeDFDOP(PFFunctionType type)
Definition: AllenCahn.C:44
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACBulk.h:110
const MaterialProperty< Real > & _d2FdEta2
Definition: AllenCahn.h:33
void addClassDescription(const std::string &doc_string)
virtual void initialSetup()
Definition: AllenCahn.C:36
static InputParameters validParams()
Definition: ACBulk.h:69