6 #include "externals/IF97/IF97.h"
60 this->_rhomass.
clear();
70 double epsilon = 3.3e-5;
72 if ((std::abs(
_T - IF97::Tcrit) < epsilon / 10.0) &&
73 (std::abs(
_p - IF97::Pcrit) < epsilon)) {
75 }
else if (
_T > IF97::Tcrit) {
76 if (
_p > IF97::Pcrit) {
82 if (
_p > IF97::Pcrit) {
85 double psat = IF97::psat97(
_T);
86 if (
_p > psat * (1.0 + epsilon)) {
88 }
else if (
_p < psat * (1.0 - epsilon)) {
97 IF97Region = IF97::BackwardRegion(
_p,
_smass, IF97_SMASS);
99 IF97Region = IF97::BackwardRegion(
_p,
_hmass, IF97_HMASS);
101 switch (IF97Region) {
103 if (
_p <= IF97::Pcrit) {
110 if (
_T <= IF97::Tcrit) {
117 if (
_T < IF97::Tsat97(
_p)) {
118 if (
_p <= IF97::Pcrit) {
124 if (
_T <= IF97::Tcrit) {
153 double H, S, hLmass, hVmass, sLmass, sVmass;
157 switch (input_pair) {
165 throw ValueError(
format(
"Saturation pressure [%g Pa] corresponding to T [%g K] is within 3.3e-3 %% of given p [%Lg Pa]",
166 IF97::psat97(
_T),
_T,
_p));
172 _T = IF97::Tsat97(
_p);
179 _p = IF97::psat97(
_T);
194 if (IF97::BackwardRegion(
_p,
_hmass, IF97_HMASS) == 4) {
196 hVmass = IF97::hvap_p(
_p);
197 hLmass = IF97::hliq_p(
_p);
198 _Q = std::min(1.0, std::max(0.0, (H - hLmass) / (hVmass - hLmass)));
216 if (IF97::BackwardRegion(
_p,
_smass, IF97_SMASS) == 4) {
218 sVmass = IF97::svap_p(
_p);
219 sLmass = IF97::sliq_p(
_p);
220 _Q = std::min(1.0, std::max(0.0, (S - sLmass) / (sVmass - sLmass)));
237 if (IF97::BackwardRegion(
_p,
_hmass, IF97_HMASS) == 4) {
239 hVmass = IF97::hvap_p(
_p);
240 hLmass = IF97::hliq_p(
_p);
241 _Q = std::min(1.0, std::max(0.0, (H - hLmass) / (hVmass - hLmass)));
249 throw ValueError(
"This pair of inputs is not yet supported");
264 return IF97::rholiq_p(
_p);
267 return IF97::hliq_p(
_p);
270 return IF97::sliq_p(
_p);
273 return IF97::cpliq_p(
_p);
276 return IF97::cvliq_p(
_p);
279 return IF97::uliq_p(
_p);
282 return IF97::speed_soundliq_p(
_p);
285 return IF97::viscliq_p(
_p);
288 return IF97::tcondliq_p(
_p);
291 return IF97::sigma97(
_T);
294 return IF97::prandtlliq_p(
_p);
303 return IF97::rhovap_p(
_p);
306 return IF97::hvap_p(
_p);
309 return IF97::svap_p(
_p);
312 return IF97::cpvap_p(
_p);
315 return IF97::cvvap_p(
_p);
318 return IF97::uvap_p(
_p);
321 return IF97::speed_soundvap_p(
_p);
324 return IF97::viscvap_p(
_p);
327 return IF97::tcondvap_p(
_p);
330 return IF97::sigma97(
_T);
333 return IF97::prandtlvap_p(
_p);
342 if (std::abs(
_Q) < 1e-10) {
344 }
else if (std::abs(
_Q - 1) < 1e-10) {
368 return IF97::sigma97(
_T);
381 return IF97::rhomass_Tp(
_T,
_p);
384 return IF97::hmass_Tp(
_T,
_p);
387 return IF97::smass_Tp(
_T,
_p);
390 return IF97::cpmass_Tp(
_T,
_p);
393 return IF97::cvmass_Tp(
_T,
_p);
396 return IF97::umass_Tp(
_T,
_p);
399 return IF97::speed_sound_Tp(
_T,
_p);
402 return IF97::visc_Tp(
_T,
_p);
405 return IF97::tcond_Tp(
_T,
_p);
411 return IF97::prandtl_Tp(
_T,
_p);
439 return IF97::hmass_psmass(
_p,
_smass);
457 return IF97::smass_phmass(
_p,
_hmass);
534 return IF97::get_Ttrip();
538 return IF97::get_ptrip();
542 return IF97::get_Tcrit();
546 return IF97::get_pcrit();
555 return IF97::get_MW();
559 return IF97::get_Acentric();
565 return IF97::get_Pmax();
570 return IF97::get_Tmax();
574 return IF97::get_Tmin();
589 return IF97::get_rhocrit();