mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Implement some things for bicubic backend
This commit is contained in:
@@ -268,14 +268,21 @@ void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double v
|
||||
std::size_t iL = 0, iV = 0;
|
||||
CoolPropDbl hL = 0, hV = 0;
|
||||
_p = val1; _Q = val2;
|
||||
if (_p < pure_saturation.pL[0]){throw ValueError(format("p (%g) Pa below minimum pressure", static_cast<double>(_p)));}
|
||||
pure_saturation.is_inside(iP, _p, iQ, _Q, iL, iV, hL, hV);
|
||||
|
||||
using_single_phase_table = false;
|
||||
if(!is_in_closed_range(0.0,1.0,static_cast<double>(_Q))){
|
||||
if(!is_in_closed_range(0.0, 1.0, static_cast<double>(_Q))){
|
||||
throw ValueError("vapor quality is not in (0,1)");
|
||||
}
|
||||
else{
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
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;
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
else{
|
||||
cached_saturation_iL = iL; cached_saturation_iV = iV;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -291,6 +298,7 @@ void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double v
|
||||
else{
|
||||
if (is_mixture){
|
||||
std::vector<std::pair<std::size_t,std::size_t> > intersect = PhaseEnvelopeRoutines::find_intersections(phase_envelope, iT, _T);
|
||||
if (intersect.empty()){ throw ValueError(format("T [%g K] is not within phase envelope", _T)); }
|
||||
iV = intersect[0].first; iL = intersect[1].first;
|
||||
double pL = PhaseEnvelopeRoutines::evaluate(phase_envelope, iP, iT, _T, iL);
|
||||
double pV = PhaseEnvelopeRoutines::evaluate(phase_envelope, iP, iT, _T, iV);
|
||||
|
||||
@@ -353,7 +353,12 @@ CoolPropDbl CoolProp::TabularBackend::calc_T(void){
|
||||
return _HUGE; // not needed, will never be hit, just to make compiler happy
|
||||
}
|
||||
else{
|
||||
return pure_saturation.evaluate(iT, _p, _Q, cached_saturation_iL, cached_saturation_iV);
|
||||
if (is_mixture){
|
||||
return phase_envelope_sat(phase_envelope, iT, iP, _p);
|
||||
}
|
||||
else{
|
||||
return pure_saturation.evaluate(iT, _p, _Q, cached_saturation_iL, cached_saturation_iV);
|
||||
}
|
||||
}
|
||||
}
|
||||
CoolPropDbl CoolProp::TabularBackend::calc_rhomolar(void){
|
||||
|
||||
Reference in New Issue
Block a user