Resolved issues with Dmolar,T in subcooled liquid zone without resorting to saturation call; see #624

More work remains for some of other two-phase flashes
This commit is contained in:
Ian Bell
2015-04-26 14:20:11 -06:00
parent fff2bd7c6a
commit 14cfd28d9f

View File

@@ -1405,12 +1405,19 @@ void HelmholtzEOSMixtureBackend::T_phase_determination_pure_or_pseudopure(int ot
this->_phase = iphase_liquid; return;
}
else{
_phase = iphase_liquid;
_Q = -1000;
// Next we check the vapor quality based on the ancillary values
double Qanc = (1/value - 1/static_cast<double>(_rhoLanc))/(1/static_cast<double>(_rhoVanc) - 1/static_cast<double>(_rhoLanc));
// If the vapor quality is significantly inside the two-phase zone, stop, we are two-phase
if (Qanc > 0.05 && Qanc < 0.95){
break; // It's two-phase
}
_phase = iphase_liquid; // Needed for direct update call
_Q = -1000; // Needed for direct update call
update_DmolarT_direct(value, _T);
CoolPropDbl pL = components[0].ancillaries.pL.evaluate(_T);
if (_p > pL*1.05){
this->_phase = iphase_liquid; _Q = -1000; return;
if (Qanc < 0.1 && _p > pL*1.05 && first_partial_deriv(iP, iDmolar, iT) > 0 && second_partial_deriv(iP, iDmolar, iT, iDmolar, iT) > 0){
_phase = iphase_liquid; _Q = -1000; return;
}
else{
_phase = iphase_unknown;