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:
Ian Bell
2014-10-28 18:59:39 -04:00
parent 4f0842ba36
commit 23c1a38b4d
5 changed files with 97 additions and 44 deletions

View File

@@ -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

View File

@@ -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
{

View File

@@ -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()));
}