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 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<Kernel>();
19  params.addClassDescription("KKS model kernel to enforce the decomposition of concentration into "
20  "phase concentration (1-h(eta))*ca + h(eta)*cb - c = 0. The "
21  "non-linear variable of this kernel is cb.");
22  params.addRequiredCoupledVar("ca", "Phase a concentration");
23  params.addRequiredCoupledVar("c", "Real concentration");
24  params.addRequiredCoupledVar("eta", "Phase a/b order parameter");
25  params.addParam<MaterialPropertyName>(
26  "h_name", "h", "Base name for the switching function h(eta)"); // TODO: everywhere else this
27  // is called just "h"
28  return params;
29 }
30 
31 // Phase interpolation func
32 KKSPhaseConcentration::KKSPhaseConcentration(const InputParameters & parameters)
33  : DerivativeMaterialInterface<Kernel>(parameters),
34  _ca(coupledValue("ca")),
35  _ca_var(coupled("ca")),
36  _c(coupledValue("c")),
37  _c_var(coupled("c")),
38  _eta(coupledValue("eta")),
39  _eta_var(coupled("eta")),
40  _prop_h(getMaterialProperty<Real>("h_name")),
41  _prop_dh(getMaterialPropertyDerivative<Real>("h_name", getVar("eta", 0)->name()))
42 {
43 }
44 
45 Real
47 {
48  // R = (1-h(eta))*ca + h(eta)*cb - c
49  return _test[_i][_qp] * ((1.0 - _prop_h[_qp]) * _ca[_qp] + _prop_h[_qp] * _u[_qp] - _c[_qp]);
50 }
51 
52 Real
54 {
55  return _test[_i][_qp] * _prop_h[_qp] * _phi[_j][_qp];
56 }
57 
58 Real
60 {
61  if (jvar == _ca_var)
62  return _test[_i][_qp] * (1.0 - _prop_h[_qp]) * _phi[_j][_qp];
63 
64  else if (jvar == _c_var)
65  return -_test[_i][_qp] * _phi[_j][_qp];
66 
67  else if (jvar == _eta_var)
68  return _test[_i][_qp] * (_u[_qp] - _ca[_qp]) * _prop_dh[_qp] * _phi[_j][_qp];
69 
70  return 0.0;
71 }
KKSPhaseConcentration::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: KKSPhaseConcentration.C:59
validParams< KKSPhaseConcentration >
InputParameters validParams< KKSPhaseConcentration >()
Definition: KKSPhaseConcentration.C:16
KKSPhaseConcentration::_c
const VariableValue & _c
Definition: KKSPhaseConcentration.h:48
KKSPhaseConcentration::computeQpResidual
virtual Real computeQpResidual()
Definition: KKSPhaseConcentration.C:46
KKSPhaseConcentration::computeQpJacobian
virtual Real computeQpJacobian()
Definition: KKSPhaseConcentration.C:53
registerMooseObject
registerMooseObject("PhaseFieldApp", KKSPhaseConcentration)
KKSPhaseConcentration::_prop_dh
const MaterialProperty< Real > & _prop_dh
Derivative of the switching function .
Definition: KKSPhaseConcentration.h:58
name
const std::string name
Definition: Setup.h:21
KKSPhaseConcentration::_eta_var
unsigned int _eta_var
Definition: KKSPhaseConcentration.h:52
KKSPhaseConcentration::KKSPhaseConcentration
KKSPhaseConcentration(const InputParameters &parameters)
Definition: KKSPhaseConcentration.C:32
KKSPhaseConcentration::_ca
const VariableValue & _ca
Definition: KKSPhaseConcentration.h:45
KKSPhaseConcentration::_ca_var
unsigned int _ca_var
Definition: KKSPhaseConcentration.h:46
KKSPhaseConcentration.h
KKSPhaseConcentration::_c_var
unsigned int _c_var
Definition: KKSPhaseConcentration.h:49
KKSPhaseConcentration
Enforce sum of phase concentrations to be the real concentration.
Definition: KKSPhaseConcentration.h:34
KKSPhaseConcentration::_prop_h
const MaterialProperty< Real > & _prop_h
Switching function .
Definition: KKSPhaseConcentration.h:55