3#include "nlohmann/json.hpp"
17 double acentric_reference, Z_crit_reference, T_crit_reference, rhomolar_crit_reference;
18 multifluid_t reference_model;
19 double acentric_fluid, Z_crit_fluid, T_crit_fluid, rhomolar_crit_fluid;
20 std::vector<double> f_T_coeffs, h_T_coeffs;
24 const auto& ref = j.at(
"reference_fluid");
25 acentric_reference = ref.at(
"acentric");
26 Z_crit_reference = ref.at(
"Z_crit");
27 T_crit_reference = ref.at(
"T_crit / K");
28 rhomolar_crit_reference = ref.at(
"rhomolar_crit / mol/m^3");
30 const auto& fl = j.at(
"fluid");
31 acentric_fluid = fl.at(
"acentric");
32 Z_crit_fluid = fl.at(
"Z_crit");
33 T_crit_fluid = fl.at(
"T_crit / K");
34 rhomolar_crit_fluid = fl.at(
"rhomolar_crit / mol/m^3");
35 f_T_coeffs = fl.at(
"f_T_coeffs").get<std::vector<double>>();
36 h_T_coeffs = fl.at(
"h_T_coeffs").get<std::vector<double>>();
39 template<
class VecType>
40 auto R(
const VecType& molefrac)
const {
44 template<
typename TTYPE,
typename RhoType,
typename VecType>
45 auto alphar(
const TTYPE& T,
const RhoType& rhomolar,
const VecType& mole_fractions)
const {
47 auto Tri = T/T_crit_fluid;
50 auto theta = 1.0 + (acentric_fluid-acentric_reference)*(f_T_coeffs[0] + f_T_coeffs[1]*log(Tri));
51 auto phi = Z_crit_reference/Z_crit_fluid*(1.0 + (acentric_fluid - acentric_reference)*(h_T_coeffs[0] + h_T_coeffs[1]*log(Tri)));
53 auto f = T_crit_fluid/T_crit_reference*theta;
54 auto h = rhomolar_crit_reference/rhomolar_crit_fluid*phi;
58 auto rho_effective =
forceeval(rhomolar*h);
60 return reference_model.alphar(T_effective, rho_effective, mole_fractions);
ECSHuberEly1994(const nlohmann::json &j)
auto R(const VecType &molefrac) const
auto alphar(const TTYPE &T, const RhoType &rhomolar, const VecType &mole_fractions) const
auto multifluidfactory(const nlohmann::json &spec)
Load a model from a JSON data structure.
auto build_multifluid_model(const std::vector< std::string > &components, const std::string &root, const std::string &BIPcollectionpath={}, const nlohmann::json &flags={}, const std::string &departurepath={})
auto get_R_gas()
< Gas constant, according to CODATA 2019, in the given number type