Ancillary saturation solver works a bit better, still some issues.

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-08-26 23:20:24 +02:00
parent 928a0df8b5
commit e062e0dbf6

View File

@@ -115,8 +115,8 @@ void FlashRoutines::QT_flash(HelmholtzEOSMixtureBackend &HEOS)
throw ValueError("pseudo-pure failed");
}
rhoLsat = HEOS.solver_rho_Tp(HEOS._T, psatLanc, rhoLanc);
rhoVsat = HEOS.solver_rho_Tp(HEOS._T, psatVanc, rhoVanc);
HEOS.SatL->update_TP_guessrho(HEOS._T, psatLanc, rhoLanc);
HEOS.SatV->update_TP_guessrho(HEOS._T, psatVanc, rhoVanc);
if (!ValidNumber(rhoLsat) || !ValidNumber(rhoVsat) ||
std::abs(rhoLsat/rhoLanc-1) > 0.5 || std::abs(rhoVanc/rhoVsat-1) > 0.5)
{
@@ -124,12 +124,12 @@ void FlashRoutines::QT_flash(HelmholtzEOSMixtureBackend &HEOS)
}
}
catch (std::exception &){
// Near the critical point, the behavior is not very nice, so we will just use the ancillary near the critical point
// Near the critical point, the behavior is not very nice, so we will just use the ancillary
rhoLsat = rhoLanc;
rhoVsat = rhoVanc;
}
HEOS._p = HEOS._Q*psatVanc + (1-HEOS._Q)*psatLanc;
HEOS._rhomolar = 1/(HEOS._Q/rhoVsat + (1-HEOS._Q)/rhoLsat);
HEOS._rhomolar = 1/(HEOS._Q/HEOS.SatV->rhomolar() + (1 - HEOS._Q)/HEOS.SatL->rhomolar());
HEOS.SatL->update(DmolarT_INPUTS, rhoLsat, HEOS._T);
HEOS.SatV->update(DmolarT_INPUTS, rhoVsat, HEOS._T);
}