16#ifndef TPPI_tools_included
17#define TPPI_tools_included
24static constexpr double EPS = 1.e-6;
26using MRange = std::map<std::string, std::array<double, 2>>;
27using MSpanD = std::map<std::string, tcb::span<double>>;
28using PairCharArray = std::array<const char*, 2>;
29using ArrayD = std::array<double,1>;
30using VectorD = std::vector<double>;
31using SpanD = tcb::span<double>;
34inline SpanD Tk_(
const SpanD& T)
36 for (
auto& itr : T) itr += 273.15;
41inline SpanD Tc_(
const SpanD& T)
43 for (
auto& itr : T) itr -= 273.15;
54 LAMBDA, LAMBDA_DP, LAMBDA_DT,
55 SIGMA, SIGMA_DP, SIGMA_DT,
59static constexpr std::array<PairCharArray, 19> EOS_prop_en_T =
62 {
"rho",
"rho" }, {
"drhodp",
"d_rho_d_p_T" }, {
"drhodT",
"d_rho_d_T_p" },
63 {
"enthalpie",
"h" }, {
"dhdp",
"d_h_d_p_T" }, {
"dhdT",
"d_h_d_T_p" },
64 {
"cp",
"cp" }, {
"dcpdp",
"d_cp_d_p_T" }, {
"dcpdT",
"d_cp_d_T_p" },
65 {
"mu",
"mu" }, {
"dmudp",
"d_mu_d_p_T" }, {
"dmudT",
"d_mu_d_T_p" },
66 {
"lambda",
"lambda" }, {
"dlambdadp",
"d_lambda_d_p_T" }, {
"dlambdadT",
"d_lambda_d_T_p" },
67 {
"sigma",
"sigma" }, {
"dsigmadp",
"d_sigma_d_p_T" }, {
"dsigmadT",
"d_sigma_d_T_p" },
78 LAMBDA, LAMBDA_DP, LAMBDA_DH,
79 SIGMA, SIGMA_DP, SIGMA_DH,
83static constexpr std::array<PairCharArray, 19> EOS_prop_en_h =
86 {
"rho",
"rho" }, {
"drhodp",
"d_rho_d_p_h" }, {
"drhodh",
"d_rho_d_h_p" },
87 {
"temperature",
"T" }, {
"dTdp",
"d_T_d_p_h" }, {
"dTdh",
"d_T_d_h_p" },
88 {
"cp",
"cp" }, {
"dcpdp",
"d_cp_d_p_h" }, {
"dcpdh",
"d_cp_d_h_p" },
89 {
"mu",
"mu" }, {
"dmudp",
"d_mu_d_p_h" }, {
"dmudh",
"d_mu_d_h_p" },
90 {
"lambda",
"lambda" }, {
"dlambdadp",
"d_lambda_d_p_h" }, {
"dlambdadh",
"d_lambda_d_h_p" },
91 {
"sigma",
"sigma" }, {
"dsigmadp",
"d_sigma_d_p_h" }, {
"dsigmadh",
"d_sigma_d_h_p" },
102 RHOL_SAT, RHOL_SAT_DP,
103 RHOV_SAT, RHOV_SAT_DP,
111static constexpr std::array<PairCharArray, 18> EOS_prop_sat =
114 {
"tsat",
"T_sat" }, {
"dtsatdp",
"d_T_sat_d_p" },
115 {
"psat",
"P_sat" }, {
"dpsatdt",
"d_P_sat_d_T" },
116 {
"hlsat",
"h_l_sat" }, {
"dhlsatdp",
"d_h_l_sat_d_p" },
117 {
"hvsat",
"h_v_sat" }, {
"dhvsatdp",
"d_h_v_sat_d_p" },
118 {
"rholsat",
"rho_l_sat" }, {
"drholsatdp",
"d_rho_l_sat_d_p" },
119 {
"rhovsat",
"rho_v_sat" }, {
"drhovsatdp",
"d_rho_v_sat_d_p" },
120 {
"cplsat",
"cp_l_sat" }, {
"dcplsatdp",
"d_cp_l_sat_d_p" },
121 {
"cpvsat",
"cp_v_sat" }, {
"dcpvsatdp",
"d_cp_v_sat_d_p" },
122 {
"sigma",
"sigma" }, {
"dsigmadp",
"d_sigma_d_p_h" }
126using MLoiSpanD_h = std::map<Loi_en_h, tcb::span<double>>;
127using MLoiSpanD_T = std::map<Loi_en_T, tcb::span<double>>;
128using MLoiSpanD = std::map<Loi_en_T, tcb::span<double>>;
129using MSatSpanD = std::map<SAT, tcb::span<double>>;