https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KKSACBulkC.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 "KKSACBulkC.h"
11
13
16{
18 params.addClassDescription("KKS model kernel (part 2 of 2) for the Bulk Allen-Cahn. This "
19 "includes all terms dependent on chemical potential.");
20 params.addRequiredCoupledVar("ca", "a-phase concentration");
21 params.addRequiredCoupledVar("cb", "b-phase concentration");
22 return params;
23}
24
26 : KKSACBulkBase(parameters),
27 _ca_name(coupledName("ca", 0)),
28 _ca_var(coupled("ca")),
29 _ca(coupledValue("ca")),
30 _cb_name(coupledName("cb", 0)),
31 _cb_var(coupled("cb")),
32 _cb(coupledValue("cb")),
33 _prop_dFadca(getMaterialPropertyDerivative<Real>("fa_name", _ca_name)),
34 _prop_d2Fadca2(getMaterialPropertyDerivative<Real>("fa_name", _ca_name, _ca_name)),
35 _prop_d2Fadcadarg(_n_args)
36{
37 // get second partial derivatives wrt ca and other coupled variable
38 for (unsigned int i = 0; i < _n_args; ++i)
39 _prop_d2Fadcadarg[i] = &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, i);
40}
41
42Real
44{
45 const Real A1 = _prop_dFadca[_qp] * (_ca[_qp] - _cb[_qp]);
46 switch (type)
47 {
48 case Residual:
49 return _prop_dh[_qp] * A1;
50
51 case Jacobian:
52 return _phi[_j][_qp] * _prop_d2h[_qp] * A1;
53 }
54
55 mooseError("Invalid type passed in");
56}
57
58Real
60{
61 // first get dependence of mobility _L on other variables using parent class
62 // member function
64
65 // Then add dependence of KKSACBulkF on other variables
66 // Treat ca and cb specially, as they appear in the residual
67 if (jvar == _ca_var)
68 return res + _L[_qp] * _prop_dh[_qp] *
69 ((_ca[_qp] - _cb[_qp]) * _prop_d2Fadca2[_qp] + _prop_dFadca[_qp]) *
70 _phi[_j][_qp] * _test[_i][_qp];
71
72 if (jvar == _cb_var)
73 return res - _L[_qp] * _prop_dh[_qp] * _prop_dFadca[_qp] * _phi[_j][_qp] * _test[_i][_qp];
74
75 // for all other vars get the coupled variable jvar is referring to
76 const unsigned int cvar = mapJvarToCvar(jvar);
77
78 res += _L[_qp] * _prop_dh[_qp] * (*_prop_d2Fadcadarg[cvar])[_qp] * (_ca[_qp] - _cb[_qp]) *
79 _phi[_j][_qp] * _test[_i][_qp];
80
81 return res;
82}
registerMooseObject("PhaseFieldApp", KKSACBulkC)
void mooseError(Args &&... args)
const MaterialProperty< Real > & _L
Mobility.
Definition ACBulk.h:46
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition ACBulk.h:110
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
ACBulk child class that takes all the necessary data from a KKSBaseMaterial and sets up the Allen-Cah...
const MaterialProperty< Real > & _prop_d2h
Second derivative of the switching function .
const MaterialProperty< Real > & _prop_dh
Derivative of the switching function .
static InputParameters validParams()
KKSACBulkBase child class for the phase concentration difference term in the the Allen-Cahn bulk res...
Definition KKSACBulkC.h:24
const VariableValue & _cb
Definition KKSACBulkC.h:42
const MaterialProperty< Real > & _prop_d2Fadca2
Second derivative of the free energy function .
Definition KKSACBulkC.h:48
const VariableValue & _ca
Definition KKSACBulkC.h:37
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition KKSACBulkC.C:59
static InputParameters validParams()
Definition KKSACBulkC.C:15
std::string _ca_name
phase a concentration
Definition KKSACBulkC.h:35
KKSACBulkC(const InputParameters &parameters)
Definition KKSACBulkC.C:25
unsigned int _ca_var
Definition KKSACBulkC.h:36
std::vector< const MaterialProperty< Real > * > _prop_d2Fadcadarg
Mixed partial derivatives of the free energy function wrt ca and any other coupled variables .
Definition KKSACBulkC.h:52
unsigned int _cb_var
Definition KKSACBulkC.h:41
const MaterialProperty< Real > & _prop_dFadca
Derivative of the free energy function .
Definition KKSACBulkC.h:45
virtual Real computeDFDOP(PFFunctionType type)
Definition KKSACBulkC.C:43