mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-02-09 13:25:12 -05:00
P,Y now works if P > pc
Add supercritical_gas and supercritical_liquid phase flags for a bit finer granularity Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
@@ -590,10 +590,17 @@ void FlashRoutines::HSU_P_flash(HelmholtzEOSMixtureBackend &HEOS, int other)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case iphase_supercritical_liquid:
|
||||
case iphase_supercritical_gas:
|
||||
case iphase_supercritical:
|
||||
{
|
||||
Tmax = HEOS.Tmax();
|
||||
Tmin = HEOS.Tmin();
|
||||
if (HEOS.has_melting_curve()){
|
||||
Tmin = HEOS.calc_melting_line(iT, iP, HEOS._p);
|
||||
}
|
||||
else{
|
||||
Tmin = HEOS.Tmin() + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -664,43 +664,43 @@ void HelmholtzEOSMixtureBackend::p_phase_determination_pure_or_pseudopure(int ot
|
||||
this->_phase = iphase_supercritical; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_liquid; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
case iDmolar:
|
||||
{
|
||||
if (_rhomolar < _crit.rhomolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_liquid; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
case iSmolar:
|
||||
{
|
||||
if (_smolar.pt() > _crit.smolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_liquid; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
case iHmolar:
|
||||
{
|
||||
if (_hmolar.pt() > _crit.hmolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_liquid; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
case iUmolar:
|
||||
{
|
||||
if (_umolar.pt() > _crit.umolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_liquid; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
default:
|
||||
@@ -1044,43 +1044,43 @@ void HelmholtzEOSMixtureBackend::T_phase_determination_pure_or_pseudopure(int ot
|
||||
this->_phase = iphase_supercritical; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_gas; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
}
|
||||
case iDmolar:
|
||||
{
|
||||
if (_rhomolar > _crit.rhomolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_gas; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
}
|
||||
case iSmolar:
|
||||
{
|
||||
if (_smolar.pt() > _crit.smolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_gas; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
case iHmolar:
|
||||
{
|
||||
if (_hmolar.pt() > _crit.hmolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_gas; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
case iUmolar:
|
||||
{
|
||||
if (_umolar.pt() > _crit.umolar){
|
||||
this->_phase = iphase_supercritical; return;
|
||||
this->_phase = iphase_supercritical_gas; return;
|
||||
}
|
||||
else{
|
||||
this->_phase = iphase_gas; return;
|
||||
this->_phase = iphase_supercritical_liquid; return;
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -733,7 +733,7 @@ TEST_CASE("Tests for solvers in P,Y flash using Water", "[flash],[PH],[PS],[PU]"
|
||||
CHECK(ValidNumber(T2));
|
||||
}
|
||||
std::ostringstream ss5;
|
||||
ss5 << "Supercritical \"gas\" P," << ykey;
|
||||
ss5 << "Supercritical P," << ykey;
|
||||
SECTION(ss5.str(), "")
|
||||
{
|
||||
double Tc = Props1SI("Water","Tcrit");
|
||||
@@ -744,7 +744,47 @@ TEST_CASE("Tests for solvers in P,Y flash using Water", "[flash],[PH],[PS],[PU]"
|
||||
CAPTURE(p);
|
||||
CHECK(ValidNumber(T));
|
||||
CHECK(ValidNumber(p));
|
||||
CHECK_NOTHROW(y=PropsSI("H","P",p,"T",T,"Water"));
|
||||
CHECK_NOTHROW(y=PropsSI(ykey,"P",p,"T",T,"Water"));
|
||||
CAPTURE(y);
|
||||
CHECK(ValidNumber(y));
|
||||
CHECK_NOTHROW(T2=PropsSI("T",ykey,y,"P",p,"Water"));
|
||||
CAPTURE(CoolProp::get_global_param_string("errstring"));
|
||||
CAPTURE(T2);
|
||||
CHECK(ValidNumber(T2));
|
||||
}
|
||||
std::ostringstream ss6;
|
||||
ss6 << "Supercritical \"gas\" P," << ykey;
|
||||
SECTION(ss6.str(), "")
|
||||
{
|
||||
double Tc = Props1SI("Water","Tcrit");
|
||||
double pc = Props1SI("Water","pcrit");
|
||||
double p = pc*0.7;
|
||||
double T = Tc*1.3;
|
||||
CAPTURE(T);
|
||||
CAPTURE(p);
|
||||
CHECK(ValidNumber(T));
|
||||
CHECK(ValidNumber(p));
|
||||
CHECK_NOTHROW(y=PropsSI(ykey,"P",p,"T",T,"Water"));
|
||||
CAPTURE(y);
|
||||
CHECK(ValidNumber(y));
|
||||
CHECK_NOTHROW(T2=PropsSI("T",ykey,y,"P",p,"Water"));
|
||||
CAPTURE(CoolProp::get_global_param_string("errstring"));
|
||||
CAPTURE(T2);
|
||||
CHECK(ValidNumber(T2));
|
||||
}
|
||||
std::ostringstream ss7;
|
||||
ss7 << "Supercritical \"liquid\" P," << ykey;
|
||||
SECTION(ss7.str(), "")
|
||||
{
|
||||
double Tc = Props1SI("Water","Tcrit");
|
||||
double pc = Props1SI("Water","pcrit");
|
||||
double p = pc*1.3;
|
||||
double T = Tc*0.7;
|
||||
CAPTURE(T);
|
||||
CAPTURE(p);
|
||||
CHECK(ValidNumber(T));
|
||||
CHECK(ValidNumber(p));
|
||||
CHECK_NOTHROW(y=PropsSI(ykey,"P",p,"T",T,"Water"));
|
||||
CAPTURE(y);
|
||||
CHECK(ValidNumber(y));
|
||||
CHECK_NOTHROW(T2=PropsSI("T",ykey,y,"P",p,"Water"));
|
||||
@@ -752,7 +792,6 @@ TEST_CASE("Tests for solvers in P,Y flash using Water", "[flash],[PH],[PS],[PU]"
|
||||
CAPTURE(T2);
|
||||
CHECK(ValidNumber(T2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user