https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SplitCHParsed.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 "SplitCHParsed.h"
11
13
16{
19 "Split formulation Cahn-Hilliard 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 params.addCoupledVar("coupled_variables", "Vector of additional variable arguments to F");
23
24 return params;
25}
26
29 _dFdc(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
30 _d2Fdc2(getMaterialPropertyDerivative<Real>("f_name", _var.name(), _var.name())),
31 _d2Fdcdarg(_n_args)
32{
33 // Iterate over all coupled variables
34 for (unsigned int i = 0; i < _n_args; ++i)
35 _d2Fdcdarg[i] = &getMaterialPropertyDerivative<Real>("f_name", _var.name(), i);
36}
37
38void
40{
46 validateNonlinearCoupling<Real>("f_name", _var.name());
47 validateDerivativeMaterialPropertyBase<Real>("f_name");
48}
49
50Real
51SplitCHParsed::computeDFDC(PFFunctionType type)
52{
53 switch (type)
54 {
55 case Residual:
56 return _dFdc[_qp];
57
58 case Jacobian:
59 return _d2Fdc2[_qp] * _phi[_j][_qp];
60 }
61
62 mooseError("Internal error");
63}
64
65Real
67{
68 if (jvar == _w_var)
70
71 // get the coupled variable jvar is referring to
72 const unsigned int cvar = mapJvarToCvar(jvar);
73
74 return (*_d2Fdcdarg[cvar])[_qp] * _phi[_j][_qp] * _test[_i][_qp];
75}
void mooseError(Args &&... args)
const std::string name
Definition Setup.h:21
registerMooseObject("PhaseFieldApp", SplitCHParsed)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
The couple, SplitCHCRes and SplitCHWRes, splits the CH equation by replacing chemical potential with ...
Definition SplitCHCRes.h:18
static InputParameters validParams()
Definition SplitCHCRes.C:13
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition SplitCHCRes.C:70
CHParsed uses the Free Energy function and derivatives provided by a DerivativeParsedMaterial.
virtual Real computeDFDC(PFFunctionType type)
static InputParameters validParams()
const MaterialProperty< Real > & _d2Fdc2
const MaterialProperty< Real > & _dFdc
virtual void initialSetup()
std::vector< const MaterialProperty< Real > * > _d2Fdcdarg
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
SplitCHParsed(const InputParameters &parameters)