www.mooseframework.org
KKSPhaseConcentration.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addClassDescription("KKS model kernel to enforce the decomposition of concentration into "
15  "phase concentration (1-h(eta))*ca + h(eta)*cb - c = 0. The "
16  "non-linear variable of this kernel is cb.");
17  params.addRequiredCoupledVar("ca", "Phase a concentration");
18  params.addRequiredCoupledVar("c", "Real concentration");
19  params.addRequiredCoupledVar("eta", "Phase a/b order parameter");
20  params.addParam<MaterialPropertyName>(
21  "h_name", "h", "Base name for the switching function h(eta)"); // TODO: everywhere else this
22  // is called just "h"
23  return params;
24 }
25 
26 // Phase interpolation func
27 KKSPhaseConcentration::KKSPhaseConcentration(const InputParameters & parameters)
28  : DerivativeMaterialInterface<Kernel>(parameters),
29  _ca(coupledValue("ca")),
30  _ca_var(coupled("ca")),
31  _c(coupledValue("c")),
32  _c_var(coupled("c")),
33  _eta(coupledValue("eta")),
34  _eta_var(coupled("eta")),
35  _prop_h(getMaterialProperty<Real>("h_name")),
36  _prop_dh(getMaterialPropertyDerivative<Real>("h_name", getVar("eta", 0)->name()))
37 {
38 }
39 
40 Real
42 {
43  // R = (1-h(eta))*ca + h(eta)*cb - c
44  return _test[_i][_qp] * ((1.0 - _prop_h[_qp]) * _ca[_qp] + _prop_h[_qp] * _u[_qp] - _c[_qp]);
45 }
46 
47 Real
49 {
50  return _test[_i][_qp] * _prop_h[_qp] * _phi[_j][_qp];
51 }
52 
53 Real
55 {
56  if (jvar == _ca_var)
57  return _test[_i][_qp] * (1.0 - _prop_h[_qp]) * _phi[_j][_qp];
58 
59  else if (jvar == _c_var)
60  return -_test[_i][_qp] * _phi[_j][_qp];
61 
62  else if (jvar == _eta_var)
63  return _test[_i][_qp] * (_u[_qp] - _ca[_qp]) * _prop_dh[_qp] * _phi[_j][_qp];
64 
65  return 0.0;
66 }
InputParameters validParams< KKSPhaseConcentration >()
const VariableValue & _c
const VariableValue & _ca
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
const MaterialProperty< Real > & _prop_dh
Derivative of the switching function .
const MaterialProperty< Real > & _prop_h
Switching function .
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
KKSPhaseConcentration(const InputParameters &parameters)