https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
13registerMooseObject("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:
52 break;
53
60 break;
61
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
78Real
79HenryGasConstant::henry(Real temperature) const
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}
registerMooseObject("ChemicalReactionsApp", HenryGasConstant)
static InputParameters validParams()
This UserObject performs a calculation of the Henry coefficient for noble gases using the model by K.
static constexpr Real _KH0_FLiBe
static constexpr Real _dgamma_dT_FLiNaK
HenryGasConstant(const InputParameters &parameters)
static InputParameters validParams()
static constexpr Real _Rgas
Universal gas constant [J/mol/K].
static constexpr Real _gamma_0_FLiBe
Saltlist
Enum used to select the salt type.
static constexpr Real _alpha_FLiBe
Model constants obtained from K.
enum HenryGasConstant::Saltlist _salt_list
virtual Real henry(Real temperature) const
Returns the henry constant at the specified temperature.
static constexpr Real _alpha_FLiNaK
Model constants for FLiNaK.
static constexpr Real _KH0_FLiNaK
static constexpr Real _beta_FLiBe
static constexpr Real _beta_FLiNaK
static constexpr Real _dgamma_dT_FLiBe
const Real _radius
van der Waals radius
static constexpr Real _gamma_0_FLiNaK
Real _alpha
Fit coefficients for the model.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
const Real pi