1 #ifndef ThermoFun_GLOBAL_H 2 #define ThermoFun_GLOBAL_H 3 4 #include <map> 5 #include <string> 6 #include <vector> 7 #include <iostream> 8 #include <cmath> 9 #include <fstream> 10 11 #pragma GCC diagnostic ignored "-Wswitch" 12 #pragma GCC diagnostic ignored "-Wsign-compare" 13 #pragma GCC diagnostic ignored "-Wunused-variable" 14 15 #define OutputSTEAM_CONVENTION 16 17 using namespace std; 18 19 ///@cond INTERNAL 20 21 namespace ThermoFun { 22 23 typedef std::vector<double> vd; 24 typedef std::vector<std::vector<double> > vvd; 25 26 static const double R_CONSTANT = 8.31451, 27 NA_CONSTANT = 6.0221367e23, 28 F_CONSTANT = 96485.309, 29 e_CONSTANT = 1.60217733e-19, 30 k_CONSTANT = 1.380658e-23, 31 // Conversion factors 32 cal_to_J = 4.184, 33 C_to_K = 273.15, 34 K_to_C =-273.15, 35 lg_to_ln = 2.302585093, 36 ln_to_lg = 0.434294481, 37 H2O_mol_to_kg = 55.50837344, 38 Min_phys_amount = 1.66e-24, 39 cm3_mol_to_J_bar = 0.1, 40 bar_to_Pa = 1e05, 41 42 TEMPER_PREC = 0.5, 43 PRESSURE_PREC = 0.1; 44 45 /// The molar mass of water in units of g/mol 46 static const double H2OMolarMass = 18.015268; 47 48 static const std::string Outputpath = "/Output/"; 49 50 static const std::string parsinglogfile = "parseBsonDatalogfile.txt"; 51 52 static std::ofstream flog; 53 54 55 enum SubstanceTPMethodType { 56 cp_ft_equation = 0, 57 cp_ft_equation_saxena86 = 1, 58 solute_hkf88_gems = 2, 59 solute_hkf88_reaktoro = 3, 60 solute_aknifiev_diamond03 = 4, 61 landau_holland_powell98 = 5, 62 landau_berman88 = 6, 63 general_equation_of_state = 7, 64 fug_critical_param = 8, 65 fluid_prsv = 9, 66 fluid_churakov_gottschalk = 10, 67 fluid_soave_redlich_kwong = 11, 68 fluid_sterner_pitzer = 12, 69 fluid_peng_robinson78 = 13, 70 fluid_comp_redlich_kwong_hp91 = 14, 71 fluid_generic = 15, 72 fluid_H2O = 16, 73 fluid_CO2 = 17, 74 fluid_CH4 = 18, 75 fluid_N2 = 19, 76 fluid_H2 = 20, 77 fluid_O2 = 21, 78 fluid_Ar = 22, 79 fluid_polar = 23, 80 fluid_nonpolar = 24, 81 water_diel_jnort91_reaktoro = 25, 82 water_diel_jnort91_gems = 26, 83 water_diel_sverj14 = 27, 84 water_diel_fern97 = 28, 85 water_eos_hgk84_lvs83_gems = 29, 86 water_eos_iapws95_gems = 30, 87 water_eos_hgk84_reaktoro = 31, 88 water_eos_iapws95_reaktoro = 32, 89 water_pvt_zhang_duan05 = 33, 90 mv_constant = 34, 91 mv_equation_dorogokupets88 = 35, 92 mv_equation_berman88 = 36, 93 mv_eos_birch_murnaghan_gott97 = 37, 94 mv_eos_murnaghan_hp98 = 38, 95 mv_eos_tait_hp11 = 39, 96 mv_pvnrt = 40, 97 solute_holland_powell98 = 41, 98 solute_anderson91 = 42, 99 standard_entropy_cp_integration = 43 100 }; 101 102 enum ReactionTPMethodType { 103 logk_fpt_function = 0, 104 adsor_ion_exchange = 1, 105 iso_compounds_grichuk88 = 2, 106 logk_nordstrom_munoz88 = 3, 107 logk_1_term_extrap0 = 4, 108 logk_1_term_extrap1 = 5, 109 logk_2_term_extrap = 6, 110 logk_3_term_extrap = 7, 111 logk_lagrange_interp = 8, 112 logk_marshall_frank78 = 9, 113 solute_eos_ryzhenko_gems = 10, 114 dr_heat_capacity_ft = 11, 115 dr_volume_fpt = 12, 116 dr_volume_constant = 13, 117 logk_dolejs_manning10 = 14 118 }; 119 120 const std::map<const unsigned int, const std::string> enum_method_substance = { 121 {0,"cp_ft_equation"}, 122 {1,"cp_ft_equation_saxena86"}, 123 {2,"solute_hkf88_gems"}, 124 {3,"solute_hkf88_reaktoro"}, 125 {4,"solute_aknifiev_diamond03"}, 126 {5,"landau_holland_powell98"}, 127 {6,"landau_berman88"}, 128 //{7,"general_equation_of_state"}, 129 {8,"fug_critical_param"}, 130 {9,"fluid_prsv"}, 131 {10,"fluid_churakov_gottschalk"}, 132 {11,"fluid_soave_redlich_kwong"}, 133 {12,"fluid_sterner_pitzer"}, 134 {13,"fluid_peng_robinson78"}, 135 {14,"fluid_comp_redlich_kwong_hp91"}, 136 //{15,"fluid_generic"}, 137 //{16,"fluid_H2O"}, 138 //{17,"fluid_CO2"}, 139 //{18,"fluid_CH4"}, 140 //{19,"fluid_N2"}, 141 //{20,"fluid_H2"}, 142 //{21,"fluid_O2"}, 143 //{22,"fluid_Ar"}, 144 //{23,"fluid_polar"}, 145 //{24,"fluid_nonpolar"}, 146 {25,"water_diel_jnort91_reaktoro"}, 147 {26,"water_diel_jnort91_gems"}, 148 {27,"water_diel_sverj14"}, 149 {28,"water_diel_fern97"}, 150 {29,"water_eos_hgk84_lvs83_gems"}, 151 {30,"water_eos_iapws95_gems"}, 152 {31,"water_eos_hgk84_reaktoro"}, 153 {32,"water_eos_iapws95_reaktoro"}, 154 {33,"water_pvt_zhang_duan05"}, 155 {34,"mv_constant"}, 156 {35,"mv_equation_dorogokupets88"}, 157 {36,"mv_equation_berman88"}, 158 {37,"mv_eos_birch_murnaghan_gott97"}, 159 {38,"mv_eos_murnaghan_hp98"}, 160 {39,"mv_eos_tait_hp11"}, 161 {40,"mv_pvnrt"}, 162 {41,"solute_holland_powell98"}, 163 {42,"solute_anderson91"}, 164 {43,"standard_entropy_cp_integration"} 165 }; 166 167 const std::map<const unsigned int, const std::string> enum_method_reaction = { 168 {0,"logk_fpt_function"}, 169 //{1,"adsor_ion_exchange"}, 170 //{2,"iso_compounds_grichuk88"}, 171 {3,"logk_nordstrom_munoz88"}, 172 {4,"logk_1_term_extrap0"}, 173 {5,"logk_1_term_extrap1"}, 174 {6,"logk_2_term_extrap"}, 175 {7,"logk_3_term_extrap"}, 176 {8,"logk_lagrange_interp"}, 177 {9,"logk_marshall_frank78"}, 178 {10,"solute_eos_ryzhenko_gems"}, 179 {11,"dr_heat_capacity_ft"}, 180 {12,"dr_volume_fpt"}, 181 {13,"dr_volume_constant"}, 182 {14,"logk_dolejs_manning10"} 183 }; 184 185 const std::map<const ReactionTPMethodType, const std::vector<std::string>> reaction_method_parameters = { 186 {ReactionTPMethodType::logk_fpt_function, {"logk_ft_coeffs"}}, 187 {ReactionTPMethodType::adsor_ion_exchange, {""}}, 188 {ReactionTPMethodType::iso_compounds_grichuk88, {""}}, 189 {ReactionTPMethodType::logk_nordstrom_munoz88, {"logk_ft_coeffs"}}, 190 {ReactionTPMethodType::logk_1_term_extrap0, {"logk_ft_coeffs"}}, 191 {ReactionTPMethodType::logk_1_term_extrap1, {"logk_ft_coeffs"}}, 192 {ReactionTPMethodType::logk_2_term_extrap, {"logk_ft_coeffs"}}, 193 {ReactionTPMethodType::logk_3_term_extrap, {"logk_ft_coeffs"}}, 194 {ReactionTPMethodType::logk_lagrange_interp, {""}}, 195 {ReactionTPMethodType::logk_marshall_frank78, {"dr_marshall_franck_coeffs"}}, 196 {ReactionTPMethodType::solute_eos_ryzhenko_gems, {"dr_ryzhenko_coeffs"}}, 197 {ReactionTPMethodType::dr_heat_capacity_ft, {"dr_heat_capacity_ft_coeffs"}}, 198 {ReactionTPMethodType::dr_volume_fpt, {"dr_volume_fpt_coeffs"}}, 199 {ReactionTPMethodType::dr_volume_constant, {""}}, 200 {ReactionTPMethodType::logk_dolejs_manning10, {"dr_dolejs_manning10_coeffs"}}, 201 }; 202 203 204 const std::map<const SubstanceTPMethodType, const std::vector<std::string>> substance_method_parameters = { 205 {SubstanceTPMethodType::cp_ft_equation, {"m_heat_capacity_ft_coeffs"} }, 206 {SubstanceTPMethodType::solute_hkf88_gems, {"eos_hkf_coeffs"} }, 207 {SubstanceTPMethodType::solute_hkf88_reaktoro, {"eos_hkf_coeffs"} }, 208 {SubstanceTPMethodType::water_diel_jnort91_reaktoro, {""} }, 209 {SubstanceTPMethodType::water_diel_jnort91_gems, {""} }, 210 {SubstanceTPMethodType::water_diel_sverj14, {""} }, 211 {SubstanceTPMethodType::water_diel_fern97, {""} }, 212 {SubstanceTPMethodType::landau_holland_powell98, {"m_landau_phase_trans_props"} }, 213 {SubstanceTPMethodType::landau_berman88, {"m_berman_phase_trans_props"} }, 214 {SubstanceTPMethodType::cp_ft_equation_saxena86, {"m_heat_capacity_ft_coeffs"} }, 215 {SubstanceTPMethodType::water_eos_hgk84_lvs83_gems, {""} }, 216 {SubstanceTPMethodType::water_eos_iapws95_gems, {""} }, 217 {SubstanceTPMethodType::water_eos_hgk84_reaktoro, {""} }, 218 {SubstanceTPMethodType::water_eos_iapws95_reaktoro, {""} }, 219 {SubstanceTPMethodType::water_pvt_zhang_duan05, {""} }, 220 {SubstanceTPMethodType::mv_constant, {""} }, 221 {SubstanceTPMethodType::mv_pvnrt, {""} }, 222 {SubstanceTPMethodType::mv_equation_dorogokupets88, {"m_volume_fpt_coeffs"} }, 223 {SubstanceTPMethodType::mv_equation_berman88, {"m_volume_fpt_coeffs"} }, 224 {SubstanceTPMethodType::mv_eos_birch_murnaghan_gott97, {"eos_birch_murnaghan_coeffs"} }, 225 {SubstanceTPMethodType::mv_eos_murnaghan_hp98, {"eos_birch_murnaghan_coeffs"} }, 226 {SubstanceTPMethodType::mv_eos_tait_hp11, {""} }, 227 {SubstanceTPMethodType::fug_critical_param, {"eos_gas_crit_props"} }, 228 {SubstanceTPMethodType::fluid_prsv, {""} }, 229 {SubstanceTPMethodType::fluid_churakov_gottschalk, {"eos_churakov_gottschalk_coeffs"} }, 230 {SubstanceTPMethodType::fluid_soave_redlich_kwong, {""} }, 231 {SubstanceTPMethodType::fluid_sterner_pitzer, {""} }, 232 {SubstanceTPMethodType::fluid_peng_robinson78, {""} }, 233 {SubstanceTPMethodType::fluid_comp_redlich_kwong_hp91, {""} }, 234 {SubstanceTPMethodType::solute_aknifiev_diamond03, {"eos_akinfiev_diamond_coeffs"} }, 235 {SubstanceTPMethodType::solute_holland_powell98, {"solute_holland_powell98_coeffs"} }, 236 {SubstanceTPMethodType::solute_anderson91, {"solute_anderson91_coeffs"} }, 237 {SubstanceTPMethodType::standard_entropy_cp_integration, {""} } 238 }; 239 240 241 auto availableSubstanceTPMethods() -> const std::string; 242 auto availableReactionTPMethods() -> const std::string; 243 auto availablePropertiesReaction() -> const std::string; 244 auto availablePropertiesSubstance() -> const std::string; 245 246 247 /// Indexes for species-dependent EoS subroutines used in thrift DOM and ThermoFun class 248 typedef struct { 249 enum type { 250 CTPM_CON = 99, // constant properties from ref T-P 251 CTPM_CPT = 100, 252 CTPM_HKF = 101, 253 CTPM_REA = 102, 254 CTPM_EOS = 103, 255 CTPM_ISO = 104, 256 CTPM_SOR = 105, 257 CEM_OFF = 106, 258 CEM_GAS = 107, 259 CEM_H2O = 108, 260 CEM_CO2 = 109, 261 CEM_CH4 = 110, 262 CEM_N2 = 111, 263 CEM_H2 = 112, 264 CEM_O2 = 113, 265 CEM_AR = 114, 266 CEM_PO = 115, 267 CEM_NP = 116, 268 CTPM_WJNR = 117, /// calculation of the electro-chemical properties of H2O using the Johnson-Norton 1991 model as implemented in Reaktoro 269 CTPM_WJNG = 118, /// calculation of the electro-chemical properties of H2O using the Johnson-Norton 1991 model as implemented in GEMS 270 CTPM_HKFR = 119, /// HKFreaktoro 271 CTPM_WSV14 = 120, /// calculation of dielectric constant using the model of Sverjensky (2014) 272 CTPM_WF97 = 121, /// calculation of dielectric constant using the model of Fernandez et al. (1997) 273 CTPM_HP98 = 122, /// HP98 aq 274 CTPM_AN91 = 123 /// AN91 aq 275 }; 276 } MethodGenEoS_Thrift; 277 static const int MethodGenEoS_ndxThrift[] = { 278 MethodGenEoS_Thrift::CTPM_CPT, 279 MethodGenEoS_Thrift::CTPM_HKF, 280 MethodGenEoS_Thrift::CTPM_REA, 281 MethodGenEoS_Thrift::CTPM_EOS, 282 MethodGenEoS_Thrift::CTPM_ISO, 283 MethodGenEoS_Thrift::CTPM_SOR, 284 MethodGenEoS_Thrift::CEM_OFF, 285 MethodGenEoS_Thrift::CEM_GAS, 286 MethodGenEoS_Thrift::CEM_H2O, 287 MethodGenEoS_Thrift::CEM_CO2, 288 MethodGenEoS_Thrift::CEM_CH4, 289 MethodGenEoS_Thrift::CEM_N2, 290 MethodGenEoS_Thrift::CEM_H2, 291 MethodGenEoS_Thrift::CEM_O2, 292 MethodGenEoS_Thrift::CEM_AR, 293 MethodGenEoS_Thrift::CEM_PO, 294 MethodGenEoS_Thrift::CEM_NP 295 }; 296 /// Codes for species-dependent EoS subroutines in GEMS 297 //static const char* MethodGenEoS_GEMS[] = { 298 // "C", ///< CTPM_CPT integration of empirical heat capacity equation Cp=f(T); DComp and ReacDC 299 // "H", ///< CTPM_HKF Helgeson-Kirkham-Flowers (HKF) equation of state for aqueous species 300 // "K", ///< CTPM_REA calculation of logK of reactions as they depend functionally on T and P; ReacDC #### 301 // "S", ///< CTPM_EOS calculations via general equations of state (reserved) 302 // "I", ///< CTPM_ISO calculation of parameters for isotopic forms of compounds (Grichuk, 1988); ReacDC #### 303 // "X", ///< CTPM_SOR calculations via adsorption or ion exchange constants, using LFER correlations; ReacDC (reserved) #### 304 // "N", ///< CEM_OFF no fluid model routicompne 305 // "G", ///< CEM_GAS generic fluid model routine 306 // "V", ///< CEM_H2O subroutine for H2O fluid 307 // "C", ///< CEM_CO2 subroutine for CO2 fluid 308 // "M", ///< CEM_CH4 subroutine for CH4 fluid 309 // "T", ///< CEM_N2 subroutine for N2 fluid 310 // "H", ///< CEM_H2 subroutine for H2 fluid 311 // "O", ///< CEM_O2 subroutine for O2 fluid 312 // "A", ///< CEM_AR subroutine for Ar fluid 313 // "P", ///< CEM_PO subroutine for polar fluids 314 // "Q" ///< CEM_NP subroutine for nonpolar fluids 315 //}; 316 317 /// Indexes for temperature correction methods used in thrift DOM and ThermoFun class 318 typedef struct { 319 enum type { 320 CTM_CST = 200, 321 CTM_CHP = 201, 322 CTM_BER = 202, 323 CTM_FEI = 203, 324 CTM_LGX = 204, 325 CTM_HKF = 205, 326 CTM_WAT = 206, 327 CTM_WAS = 207, 328 CTM_LGK = 208, 329 CTM_EK0 = 209, 330 CTM_EK1 = 210, 331 CTM_EK2 = 211, 332 CTM_EK3 = 212, 333 CTM_IKZ = 213, 334 CTM_DKR = 214, 335 CTM_PPE = 215, 336 CTM_MRB = 216, 337 CTM_CPG = 217, 338 CTM_IFG = 218, 339 CTM_KAS = 219, 340 CTM_DAS = 220, 341 CTM_WAR = 221, 342 CTM_WWP = 222, 343 CTM_WZD = 223, 344 CTM_DMD = 224, 345 }; 346 } MethodCorrT_Thrift; 347 static const int MethodCorrT_ndxThrift[] = { 348 MethodCorrT_Thrift::CTM_CST, 349 MethodCorrT_Thrift::CTM_CHP, 350 MethodCorrT_Thrift::CTM_BER, 351 MethodCorrT_Thrift::CTM_FEI, 352 MethodCorrT_Thrift::CTM_LGX, 353 MethodCorrT_Thrift::CTM_HKF, 354 MethodCorrT_Thrift::CTM_WAT, 355 MethodCorrT_Thrift::CTM_WAS, 356 MethodCorrT_Thrift::CTM_LGK, 357 MethodCorrT_Thrift::CTM_EK0, 358 MethodCorrT_Thrift::CTM_EK1, 359 MethodCorrT_Thrift::CTM_EK2, 360 MethodCorrT_Thrift::CTM_EK3, 361 MethodCorrT_Thrift::CTM_IKZ, 362 MethodCorrT_Thrift::CTM_DKR, 363 MethodCorrT_Thrift::CTM_PPE, 364 MethodCorrT_Thrift::CTM_MRB, 365 MethodCorrT_Thrift::CTM_CPG, 366 MethodCorrT_Thrift::CTM_IFG, 367 MethodCorrT_Thrift::CTM_KAS, 368 MethodCorrT_Thrift::CTM_DAS, 369 MethodCorrT_Thrift::CTM_WAR, /// calculation of H2O water (steam) properties from Reaktoro (HGK implementation) 370 MethodCorrT_Thrift::CTM_WWP, /// Wagner and Pruss 1995 H2O EOS as implemented in reaktoro 371 MethodCorrT_Thrift::CTM_WZD, /// calculation of water proeprties using the Zhang and Duan (2005) EOS 372 MethodCorrT_Thrift::CTM_DMD 373 }; 374 /// Codes for temperature correction methods used in GEMS 375 //static const char* MethodCorrT_GEMS[] = { 376 // "S", ///< CTM_CST calculation of ordinary integral using 11-term Cp=f(T) equations (up to 3 phase transitions) 377 // "H", ///< CTM_CHP modifications for Landau phase transitions (Holland and Powell, 1998) 378 // "B", ///< CTM_BER modifications for Landau phase transitions (Berman, 1988) (reserved) 379 // "F", ///< CTM_FEI Cp=f(T) equation by Fei and Saxena (1986) (reserved) 380 // "X", ///< CTM_LGX calculation of reaction properties from empirical from 5-term Cp(T); ReacDC 381 // "K", ///< CTM_HKF calculation with HKF EOS (for aqueous species) as in SUPCRT92 382 // "W", ///< CTM_WAT calculation of H2O water(steam) properties from HGK and LVS equations of state 383 // "V", ///< CTM_WAS calculation of H2O water (steam) properties from IAPWS-95 equation of state (reserved) 384 // "L", ///< CTM_LGK calculation from empirical function logK=f(T) (Nordstrom and Munoz, 1988); ReacDC only 385 // "0", ///< CTM_EK0 one-term extrapolation assuming dHr=0 and logK=const; ReacDC 386 // "1", ///< CTM_EK1 one-term extrapolation assuming dGr=const (Gu et al., 1994); ReacDC 387 // "2", ///< CTM_EK2 two-term extrapolation; ReacDC only 388 // "3", ///< CTM_EK3 three-term extrapolation assuming dCpr=const; ReacDC 389 // "Z", ///< CTM_IKZ Lagrange polynomial interpolation over logK(TP) array; ReacDC 390 // "R", ///< CTM_DKR calculation of logK=f(T,P) from density equation (Marshall and Franck, 1978); ReacDC 391 // "M", ///< CTM_DMD 392 // "E", ///< CTM_PPE prediction of properties of aqueous hydroxides using Pronsprep-OH (Shock et al. 1997) 393 // "Y", ///< CTM_MRB calculation of logK=f(T,P) with modified Ryzhenko-Bryzgalin model 394 // "C", ///< CTM_CPG reserved (FGL) 395 // "G", ///< CTM_IFG calculation of parameters for isotopic forms of compounds (Grichuk, 1988); ReacDC 396 // "K", ///< CTM_KAS reserved 397 // "D", ///< CTM_DAS reserved 398 // "T" ///< CTM_WAR calculation of H2O water (steam) properties from Reaktoro (HGK implementation) 399 //}; 400 401 /// Indexes for pressure correction methods used in thrift DOM and ThermoFun class 402 typedef struct { 403 enum type { 404 CPM_OFF = 300, 405 CPM_NUL = 301, 406 CPM_ONE = 302, 407 CPM_TWO = 303, 408 CPM_TRI = 304, 409 CPM_CON = 305, 410 CPM_VKE = 306, 411 CPM_VBE = 307, 412 CPM_VBM = 308, 413 CPM_CEH = 309, 414 CPM_VTA = 310, 415 CPM_GAS = 311, 416 CPM_PRSV = 312, 417 CPM_EMP = 313, 418 CPM_SRK = 314, 419 CPM_STP = 315, 420 CPM_PR78 = 316, 421 CPM_CORK = 317, 422 CPM_REFL = 318, 423 CPM_HKF = 319, 424 CPM_AKI = 320, 425 CPM_PCR = 321, 426 CPM_INK = 322, 427 }; 428 } MethodCorrP_Thrift; 429 static const int MethodCorrP_ndxThrift[] = { 430 MethodCorrP_Thrift::CPM_OFF, 431 MethodCorrP_Thrift::CPM_NUL, 432 MethodCorrP_Thrift::CPM_ONE, 433 MethodCorrP_Thrift::CPM_TWO, 434 MethodCorrP_Thrift::CPM_TRI, 435 MethodCorrP_Thrift::CPM_CON, 436 MethodCorrP_Thrift::CPM_VKE, 437 MethodCorrP_Thrift::CPM_VBE, 438 MethodCorrP_Thrift::CPM_VBM, 439 MethodCorrP_Thrift::CPM_CEH, 440 MethodCorrP_Thrift::CPM_VTA, 441 MethodCorrP_Thrift::CPM_GAS, 442 MethodCorrP_Thrift::CPM_PRSV, 443 MethodCorrP_Thrift::CPM_EMP, 444 MethodCorrP_Thrift::CPM_SRK, 445 MethodCorrP_Thrift::CPM_STP, 446 MethodCorrP_Thrift::CPM_PR78, 447 MethodCorrP_Thrift::CPM_CORK, 448 MethodCorrP_Thrift::CPM_REFL, 449 MethodCorrP_Thrift::CPM_HKF, 450 MethodCorrP_Thrift::CPM_AKI, 451 MethodCorrP_Thrift::CPM_PCR, 452 MethodCorrP_Thrift::CPM_INK 453 }; 454 /// Codes for pressure correction methods used in GEMS 455 //static const char* MethodCorrP_GEMS[] = { 456 // "N", ///< CPM_OFF no account for pressure dependence 457 // "0", ///< CPM_NUL account for pressure dependence is already specified as inherent to a method 458 // "1", ///< CPM_ONE V0 459 // "2", ///< CPM_TWO 460 // "3", ///< CPM_TRI 461 // "C", ///< CPM_CON molar volume of DC or dVr are assumed independent of P and T 462 // "K", ///< CPM_VKE molar volume from empirical V=f(T,P) equation (Dorogokupets et al., 1988) 463 // "V", ///< CPM_VBE molar volume from empirical V=f(T,P) equation (Berman, 1988) 464 // "B", ///< CPM_VBM molar volume from Birch-Murnaghan EoS (Gottschalk, 1997) 465 // "E", ///< CPM_CEH molar volume V(T,P) from Murnaghan EoS (Holland and Powell, 1998) 466 // "H", ///< CPM_VTA molar volume V(T,P) from Tait EoS (Holland and Powell, 2011) 467 // "G", ///< CPM_GAS calculation of fugacities of gases from their critical parameters (reserved) 468 // "R", ///< CPM_PRSV Peng-Robinson-Stryjek-Vera (PRSV) EoS for fluids (nonelectrolytes) 469 // "S", ///< CPM_EMP Churakov-Gottschalk (CG) EoS for fluids (nonelectrolytes 470 // "T", ///< CPM_SRK Soave-Redlich-Kwong (SRK) EoS for fluids (nonelectrolytes) 471 // "6", ///< CPM_STP Sterner-Pitzer (SP) EoS for fluids (nonelectrolytes) (reserved) 472 // "7", ///< CPM_PR78 Peng-Robinson (PR78) EoS for fluids (nonelectrolytes) 473 // "8", ///< CPM_CORK Compensated Redlich-Kwong (CORK) EoS for fluids (nonelectrolytes) 474 // "9", ///< CPM_REFL reference EoS model for fluids (nonelectrolytes) (reserved) 475 // "F", ///< CPM_HKF account for pressure up to 5 kbar by HKF (Tanger and Helgeson, 1988) 476 // "A", ///< CPM_AKI partial molal volumes of aqueous nonelectrolyte species (Akinfiev and Diamond, 2003) 477 // "P", ///< CPM_PCR PARCOR estimation of HKF EoS parameters 478 // "Z" ///< CPM_INK Lagrange polynomial interpolation over logK(TP) array; ReacDC 479 //}; 480 481 static const std::map<const SubstanceTPMethodType, const int> new_old_s_methodtype = { 482 {SubstanceTPMethodType::cp_ft_equation, 100}, 483 {SubstanceTPMethodType::solute_hkf88_gems, 101}, 484 {SubstanceTPMethodType::solute_hkf88_reaktoro, 119}, 485 {SubstanceTPMethodType::water_diel_jnort91_reaktoro, 117}, 486 {SubstanceTPMethodType::water_diel_jnort91_gems, 118}, 487 {SubstanceTPMethodType::water_diel_sverj14, 120}, 488 {SubstanceTPMethodType::water_diel_fern97, 121}, 489 {SubstanceTPMethodType::landau_holland_powell98, 201}, 490 {SubstanceTPMethodType::landau_berman88, 202}, 491 {SubstanceTPMethodType::cp_ft_equation_saxena86, 203}, 492 {SubstanceTPMethodType::water_eos_hgk84_lvs83_gems, 206}, 493 {SubstanceTPMethodType::water_eos_iapws95_gems, 207}, 494 {SubstanceTPMethodType::water_eos_hgk84_reaktoro, 221}, 495 {SubstanceTPMethodType::water_eos_iapws95_reaktoro, 222}, 496 {SubstanceTPMethodType::water_pvt_zhang_duan05, 223}, 497 {SubstanceTPMethodType::mv_constant, 305}, 498 {SubstanceTPMethodType::mv_equation_dorogokupets88, 306}, 499 {SubstanceTPMethodType::mv_equation_berman88, 307}, 500 {SubstanceTPMethodType::mv_eos_birch_murnaghan_gott97, 308}, 501 {SubstanceTPMethodType::mv_eos_murnaghan_hp98, 309}, 502 {SubstanceTPMethodType::mv_eos_tait_hp11, 310}, 503 {SubstanceTPMethodType::fug_critical_param, 311}, 504 {SubstanceTPMethodType::fluid_prsv, 312}, 505 {SubstanceTPMethodType::fluid_churakov_gottschalk, 313}, 506 {SubstanceTPMethodType::fluid_soave_redlich_kwong, 314}, 507 {SubstanceTPMethodType::fluid_sterner_pitzer, 315}, 508 {SubstanceTPMethodType::fluid_peng_robinson78, 316}, 509 {SubstanceTPMethodType::fluid_comp_redlich_kwong_hp91, 317}, 510 {SubstanceTPMethodType::solute_aknifiev_diamond03, 320}, 511 {SubstanceTPMethodType::mv_pvnrt, 300}, 512 {SubstanceTPMethodType::standard_entropy_cp_integration, 200} 513 }; 514 515 static const std::map<const ReactionTPMethodType, const int> new_old_r_methodtype = { 516 {ReactionTPMethodType::dr_heat_capacity_ft, 100}, 517 {ReactionTPMethodType::adsor_ion_exchange, 105}, 518 {ReactionTPMethodType::logk_fpt_function, 102}, 519 {ReactionTPMethodType::iso_compounds_grichuk88, 104}, 520 {ReactionTPMethodType::logk_nordstrom_munoz88, 208}, 521 {ReactionTPMethodType::logk_1_term_extrap0, 209}, 522 {ReactionTPMethodType::logk_1_term_extrap1, 210}, 523 {ReactionTPMethodType::logk_2_term_extrap, 211}, 524 {ReactionTPMethodType::logk_3_term_extrap, 212}, 525 {ReactionTPMethodType::logk_lagrange_interp, 213}, 526 {ReactionTPMethodType::logk_marshall_frank78, 214}, 527 {ReactionTPMethodType::solute_eos_ryzhenko_gems, 216}, 528 {ReactionTPMethodType::dr_volume_fpt, 306}, 529 {ReactionTPMethodType::dr_volume_constant, 305 }, 530 {ReactionTPMethodType::logk_dolejs_manning10, 224 } 531 }; 532 533 typedef struct { 534 enum type { 535 C_MOLFRACTION = 0, 536 C_PARTIALPRESSURE = 1, 537 C_MOLALITY = 2, 538 C_MOLARITY = 3, 539 C_MASSFRACTION = 4, 540 C_SURFACEFRACTION = 5, 541 C_SURFACEDENSITY = 6, 542 C_SITEFRACTION = 7, 543 C_OTHER = 101 544 }; 545 } ConcentrationScales; 546 547 static const int ConcentrationScales_ndxThrift[] = { 548 ConcentrationScales::C_MOLFRACTION, 549 ConcentrationScales::C_PARTIALPRESSURE, 550 ConcentrationScales::C_MOLALITY, 551 ConcentrationScales::C_MOLARITY, 552 ConcentrationScales::C_MASSFRACTION, 553 ConcentrationScales::C_SURFACEFRACTION, 554 ConcentrationScales::C_SURFACEDENSITY, 555 ConcentrationScales::C_SITEFRACTION, 556 ConcentrationScales::C_OTHER 557 }; 558 559 //const char* ConcentrationScales_GEMS[] = { 560 // "C_MOLFRACTION", 561 // "C_PARTIALPRESSURE", 562 // "C_MOLALITY", 563 // "C_MOLARITY", 564 // "C_MASSFRACTION", 565 // "C_SURFACEFRACTION", 566 // "C_SURFACEDENSITY", 567 // "C_SITEFRACTION", 568 // "C_OTHER" 569 //}; 570 571 typedef struct { 572 enum type { 573 COMPONENT = 0, 574 GASFLUID = 1, 575 AQSOLUTE = 2, 576 AQSOLVENT = 3, 577 SURFSPECIES = 4, 578 SITEMOIETY = 5, 579 OTHER_SC = 101 580 }; 581 } SubstanceClass; 582 583 static const int SubstanceClass_ndxThrift[] = { 584 SubstanceClass::COMPONENT, 585 SubstanceClass::GASFLUID, 586 SubstanceClass::AQSOLUTE, 587 SubstanceClass::AQSOLVENT, 588 SubstanceClass::SURFSPECIES, 589 SubstanceClass::SITEMOIETY, 590 SubstanceClass::OTHER_SC 591 }; 592 593 //const char* SubstanceClass_GEMS[] = { 594 // "COMPONENT", 595 // "GASFLUID", 596 // "AQSOLUTE", 597 // "AQSOLVENT", 598 // "SURFSPECIES", 599 // "SITEMOIETY", 600 // "OTHER_SC" 601 //}; 602 603 typedef struct { 604 enum type { 605 GAS = 0, ///< Gaseous aggregate state (symbol g) 606 LIQUID = 1, ///< Condensed liquid aggregate state (symbol l) 607 GLASS = 2, ///< Glass/Vitreous state (symbol vit) 608 CRYSTAL = 3, ///< Crystalline solid aggregate state (symbol cr) 609 AQUEOUS = 4, ///< Aqueous electrolyte (symbol aq) 610 SURFACE = 5, ///< Surface layer, adsorbed species (symbol ads) 611 IONEX = 6, ///< Ion exchange (Donnan etc.) (eymbol ex) 612 PLASMA = 8, ///< Plasma (symbol pl) 613 SOLID = 9, ///< Solid (symbol s) 614 CONDENSED = 10, ///< CondensedPhase (symbol cd) 615 FLUID = 11, ///< Fluid (symbol fl) 616 LIQUIDCRYSTAL = 12, ///< LiquidCrystal (symbol lc) 617 AMORPHOUSSOLID = 13, ///< AmorphousSolid (symbol am) 618 MONOMERIC = 14, ///< Monomeric (symbol mon) 619 POLYMERIC = 15, ///< Polymeric (symbol pol) 620 SOLIDSOLUTION = 16, ///< SolidSolution (symbol ss) 621 OTHER = 101 ///< Other states, undefined 622 }; 623 } AggregateState; 624 625 static const int AggregateState_ndxThrift[] = { 626 AggregateState::GAS, 627 AggregateState::LIQUID, 628 AggregateState::GLASS, 629 AggregateState::CRYSTAL, 630 AggregateState::AQUEOUS, 631 AggregateState::SURFACE, 632 AggregateState::IONEX, 633 AggregateState::PLASMA, 634 AggregateState::SOLID, 635 AggregateState::CONDENSED, 636 AggregateState::FLUID, 637 AggregateState::LIQUIDCRYSTAL, 638 AggregateState::AMORPHOUSSOLID, 639 AggregateState::MONOMERIC, 640 AggregateState::POLYMERIC, 641 AggregateState::SOLIDSOLUTION, 642 AggregateState::OTHER 643 }; 644 645 //const char* AggregateState_GEMS[] = { 646 // "GAS", 647 // "LIQUID", 648 // "GLASS", 649 // "CRYSTAL", 650 // "AQUEOUS", 651 // "SURFACE", 652 // "OTHER_AS" 653 //}; 654 655 656 typedef struct { 657 enum type { 658 REACTANT = 0, ///< Component properties available 659 PRODUCT = 1, ///< Component properties to be defined via this reaction properties 660 CATALYST = 2, ///< Catalyzes the reaction but is not consumed in it 661 OTHER_RC = 101 ///< Other type of reaction component 662 }; 663 } ReactionComponentType; 664 665 666 typedef struct { 667 enum type { 668 DCOMP = 0, ///< Dependent component, properties calculated using a PT model for the substance 669 REACDC = 1 ///< Reaction dependent component, properties calculated from the reaction properties 670 }; 671 } SubstanceThermoCalculationType; 672 673 typedef struct { 674 enum type { 675 REACTION = 0, ///< Reaction, properties calculated using a PT model for the reaction 676 REACTANTS = 1 ///< Properties calculated from reactants 677 }; 678 } RectionThermoCalculationType; 679 680 681 /// Key for reading substance / reaction data from input files 682 static const char * label = "_label"; 683 static const char * _id = "_id"; 684 685 /// Element 686 static const char * elemName = "properties.name"; 687 static const char * elemSymbol = "properties.symbol"; 688 static const char * elemMolarMass = "properties.atomic_mass"; 689 static const char * elemEntropy = "properties.entropy"; 690 static const char * elemHeatCapacity = "properties.heat_capacity"; 691 static const char * elemClass = "properties.class_"; 692 static const char * elemIsotopeMass = "properties.isotope_mass"; 693 694 /// Substance 695 static const char * substName = "properties.name"; 696 static const char * substSymbol = "properties.symbol"; 697 static const char * substFormula = "properties.formula"; 698 static const char * substCharge = "properties.formula_charge"; 699 static const char * substMolarMass = "properties.mass_per_mole"; 700 static const char * substClass = "properties.class_"; 701 static const char * substAggState = "properties.aggregate_state"; 702 static const char * substSolventNname = ""; 703 static const char * substMethodEOS = "properties.method_genEoS"; 704 static const char * substMethodT = "properties.method_corrT"; 705 static const char * substMethodP = "properties.method_corrP"; 706 static const char * substRefT = "properties.Tst"; 707 static const char * substRefP = "properties.Pst"; 708 709 /// Reference properties 710 static const char * substRefG0_ = "properties.sm_gibbs_energy"; 711 static const char * substRefS0_ = "properties.sm_entropy_abs"; 712 static const char * substRefH0_ = "properties.sm_enthalpy"; 713 static const char * substRefV0_ = "properties.sm_volume"; 714 static const char * substRefCp0_ = "properties.sm_heat_capacity_p"; 715 716 static const char * substExpans_ = "properties.m_expansivity"; 717 static const char * substCompres_ = "properties.m_compressibility"; 718 719 /// Model parameters 720 static const char * substEOShkf = "eos_hkf_coeffs.values"; // 721 static const char * substEOSad = "eos_akinfiev_diamond_coeffs.values"; // 722 static const char * substEOSbm = "eos_birch_murnaghan_coeffs.values"; // 723 static const char * substEOScg = "eos_churakov_gottschalk_coeffs.values"; // 724 static const char * substEOSgasCrit = "eos_gas_crit_props.values"; // 725 static const char * substCpParam = "m_heat_capacity_ft_coeffs.values"; // 726 static const char * substTransProp = "m_phase_trans_props.values"; // 727 static const char * substTransPropLa = "m_landau_phase_trans_props.values"; // 728 static const char * substTransPropBm = "phase_transition_prop_Berman.values"; 729 730 static const char * lowerT = "limitsTP.lowerT"; 731 static const char * upperT = "limitsTP.upperT"; 732 static const char * lowerP = "limitsTP.lowerP"; 733 static const char * upperP = "limitsTP.upperP"; 734 735 static const char * plowerT = "properties.limitsTP.lowerT"; 736 static const char * pupperT = "properties.limitsTP.upperT"; 737 static const char * plowerP = "properties.limitsTP.lowerP"; 738 static const char * pupperP = "properties.limitsTP.upperP"; 739 740 /// Key for reading reaction data from input files 741 static const char * reacName = "properties.name"; 742 static const char * reacSymbol = "properties.symbol"; 743 static const char * reacEquation = "properties.equation"; 744 745 static const char * reacMethodEOS = "properties.method_genEoS"; 746 static const char * reacMethodT = "properties.method_corrT"; 747 static const char * reacMethodP = "properties.method_corrP"; 748 static const char * reacRefT = "properties.Tst"; 749 static const char * reacRefP = "properties.Pst"; 750 751 static const char * TPMethods = "properties.TPMethods"; 752 753 /// Reference properties 754 static const char * reacRefLogK0_ = "properties.logKr"; 755 static const char * reacRefG0_ = "properties.drsm_gibbs_energy"; 756 static const char * reacRefS0_ = "properties.drsm_entropy"; 757 static const char * reacRefH0_ = "properties.drsm_enthalpy"; 758 static const char * reacRefV0_ = "properties.drsm_volume"; 759 static const char * reacRefCp0_ = "properties.drsm_heat_capacity_p"; 760 761 /// Model parameters 762 static const char * reacLogKfT = "logk_ft_coeffs.values"; // 763 static const char * reacLogKPT = "logk_pt_values.pptv"; // 764 static const char * reacDrCpfT = "dr_heat_capacity_ft_coeffs.values"; // 765 static const char * reacDrVfT = "dr_volume_fpt_coeffs.values"; // 766 static const char * reacRBcoeff = "dr_ryzhenko_coeffs.values"; // 767 static const char * reacFMcoeff = "dr_marshall_franck_coeffs.values"; // 768 769 770 //typedef std::vector<struct SubstanceData*> Substances; 771 772 773 774 //typedef std::vector<struct ReactionData> Reactions; 775 776 } 777 ///@endcond 778 779 #endif // ThermoFun_GLOBAL_H 780