mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Add tests for the references state for enthalpy and entropy
Closes https://github.com/CoolProp/CoolProp/issues/77 Closes https://github.com/CoolProp/CoolProp/issues/76 Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
@@ -156,7 +156,7 @@ void FlashRoutines::QT_flash(HelmholtzEOSMixtureBackend &HEOS)
|
||||
|
||||
// Check limits
|
||||
if (!is_in_closed_range(Tmin_sat, Tmax_sat, static_cast<long double>(HEOS._T))){
|
||||
throw ValueError(format("Temperature to QT_flash [%6g K] must be in range [%8g K, %8g K]",HEOS._T, Tmin_sat, Tmax_sat));
|
||||
throw ValueError(format("Temperature to QT_flash [%6g K] must be in range [%8Lg K, %8Lg K]",HEOS._T, Tmin_sat, Tmax_sat));
|
||||
}
|
||||
|
||||
// If exactly(ish) at the critical temperature, liquid and vapor have the critial density
|
||||
|
||||
@@ -265,7 +265,7 @@ protected:
|
||||
long double a1 = cpjson::get_double(contribution, "a1");
|
||||
long double a2 = cpjson::get_double(contribution, "a2");
|
||||
std::string reference = cpjson::get_string(contribution, "reference");
|
||||
EOS.alpha0.EnthalpyEntropyOffset = IdealHelmholtzEnthalpyEntropyOffset(a1, a2, reference);
|
||||
EOS.alpha0.EnthalpyEntropyOffsetCore = IdealHelmholtzEnthalpyEntropyOffset(a1, a2, reference);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -141,6 +141,11 @@ void HelmholtzEOSMixtureBackend::update_states(void)
|
||||
EOS.hs_anchor.hmolar = hmolar();
|
||||
EOS.hs_anchor.smolar = smolar();
|
||||
|
||||
// Calculate the new enthalpy and entropy values at the reducing state
|
||||
update(DmolarT_INPUTS, EOS.reduce.rhomolar, EOS.reduce.T);
|
||||
EOS.reduce.hmolar = hmolar();
|
||||
EOS.reduce.smolar = smolar();
|
||||
|
||||
// Clear again just to be sure
|
||||
clear();
|
||||
}
|
||||
@@ -157,6 +162,9 @@ const CoolProp::SimpleState & HelmholtzEOSMixtureBackend::calc_state(const std::
|
||||
else if (!state.compare("max_sat_p")){
|
||||
return components[0]->pEOS->max_sat_p;
|
||||
}
|
||||
else if (!state.compare("reducing")){
|
||||
return components[0]->pEOS->reduce;
|
||||
}
|
||||
else{
|
||||
throw ValueError(format("This state [%s] is invalid to calc_state",state.c_str()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user