https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CoupledAllenCahn.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 "CoupledAllenCahn.h"
11
13
16{
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
38void
40{
42 validateNonlinearCoupling<Real>("f_name");
43}
44
45Real
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
60Real
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}
registerMooseObject("PhaseFieldApp", CoupledAllenCahn)
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
CoupledAllenCahn uses the Free Energy function and derivatives provided by a DerivativeParsedMaterial...
virtual void initialSetup()
virtual Real computeDFDOP(PFFunctionType type)
std::vector< const MaterialProperty< Real > * > _d2FdVdarg
const MaterialProperty< Real > & _d2FdVdEta
const MaterialProperty< Real > & _dFdV
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
CoupledAllenCahn(const InputParameters &parameters)
VariableName _v_name
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)