https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AllenCahn.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
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
35void
37{
39 validateNonlinearCoupling<Real>("f_name");
40 validateDerivativeMaterialPropertyBase<Real>("f_name");
41}
42
43Real
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
58Real
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}
registerMooseObject("PhaseFieldApp", AllenCahn)
void mooseError(Args &&... args)
const std::string name
Definition Setup.h:21
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition ACBulk.h:25
const MaterialProperty< Real > & _L
Mobility.
Definition ACBulk.h:46
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACBulk.h:110
virtual void initialSetup()
Definition ACBulk.h:79
static InputParameters validParams()
Definition ACBulk.h:69
AllenCahn uses the Free Energy function and derivatives provided by a DerivativeParsedMaterial to com...
Definition AllenCahn.h:20
static InputParameters validParams()
Definition AllenCahn.C:15
const MaterialProperty< Real > & _dFdEta
Definition AllenCahn.h:32
virtual Real computeDFDOP(PFFunctionType type)
Definition AllenCahn.C:44
std::vector< const MaterialProperty< Real > * > _d2FdEtadarg
Definition AllenCahn.h:35
virtual void initialSetup()
Definition AllenCahn.C:36
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition AllenCahn.C:59
AllenCahn(const InputParameters &parameters)
Definition AllenCahn.C:24
const MaterialProperty< Real > & _d2FdEta2
Definition AllenCahn.h:33
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)