https://mooseframework.inl.gov
HenryGasConstant.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 
10 #include "HenryGasConstant.h"
11 #include "MathUtils.h"
12 
13 registerMooseObject("ChemicalReactionsApp", HenryGasConstant);
14 
17 {
19  params.addRequiredParam<Real>("radius", "Van der Waals radius [m]");
20  MooseEnum salt_list("FLIBE FLINAK CUSTOM");
21  params.addRequiredParam<MooseEnum>("salt", salt_list, "Salt");
22  params.addParam<Real>("alpha", "alpha fit parameter in Henry model, if defining custom fluid");
23  params.addParam<Real>("beta", "beta fit parameter in Henry model, if defining custom fluid");
24  params.addParam<Real>("gamma_0",
25  "gamma_0 fit parameter in Henry model, if defining custom fluidl");
26  params.addParam<Real>("dgamma_dT",
27  "gamma derivative fit parameter in Henry model, if defining custom fluid");
28  params.addParam<Real>(
29  "KH0", "Reference Henry parameter in Henry model, if defining custom fluid [mol/m3/Pa]");
30  params.addClassDescription("Calculates Henry gas constant of a noble gas `[mol/m3/Pa]`");
31  return params;
32 }
33 
35  : GeneralUserObject(parameters),
36  _radius(getParam<Real>("radius")),
37  _salt_list(getParam<MooseEnum>("salt").getEnum<Saltlist>()),
38  _alpha(isParamSetByUser("alpha") ? getParam<Real>("alpha") : 0.0),
39  _beta(isParamSetByUser("beta") ? getParam<Real>("beta") : 0.0),
40  _gamma_0(isParamSetByUser("gamma_0") ? getParam<Real>("gamma_0") : 0.0),
41  _dgamma_dT(isParamSetByUser("dgamma_dT") ? getParam<Real>("dgamma_dT") : 0.0),
42  _KH0(isParamSetByUser("KH0") ? getParam<Real>("KH0") : 0.0)
43 {
44  switch (_salt_list)
45  {
46  case Saltlist::FLIBE:
49  _KH0 = _KH0_FLiBe;
52  break;
53 
54  case Saltlist::FLINAK:
57  _KH0 = _KH0_FLiNaK;
60  break;
61 
62  case Saltlist::CUSTOM:
63  // Ensure that all parameters were set by user
64  if (!isParamSetByUser("alpha"))
65  mooseError("Must include alpha parameter when using custom salt Henry gas model");
66  if (!isParamSetByUser("beta"))
67  mooseError("Must include beta parameter when using custom salt Henry gas model");
68  if (!isParamSetByUser("gamma_0"))
69  mooseError("Must include gamma_0 parameter when using custom salt Henry gas model");
70  if (!isParamSetByUser("dgamma_dT"))
71  mooseError("Must include dgamma_dT parameter when using custom salt Henry gas model");
72  if (!isParamSetByUser("KH0"))
73  mooseError("Must include KH0 parameter when using custom salt Henry gas model");
74  break;
75  }
76 }
77 
78 Real
80 {
81 
82  const Real m_to_ang = 1e10;
83 
84  // Equations result in units of mol/cm^3/atm, so convert to mol/m^3/atm
85  Real value =
86  _alpha * 4. * libMesh::pi * Utility::pow<2>(_radius * m_to_ang) *
87  (_gamma_0 + _dgamma_dT * (temperature - 273.15)) +
88  _beta * 4. / 3. * libMesh::pi * std::pow(_radius * m_to_ang, 3) * _Rgas * temperature;
89  value = exp(value / (_Rgas * temperature)) * _KH0;
90  return value;
91 }
const Real _radius
van der Waals radius
HenryGasConstant(const InputParameters &parameters)
static InputParameters validParams()
auto exp(const T &)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static constexpr Real _dgamma_dT_FLiNaK
static constexpr Real _beta_FLiNaK
static constexpr Real _gamma_0_FLiBe
static const std::string temperature
Definition: NS.h:60
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
enum HenryGasConstant::Saltlist _salt_list
registerMooseObject("ChemicalReactionsApp", HenryGasConstant)
static constexpr Real _gamma_0_FLiNaK
virtual Real henry(Real temperature) const
Returns the henry constant at the specified temperature.
static constexpr Real _alpha_FLiNaK
Model constants for FLiNaK.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static constexpr Real _alpha_FLiBe
Model constants obtained from K.
static constexpr Real _beta_FLiBe
Real _alpha
Fit coefficients for the model.
static constexpr Real _KH0_FLiNaK
This UserObject performs a calculation of the Henry coefficient for noble gases using the model by K...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Saltlist
Enum used to select the salt type.
void mooseError(Args &&... args) const
static constexpr Real _Rgas
Universal gas constant [J/mol/K].
void addClassDescription(const std::string &doc_string)
static constexpr Real _dgamma_dT_FLiBe
bool isParamSetByUser(const std::string &name) const
MooseUnits pow(const MooseUnits &, int)
static constexpr Real _KH0_FLiBe
const Real pi