Fixed evaluation AT the critical point

Closes https://github.com/CoolProp/CoolProp/issues/178

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-10-16 00:12:46 +02:00
parent 77818c5cda
commit cfcd50bffc
4 changed files with 24 additions and 1 deletions

View File

@@ -1086,10 +1086,30 @@ void HelmholtzEOSMixtureBackend::T_phase_determination_pure_or_pseudopure(int ot
{
if (!ValidNumber(value)){
throw ValueError(format("value to T_phase_determination_pure_or_pseudopure is invalid"));};
// T is known, another input P, T, H, S, U is given (all molar)
if (_T < _crit.T && _p > _crit.p){
_phase = iphase_supercritical_liquid;
}
else if (std::abs(_T - _crit.T) < 10*DBL_EPSILON)
{
switch (other)
{
case iDmolar:
if (std::abs(_rhomolar - _crit.rhomolar) < 10*DBL_EPSILON){
_phase = iphase_critical_point; break;
}
else if (_rhomolar > _crit.rhomolar){
_phase = iphase_supercritical_liquid; break;
}
else{
_phase = iphase_supercritical_gas; break;
}
default:
throw ValueError(format("T=Tcrit; invalid input for other to T_phase_determination_pure_or_pseudopure"));
}
}
else if (_T < _crit.T)
{
// Start to think about the saturation stuff