mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Fix failures when building tables at very low pressure; closes #750
This commit is contained in:
@@ -544,6 +544,10 @@ void SaturationSolvers::saturation_PHSU_pure(HelmholtzEOSMixtureBackend &HEOS, C
|
||||
{
|
||||
throw SolutionError(format("saturation_PHSU_pure solver T < 0"));
|
||||
}
|
||||
// If the change is very small, stop
|
||||
if (max_abs_value(v) < 1e-10){
|
||||
break;
|
||||
}
|
||||
if (iter > 50){
|
||||
// Set values back into the options structure for use in next solver
|
||||
options.rhoL = rhoL; options.rhoV = rhoV; options.T = T;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
#if !defined(NO_TABULAR_BACKENDS)
|
||||
|
||||
#include "BicubicBackend.h"
|
||||
@@ -279,7 +280,10 @@ void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double v
|
||||
iV = intersect[0].first; iL = intersect[1].first;
|
||||
}
|
||||
else{
|
||||
pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, TL, TV);
|
||||
bool it_is_inside = pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, TL, TV);
|
||||
if (!it_is_inside){
|
||||
throw ValueError("Not possible to determine whether pressure is inside or not");
|
||||
}
|
||||
}
|
||||
_T = _Q*TV + (1-_Q)*TL;
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
|
||||
@@ -187,14 +187,17 @@ void CoolProp::TTSEBackend::update(CoolProp::input_pairs input_pair, double val1
|
||||
throw ValueError("vapor quality is not in (0,1)");
|
||||
}
|
||||
else{
|
||||
CoolPropDbl TL, TV;
|
||||
CoolPropDbl TL = _HUGE, TV = _HUGE;
|
||||
if (is_mixture){
|
||||
std::vector<std::pair<std::size_t, std::size_t> > intersect = PhaseEnvelopeRoutines::find_intersections(phase_envelope, iP, _p);
|
||||
if (intersect.empty()){ throw ValueError(format("p [%g Pa] is not within phase envelope", _p)); }
|
||||
iV = intersect[0].first; iL = intersect[1].first;
|
||||
}
|
||||
else{
|
||||
pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, TL, TV);
|
||||
bool it_is_inside = pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, TL, TV);
|
||||
if (!it_is_inside){
|
||||
throw ValueError("Not possible to determine whether pressure is inside or not");
|
||||
}
|
||||
}
|
||||
_T = _Q*TV + (1-_Q)*TL;
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
|
||||
Reference in New Issue
Block a user