www.mooseframework.org
KKSPhaseConcentration.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 "KKSPhaseConcentration.h"
11 
13 
16 {
18  params.addClassDescription("KKS model kernel to enforce the decomposition of concentration into "
19  "phase concentration $(1-h(\\eta))c_a + h(\\eta)c_b - c = 0$. The "
20  "non-linear variable of this kernel is $c_b$.");
21  params.addRequiredCoupledVar("ca", "Phase a concentration");
22  params.addRequiredCoupledVar("c", "Real concentration");
23  params.addRequiredCoupledVar("eta", "Phase a/b order parameter");
24  params.addParam<MaterialPropertyName>(
25  "h_name", "h", "Base name for the switching function h(eta)");
26  return params;
27 }
28 
29 // Phase interpolation func
31  : DerivativeMaterialInterface<Kernel>(parameters),
32  _ca(coupledValue("ca")),
33  _ca_var(coupled("ca")),
34  _c(coupledValue("c")),
35  _c_var(coupled("c")),
36  _eta(coupledValue("eta")),
37  _eta_var(coupled("eta")),
38  _prop_h(getMaterialProperty<Real>("h_name")),
39  _prop_dh(getMaterialPropertyDerivative<Real>("h_name", coupledName("eta", 0)))
40 {
41 }
42 
43 Real
45 {
46  // R = (1-h(eta))*ca + h(eta)*cb - c
47  return _test[_i][_qp] * ((1.0 - _prop_h[_qp]) * _ca[_qp] + _prop_h[_qp] * _u[_qp] - _c[_qp]);
48 }
49 
50 Real
52 {
53  return _test[_i][_qp] * _prop_h[_qp] * _phi[_j][_qp];
54 }
55 
56 Real
58 {
59  if (jvar == _ca_var)
60  return _test[_i][_qp] * (1.0 - _prop_h[_qp]) * _phi[_j][_qp];
61 
62  else if (jvar == _c_var)
63  return -_test[_i][_qp] * _phi[_j][_qp];
64 
65  else if (jvar == _eta_var)
66  return _test[_i][_qp] * (_u[_qp] - _ca[_qp]) * _prop_dh[_qp] * _phi[_j][_qp];
67 
68  return 0.0;
69 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariableValue & _c
static InputParameters validParams()
const VariableValue & _ca
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _prop_dh
Derivative of the switching function .
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _prop_h
Switching function .
void addClassDescription(const std::string &doc_string)
registerMooseObject("PhaseFieldApp", KKSPhaseConcentration)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
KKSPhaseConcentration(const InputParameters &parameters)
Enforce sum of phase concentrations to be the real concentration.