teqp
0.23.1
Toggle main menu visibility
Loading...
Searching...
No Matches
include
teqp
models
ECSHuberEly.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "nlohmann/json.hpp"
4
5
#include "
teqp/models/multifluid.hpp
"
6
7
namespace
teqp
{
8
namespace
ECSHuberEly
{
9
13
class
ECSHuberEly1994
{
14
private
:
15
using
multifluid_t =
decltype
(
multifluidfactory
(nlohmann::json{}));
16
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;
21
22
public
:
23
ECSHuberEly1994
(
const
nlohmann::json& j): reference_model(
build_multifluid_model
({j.at(
"reference_fluid"
).at(
"name"
)},
""
)) {
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"
);
29
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>>();
37
}
38
39
template
<
class
VecType>
40
auto
R
(
const
VecType& molefrac)
const
{
41
return
get_R_gas<decltype(molefrac[0])>
();
42
}
43
44
template
<
typename
TTYPE,
typename
RhoType,
typename
VecType>
45
auto
alphar
(
const
TTYPE& T,
const
RhoType& rhomolar,
const
VecType& mole_fractions)
const
{
46
47
auto
Tri = T/T_crit_fluid;
48
49
// These are the basic definitions from Huber and Ely
50
auto
theta = 1.0 + (acentric_fluid-acentric_reference)*(f_T_coeffs[0] + f_T_coeffs[1]*log(Tri));
// Eq. 30
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)));
// Eq. 31
52
53
auto
f = T_crit_fluid/T_crit_reference*theta;
54
auto
h = rhomolar_crit_reference/rhomolar_crit_fluid*phi;
55
56
// Calculate the effective temperature and density (sometimes called conformal temperature and conformal density)
57
auto
T_effective =
forceeval
(T/f);
58
auto
rho_effective =
forceeval
(rhomolar*h);
59
60
return
reference_model.alphar(T_effective, rho_effective, mole_fractions);
61
}
62
};
63
64
65
}
66
}
teqp::ECSHuberEly::ECSHuberEly1994::ECSHuberEly1994
ECSHuberEly1994(const nlohmann::json &j)
Definition
ECSHuberEly.hpp:23
teqp::ECSHuberEly::ECSHuberEly1994::R
auto R(const VecType &molefrac) const
Definition
ECSHuberEly.hpp:40
teqp::ECSHuberEly::ECSHuberEly1994::alphar
auto alphar(const TTYPE &T, const RhoType &rhomolar, const VecType &mole_fractions) const
Definition
ECSHuberEly.hpp:45
multifluid.hpp
teqp::ECSHuberEly
Definition
ECSHuberEly.hpp:8
teqp
Definition
ancillary_builder.hpp:8
teqp::multifluidfactory
auto multifluidfactory(const nlohmann::json &spec)
Load a model from a JSON data structure.
Definition
multifluid.hpp:1095
teqp::build_multifluid_model
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={})
Definition
multifluid.hpp:1073
teqp::forceeval
auto forceeval(T &&expr)
Definition
types.hpp:52
teqp::get_R_gas
auto get_R_gas()
< Gas constant, according to CODATA 2019, in the given number type
Definition
constants.hpp:22
Generated by
1.17.0