Allow for PT and P+Y inputs for p < ptriple; closes #757

This commit is contained in:
Ian Bell
2015-08-01 20:36:28 -06:00
parent 0afd230706
commit dfa3e11cb2
2 changed files with 17 additions and 2 deletions

View File

@@ -1163,7 +1163,12 @@ void FlashRoutines::HSU_P_flash(HelmholtzEOSMixtureBackend &HEOS, parameters oth
case iphase_gas:
{
Tmax = 1.5*HEOS.Tmax();
if (saturation_called){ Tmin = HEOS.SatV->T();}else{Tmin = HEOS._TVanc.pt();}
if (HEOS._p < HEOS.p_triple()){
Tmin = std::max(HEOS.Tmin(), HEOS.Ttriple());
}
else{
if (saturation_called){ Tmin = HEOS.SatV->T();}else{Tmin = HEOS._TVanc.pt();}
}
break;
}
case iphase_liquid:

View File

@@ -1356,7 +1356,17 @@ void HelmholtzEOSMixtureBackend::p_phase_determination_pure_or_pseudopure(int ot
}
else if (_p < components[0].EOS().ptriple*0.9999)
{
throw NotImplementedError(format("for now, we don't support p [%g Pa] below ptriple [%g Pa]",_p, components[0].EOS().ptriple));
if (other == iT){
if (_T > std::max(Tmin(), Ttriple())){
_phase = iphase_gas;
}
else{
throw NotImplementedError(format("For now, we don't support p [%g Pa] below ptriple [%g Pa] when T [%g] is less than Tmin [%g]",_p, components[0].EOS().ptriple, _T, std::max(Tmin(), Ttriple())) );
}
}
else{
_phase = iphase_gas;
}
}
else{
throw ValueError(format("The pressure [%g Pa] cannot be used in p_phase_determination",_p));