mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
For P, T near saturation for BICUBIC, move away from the saturation curve; closes #629
This commit is contained in:
@@ -241,6 +241,24 @@ void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double v
|
||||
// Find and cache the indices i, j
|
||||
selected_table = SELECTED_PT_TABLE;
|
||||
single_phase_logpT.find_native_nearest_good_cell(_T, _p, cached_single_phase_i, cached_single_phase_j);
|
||||
// If p < pc, you might be getting a liquid solution when you want a vapor solution or vice versa
|
||||
// if you are very close to the saturation curve, so we figure out what the saturation temperature
|
||||
// is for the given pressure
|
||||
if (_p < this->AS->p_critical())
|
||||
{
|
||||
double Ts = pure_saturation.evaluate(iT, _p, _Q, iL, iV);
|
||||
double TL = single_phase_logpT.T[cached_single_phase_i][cached_single_phase_j];
|
||||
double TR = single_phase_logpT.T[cached_single_phase_i+1][cached_single_phase_j];
|
||||
if (TL < Ts && Ts < TR){
|
||||
if (_T < Ts){
|
||||
// It's liquid, move the cell to the left
|
||||
cached_single_phase_i--;
|
||||
}else{
|
||||
// It's vapor, move to the right
|
||||
cached_single_phase_i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user