www.mooseframework.org
KKSACBulkF.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "KKSACBulkF.h"
11 
12 registerMooseObject("PhaseFieldApp", KKSACBulkF);
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<KKSACBulkBase>();
19  params.addClassDescription("KKS model kernel (part 1 of 2) for the Bulk Allen-Cahn. This "
20  "includes all terms NOT dependent on chemical potential.");
21  params.addRequiredParam<Real>("w", "Double well height parameter");
22  params.addParam<MaterialPropertyName>(
23  "g_name", "g", "Base name for the double well function g(eta)");
24  params.addRequiredParam<MaterialPropertyName>(
25  "fb_name",
26  "Base name of the free energy function F (f_base in the corresponding KKSBaseMaterial)");
27  return params;
28 }
29 
30 KKSACBulkF::KKSACBulkF(const InputParameters & parameters)
31  : KKSACBulkBase(parameters),
32  _w(getParam<Real>("w")),
33  _prop_dg(getMaterialPropertyDerivative<Real>("g_name", _eta_name)),
34  _prop_d2g(getMaterialPropertyDerivative<Real>("g_name", _eta_name, _eta_name)),
35  _prop_Fb(getMaterialProperty<Real>("fb_name")),
36  _prop_dFb(getMaterialPropertyDerivative<Real>("fb_name", _eta_name))
37 {
38 }
39 
40 Real
41 KKSACBulkF::computeDFDOP(PFFunctionType type)
42 {
43  const Real A1 = _prop_Fa[_qp] - _prop_Fb[_qp];
44  switch (type)
45  {
46  case Residual:
47  return -_prop_dh[_qp] * A1 + _w * _prop_dg[_qp];
48 
49  case Jacobian:
50  return _phi[_j][_qp] * (-_prop_d2h[_qp] * A1 + _w * _prop_d2g[_qp]);
51  }
52 
53  mooseError("Invalid type passed in");
54 }
55 
56 Real
58 {
59  // get the coupled variable jvar is referring to
60  const unsigned int cvar = mapJvarToCvar(jvar);
61 
62  // first get dependence of mobility _L on other variables using parent class
63  // member function
65 
66  return res - _L[_qp] * _prop_dh[_qp] *
67  ((*_derivatives_Fa[cvar])[_qp] - (*_derivatives_Fb[cvar])[_qp]) * _phi[_j][_qp] *
68  _test[_i][_qp];
69 }
KKSACBulkF::_prop_dg
const MaterialProperty< Real > & _prop_dg
Derivative of the double well function .
Definition: KKSACBulkF.h:40
KKSACBulkBase::_prop_d2h
const MaterialProperty< Real > & _prop_d2h
Second derivative of the switching function .
Definition: KKSACBulkBase.h:56
KKSACBulkBase::_prop_Fa
const MaterialProperty< Real > & _prop_Fa
Value of the free energy function .
Definition: KKSACBulkBase.h:47
KKSACBulkF::computeDFDOP
virtual Real computeDFDOP(PFFunctionType type)
Definition: KKSACBulkF.C:41
KKSACBulkF::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: KKSACBulkF.C:57
ACBulk< Real >::Residual
Definition: ACBulk.h:40
KKSACBulkF::_prop_d2g
const MaterialProperty< Real > & _prop_d2g
Second derivative of the double well function .
Definition: KKSACBulkF.h:43
KKSACBulkBase::_prop_dh
const MaterialProperty< Real > & _prop_dh
Derivative of the switching function .
Definition: KKSACBulkBase.h:53
ACBulk::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACBulk.h:116
KKSACBulkF
KKSACBulkBase child class for the free energy difference term in the the Allen-Cahn bulk residual.
Definition: KKSACBulkF.h:27
KKSACBulkF::KKSACBulkF
KKSACBulkF(const InputParameters &parameters)
Definition: KKSACBulkF.C:30
KKSACBulkBase::_derivatives_Fb
std::vector< const MaterialProperty< Real > * > _derivatives_Fb
Derivatives of with respect to all coupled variables.
Definition: KKSACBulkBase.h:44
ACBulk< Real >::Jacobian
Definition: ACBulk.h:39
KKSACBulkF::_prop_Fb
const MaterialProperty< Real > & _prop_Fb
Value of the free energy function .
Definition: KKSACBulkF.h:46
KKSACBulkF::_w
Real _w
double well height parameter
Definition: KKSACBulkF.h:37
registerMooseObject
registerMooseObject("PhaseFieldApp", KKSACBulkF)
validParams< KKSACBulkF >
InputParameters validParams< KKSACBulkF >()
Definition: KKSACBulkF.C:16
KKSACBulkBase::_derivatives_Fa
std::vector< const MaterialProperty< Real > * > _derivatives_Fa
Derivatives of with respect to all coupled variables.
Definition: KKSACBulkBase.h:41
validParams< KKSACBulkBase >
InputParameters validParams< KKSACBulkBase >()
Definition: KKSACBulkBase.C:14
ACBulk< Real >::_L
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:46
KKSACBulkF.h
KKSACBulkBase
ACBulk child class that takes all the necessary data from a KKSBaseMaterial and sets up the Allen-Cah...
Definition: KKSACBulkBase.h:26