TD flash goes back to checking for quality < 0 and > 1 for single phase solution

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-12-02 22:14:46 -05:00
parent 98172399c1
commit c62ae83c38
3 changed files with 9 additions and 8 deletions

View File

@@ -1397,11 +1397,11 @@ void HelmholtzEOSMixtureBackend::T_phase_determination_pure_or_pseudopure(int ot
this->SatL->update(DmolarT_INPUTS, HEOS.SatL->rhomolar(), HEOS.SatL->T());
this->SatV->update(DmolarT_INPUTS, HEOS.SatV->rhomolar(), HEOS.SatV->T());
if (Q < -100*DBL_EPSILON){
this->_phase = iphase_liquid; _Q = -1000; return;
if (Q < 0){
this->_phase = iphase_liquid; _Q = -1; return;
}
else if (Q > 1+100*DBL_EPSILON){
this->_phase = iphase_gas; _Q = 1000; return;
else if (Q > 1){
this->_phase = iphase_gas; _Q = 1; return;
}
else{
this->_phase = iphase_twophase;

View File

@@ -961,15 +961,15 @@ void SaturationSolvers::saturation_T_pure_Maxwell(HelmholtzEOSMixtureBackend &HE
// Lets assume that liquid density is more or less linear with T
rhoL = (crit.rhomolar - tripleL.rhomolar)/(crit.T - tripleL.T)*(T-tripleL.T)+tripleL.rhomolar;
// Then we calculate pressure from this density
SatL->update(DmolarT_INPUTS, rhoL, T);
SatL->update_DmolarT_direct(rhoL, T);
// Then we assume vapor to be ideal gas
rhoV = SatL->p()/(SatL->gas_constant()*T);
// Update the vapor state
SatV->update(DmolarT_INPUTS, rhoV, T);
SatV->update_DmolarT_direct(rhoV, T);
}
else{
SatL->update(DmolarT_INPUTS, rhoL, T);
SatV->update(DmolarT_INPUTS, rhoV, T);
SatL->update_DmolarT_direct(rhoL, T);
SatV->update_DmolarT_direct(rhoV, T);
}
if (get_debug_level() > 0){ std::cout << format("[Maxwell] ancillaries T: %0.16Lg rhoL: %0.16Lg rhoV: %0.16Lg pL: %g pV: %g\n", T, rhoL, rhoV, SatL->p(), SatV->p());}

View File

@@ -606,6 +606,7 @@ public:
State.update(pair, x1, x2);
// Make sure we end up back at the same temperature and pressure we started out with
if(State.Q() < 1 && State.Q() > 0) throw CoolProp::ValueError(format("Q [%g K] is between 0 and 1; two-phase solution",State.Q()));
if(std::abs(T-State.T()) > 1e-2) throw CoolProp::ValueError(format("Error on T [%Lg K] is greater than 1e-2",std::abs(State.T()-T)));
if(std::abs(p-State.p())/p*100 > 1e-2) throw CoolProp::ValueError(format("Error on p [%Lg %%] is greater than 1e-2 %%",std::abs(p-State.p())/p*100));
}