www.mooseframework.org
KKSXeVacSolidMaterial.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<DerivativeFunctionMaterialBase>();
14  params.addClassDescription("KKS Solid phase free energy for Xe,Vac in UO2. Fm(cmg,cmv)");
15  params.addRequiredParam<Real>("T", "Temperature in [K]");
16  params.addRequiredCoupledVar("cmg", "Gas concnetration");
17  params.addRequiredCoupledVar("cmv", "Vacancy concnetration");
18  return params;
19 }
20 
21 KKSXeVacSolidMaterial::KKSXeVacSolidMaterial(const InputParameters & parameters)
22  : DerivativeFunctionMaterialBase(parameters),
23  _T(getParam<Real>("T")),
24  _Omega(2.53),
25  _kB(8.6173324e-5),
26  _Efv(3.0),
27  _Efg(3.0),
28  _cmg(coupledValue("cmg")),
29  _cmg_var(coupled("cmg")),
30  _cmv(coupledValue("cmv")),
31  _cmv_var(coupled("cmv"))
32 {
33 }
34 
35 // Catch fixable singularity at 0
36 Real
38 {
39  return c <= 0.0 ? 0.0 : c * std::log(c);
40 }
41 
42 // / Fm(cmg,cmv) takes three arguments
43 unsigned int
45 {
46  return 2;
47 }
48 
49 // Free energy value
50 Real
52 {
53  return 1.0 / _Omega * (_kB * _T * (cLogC(_cmv[_qp]) + cLogC(1.0 - _cmv[_qp])) + _Efv * _cmv[_qp] +
54  _kB * _T * (cLogC(_cmg[_qp]) + cLogC(1.0 - _cmg[_qp])) + _Efg * _cmg[_qp]);
55 }
56 
57 // Derivative of the Free energy
58 Real
60 {
61  const Real tol = 1e-10;
62  Real cmg = _cmg[_qp] < tol ? tol : (_cmg[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmg[_qp]);
63  Real cmv = _cmv[_qp] < tol ? tol : (_cmv[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmv[_qp]);
64 
65  if (i_var == _cmg_var)
66  return 1.0 / _Omega * (_Efg + _kB * _T * (std::log(cmg) - std::log(-cmg + 1.0)));
67 
68  if (i_var == _cmv_var)
69  return 1.0 / _Omega * (_Efv + _kB * _T * (std::log(cmv) - std::log(-cmv + 1.0)));
70 
71  mooseError("Unknown derivative requested");
72 }
73 
74 // Derivative of the Free energy
75 Real
76 KKSXeVacSolidMaterial::computeD2F(unsigned int i_var, unsigned int j_var)
77 {
78  if (i_var != j_var)
79  return 0.0;
80 
81  const Real tol = 1e-10;
82  Real cmg = _cmg[_qp] < tol ? tol : (_cmg[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmg[_qp]);
83  Real cmv = _cmv[_qp] < tol ? tol : (_cmv[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmv[_qp]);
84 
85  if (i_var == _cmg_var)
86  return 1.0 / _Omega * _kB * _T * (1.0 / (1.0 - cmg) + 1.0 / cmg);
87 
88  if (i_var == _cmv_var)
89  return 1.0 / _Omega * _kB * _T * (1.0 / (1.0 - cmv) + 1.0 / cmv);
90 
91  mooseError("Unknown derivative requested");
92 }
93 
94 // note that the second cross derivatives are actually 0.0!
95 
96 // Third derivative: 1.0/Omega * kB*T*((-c^m_v + 1.0)**(-2) - 1/c^m_v**2)
virtual Real computeD2F(unsigned int arg1, unsigned int arg2)
Override this method to calculate the second derivatives.
virtual Real computeF()
Override this method to provide the free energy function.
const Real _Omega
Atomic volume in [Ang^3].
const Real _Efg
Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe) ...
const Real _Efv
Formation energy of a tri-vacancy in UO2.
const Real _T
Temperature in [K].
InputParameters validParams< DerivativeFunctionMaterialBase >()
virtual unsigned int expectedNumArgs()
const VariableValue & _cmg
KKSXeVacSolidMaterial(const InputParameters &parameters)
Material base class central to compute the a phase free energy and its derivatives.
InputParameters validParams< KKSXeVacSolidMaterial >()
static const double tol
Definition: XFEMFuncs.h:26
const VariableValue & _cmv
virtual Real computeDF(unsigned int arg)
Override this method for calculating the first derivatives.
const Real _kB
Bolzmann constant.