Bump up max temps for melting lines to make them valid up to the maximum pressure of EOS

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-08-12 12:02:56 +02:00
parent b7bd58d986
commit 5726d38975
13 changed files with 30 additions and 17 deletions

View File

@@ -587,8 +587,9 @@ void FlashRoutines::HSU_P_flash(HelmholtzEOSMixtureBackend &HEOS, int other)
{
if (saturation_called){ Tmax = HEOS.SatL->T();}else{Tmax = HEOS._TLanc.pt();}
if (HEOS.has_melting_line()){
Tmin = HEOS.calc_melting_line(iT, iP, HEOS._p)-1e-3;
// Sometimes the minimum pressure for the melting line is a bit above the triple point pressure
if (HEOS.has_melting_line() && HEOS._p > HEOS.calc_melting_line(iP_min, -1, -1)){
Tmin = HEOS.calc_melting_line(iT, iP, HEOS._p)-1e-3;
}
else{
Tmin = HEOS.Tmin()-1e-3;
@@ -600,7 +601,8 @@ void FlashRoutines::HSU_P_flash(HelmholtzEOSMixtureBackend &HEOS, int other)
case iphase_supercritical:
{
Tmax = HEOS.Tmax()+1;
if (HEOS.has_melting_line()){
// Sometimes the minimum pressure for the melting line is a bit above the triple point pressure
if (HEOS.has_melting_line() && HEOS._p > HEOS.calc_melting_line(iP_min, -1, -1)){
Tmin = HEOS.calc_melting_line(iT, iP, HEOS._p)-1e-3;
}
else{

View File

@@ -206,7 +206,7 @@ long double MeltingLineVariables::evaluate(int OF, int GIVEN, long double value)
return T;
}
}
throw ValueError(format("unable to calculate melting line T(p) for Simon curve for p=%g; bounds are %g,%g Pa", value, pmin, pmax));
throw ValueError(format("unable to calculate melting line T(p) for Simon curve for p=%Lg; bounds are %Lg,%Lg Pa", value, pmin, pmax));
}
else if (type == MELTING_LINE_POLYNOMIAL_IN_TR_TYPE)
{
@@ -239,7 +239,7 @@ long double MeltingLineVariables::evaluate(int OF, int GIVEN, long double value)
return T;
}
}
throw ValueError(format("unable to calculate melting line T(p) for polynomial_in_Theta curve for p=%g; bounds are %g,%g Pa", value, pmin, pmax));
throw ValueError(format("unable to calculate melting line T(p) for polynomial_in_Theta curve for p=%Lg; bounds are %Lg,%Lg Pa", value, pmin, pmax));
}
else if (type == MELTING_LINE_POLYNOMIAL_IN_THETA_TYPE)
{
@@ -274,7 +274,7 @@ long double MeltingLineVariables::evaluate(int OF, int GIVEN, long double value)
}
}
throw ValueError(format("unable to calculate melting line T(p) for polynomial_in_Theta curve for p=%g; bounds are %g,%g Pa", value, pmin, pmax));
throw ValueError(format("unable to calculate melting line T(p) for polynomial_in_Theta curve for p=%Lg; bounds are %Lg,%Lg Pa", value, pmin, pmax));
}
else{
throw ValueError(format("Invalid melting line type T(p) [%d]",type));
@@ -364,6 +364,17 @@ TEST_CASE("Tests for values from melting lines", "[melting]")
CHECK(actual_T < Tmax);
}
}
// See https://groups.google.com/forum/?fromgroups#!topic/catch-forum/mRBKqtTrITU
std::ostringstream ss2;
ss2 << "Ensure melting line valid for " << fluids[i] << " @ EOS pmax";
SECTION(ss2.str(),"")
{
double actual_T;
double EOS_pmax = AS->pmax();
CAPTURE(EOS_pmax);
CHECK_NOTHROW(actual_T = AS->melting_line(iT, iP, EOS_pmax));
CAPTURE(actual_T);
}
}
}
#endif