https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KKSXeVacSolidMaterial.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
11
13
16{
18 params.addClassDescription("KKS Solid phase free energy for Xe,Vac in UO2. Fm(cmg,cmv)");
19 params.addRequiredParam<Real>("T", "Temperature in [K]");
20 params.addRequiredCoupledVar("cmg", "Gas concentration");
21 params.addRequiredCoupledVar("cmv", "Vacancy concentration");
22 return params;
23}
24
27 _T(getParam<Real>("T")),
28 _Omega(2.53),
29 _kB(8.6173324e-5),
30 _Efv(3.0),
31 _Efg(3.0),
32 _cmg(coupledValue("cmg")),
33 _cmg_var(coupled("cmg")),
34 _cmv(coupledValue("cmv")),
35 _cmv_var(coupled("cmv"))
36{
37}
38
39// Catch fixable singularity at 0
40Real
42{
43 return c <= 0.0 ? 0.0 : c * std::log(c);
44}
45
46// / Fm(cmg,cmv) takes three arguments
47unsigned int
52
53// Free energy value
54Real
56{
57 return 1.0 / _Omega *
58 (_kB * _T * (cLogC(_cmv[_qp]) + cLogC(1.0 - _cmv[_qp])) + _Efv * _cmv[_qp] +
59 _kB * _T * (cLogC(_cmg[_qp]) + cLogC(1.0 - _cmg[_qp])) + _Efg * _cmg[_qp]);
60}
61
62// Derivative of the Free energy
63Real
65{
66 const Real tol = 1e-10;
67 Real cmg = _cmg[_qp] < tol ? tol : (_cmg[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmg[_qp]);
68 Real cmv = _cmv[_qp] < tol ? tol : (_cmv[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmv[_qp]);
69
70 if (i_var == _cmg_var)
71 return 1.0 / _Omega * (_Efg + _kB * _T * (std::log(cmg) - std::log(-cmg + 1.0)));
72
73 if (i_var == _cmv_var)
74 return 1.0 / _Omega * (_Efv + _kB * _T * (std::log(cmv) - std::log(-cmv + 1.0)));
75
76 mooseError("Unknown derivative requested");
77}
78
79// Derivative of the Free energy
80Real
81KKSXeVacSolidMaterial::computeD2F(unsigned int i_var, unsigned int j_var)
82{
83 if (i_var != j_var)
84 return 0.0;
85
86 const Real tol = 1e-10;
87 Real cmg = _cmg[_qp] < tol ? tol : (_cmg[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmg[_qp]);
88 Real cmv = _cmv[_qp] < tol ? tol : (_cmv[_qp] > (1.0 - tol) ? (1.0 - tol) : _cmv[_qp]);
89
90 if (i_var == _cmg_var)
91 return 1.0 / _Omega * _kB * _T * (1.0 / (1.0 - cmg) + 1.0 / cmg);
92
93 if (i_var == _cmv_var)
94 return 1.0 / _Omega * _kB * _T * (1.0 / (1.0 - cmv) + 1.0 / cmv);
95
96 mooseError("Unknown derivative requested");
97}
98
99// note that the second cross derivatives are actually 0.0!
100
101// Third derivative: 1.0/Omega * kB*T*((-c^m_v + 1.0)**(-2) - 1/c^m_v**2)
const double tol
registerMooseObject("PhaseFieldApp", KKSXeVacSolidMaterial)
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
virtual Real computeDF(unsigned int arg)
virtual Real computeD2F(unsigned int arg1, unsigned int arg2)
virtual unsigned int expectedNumArgs()
const VariableValue & _cmv
const Real _Omega
Atomic volume in [Ang^3].
const Real _T
Temperature in [K].
const Real _Efg
Formation energy of a Xenon Atom in a tri-vacancy (TODO: if cmg>cmv consider interstitial Xe)
const Real _kB
Bolzmann constant.
const VariableValue & _cmg
const Real _Efv
Formation energy of a tri-vacancy in UO2.
static InputParameters validParams()
KKSXeVacSolidMaterial(const InputParameters &parameters)
void mooseError(Args &&... args) const