www.mooseframework.org
CoupledAllenCahn.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 "CoupledAllenCahn.h"
11 
12 registerMooseObject("PhaseFieldApp", CoupledAllenCahn);
13 
16 {
18  params.addClassDescription(
19  "Coupled Allen-Cahn Kernel that uses a DerivativeMaterial Free Energy");
20  params.addRequiredCoupledVar("v", "Coupled variable");
21  params.addRequiredParam<MaterialPropertyName>(
22  "f_name", "Base name of the free energy function F defined in a DerivativeParsedMaterial");
23  return params;
24 }
25 
27  : ACBulk<Real>(parameters),
28  _v_name(coupledName("v", 0)),
29  _dFdV(getMaterialPropertyDerivative<Real>("f_name", _v_name)),
30  _d2FdVdEta(getMaterialPropertyDerivative<Real>("f_name", _v_name, _var.name())),
31  _d2FdVdarg(_n_args)
32 {
33  // Iterate over all coupled variables
34  for (unsigned int i = 0; i < _n_args; ++i)
35  _d2FdVdarg[i] = &getMaterialPropertyDerivative<Real>("f_name", _v_name, i);
36 }
37 
38 void
40 {
42  validateNonlinearCoupling<Real>("f_name");
43 }
44 
45 Real
47 {
48  switch (type)
49  {
50  case Residual:
51  return _dFdV[_qp];
52 
53  case Jacobian:
54  return _d2FdVdEta[_qp] * _phi[_j][_qp];
55  }
56 
57  mooseError("Internal error");
58 }
59 
60 Real
62 {
63  // get the coupled variable jvar is referring to
64  const unsigned int cvar = mapJvarToCvar(jvar);
65 
67  _L[_qp] * (*_d2FdVdarg[cvar])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
68 }
CoupledAllenCahn(const InputParameters &parameters)
const MaterialProperty< Real > & _d2FdVdEta
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:46
virtual Real computeDFDOP(PFFunctionType type)
void mooseError(Args &&... args)
virtual void initialSetup()
Definition: ACBulk.h:79
registerMooseObject("PhaseFieldApp", CoupledAllenCahn)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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:24
const std::string name
Definition: Setup.h:20
static InputParameters validParams()
CoupledAllenCahn uses the Free Energy function and derivatives provided by a DerivativeParsedMaterial...
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
VariableName _v_name
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _dFdV
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACBulk.h:110
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Definition: ACBulk.h:69
virtual void initialSetup()
std::vector< const MaterialProperty< Real > * > _d2FdVdarg