https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KKSSplitCHCRes.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 "KKSSplitCHCRes.h"
11
13
16{
19 "KKS model kernel for the split Bulk Cahn-Hilliard term. This kernel operates on the "
20 "physical concentration 'c' as the non-linear variable");
21 params.addRequiredParam<MaterialPropertyName>(
22 "fa_name",
23 "Base name of an arbitrary phase free energy function F (f_base in the corresponding "
24 "KKSBaseMaterial)");
26 "ca", "phase concentration corresponding to the non-linear variable of this kernel");
27 params.addCoupledVar("args_a", "Vector of additional arguments to Fa");
28 params.addRequiredCoupledVar("w",
29 "Chemical potential non-linear helper variable for the split solve");
30 return params;
31}
32
35 _ca_var(coupled("ca")),
36 _ca_name(coupledName("ca", 0)),
37 _dFadca(getMaterialPropertyDerivative<Real>("fa_name", _ca_name)),
38 _d2Fadcadarg(_n_args),
39 _w_var(coupled("w")),
40 _w(coupledValue("w"))
41{
42 // get the second derivative material property
43 for (unsigned int i = 0; i < _n_args; ++i)
44 _d2Fadcadarg[i] = &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, i);
45}
46
47void
49{
50 validateNonlinearCoupling<Real>("fa_name");
51 validateDerivativeMaterialPropertyBase<Real>("fa_name");
52}
53
54Real
56{
57 Real residual = SplitCHBase::computeQpResidual();
58 residual += -_w[_qp] * _test[_i][_qp];
59
60 return residual;
61}
62
70Real
71KKSSplitCHCRes::computeDFDC(PFFunctionType type)
72{
73 switch (type)
74 {
75 case Residual:
76 return _dFadca[_qp]; // dFa/dca ( = dFb/dcb = dF/dc)
77
78 case Jacobian:
79 return 0.0;
80 }
81
82 mooseError("Invalid type passed in");
83}
84
85Real
87{
88 // treat w variable explicitly
89 if (jvar == _w_var)
90 return -_phi[_j][_qp] * _test[_i][_qp];
91
92 // get the coupled variable jvar is referring to
93 const unsigned int cvar = mapJvarToCvar(jvar);
94 return _phi[_j][_qp] * _test[_i][_qp] * (*_d2Fadcadarg[cvar])[_qp];
95}
registerMooseObject("PhaseFieldApp", KKSSplitCHCRes)
void mooseError(Args &&... args)
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)
void addCoupledVar(const std::string &name, const std::string &doc_string)
SplitCHBulk child class that takes all the necessary data from a KKSBaseMaterial.
KKSSplitCHCRes(const InputParameters &parameters)
virtual void initialSetup()
unsigned int _w_var
Chemical potential.
static InputParameters validParams()
const MaterialProperty< Real > & _dFadca
chemical potential
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
virtual Real computeDFDC(PFFunctionType type)
Note that per product and chain rules: which is: .
const VariableValue & _w
virtual Real computeQpResidual()
std::vector< const MaterialProperty< Real > * > _d2Fadcadarg
Second derivatives of fa with respect to all ca and coupled variables.
VariableName _ca_name
The couple, SplitCHBase and SplitCHWRes, splits the CH equation by replacing chemical potential with ...
Definition SplitCHBase.h:18
static InputParameters validParams()
Definition SplitCHBase.C:13
virtual Real computeQpResidual()
Definition SplitCHBase.C:39