diff --git a/src/Backends/Tabular/TabularBackends.cpp b/src/Backends/Tabular/TabularBackends.cpp index fc76701e88..ebaed376c6 100644 --- a/src/Backends/Tabular/TabularBackends.cpp +++ b/src/Backends/Tabular/TabularBackends.cpp @@ -120,7 +120,8 @@ void CoolProp::PureFluidSaturationTableData::build(shared_ptrupdate(QT_INPUTS, 0, AS->Ttriple()); + CoolPropDbl Tmin = std::max(AS->Ttriple(), AS->Tmin()); + AS->update(QT_INPUTS, 0, Tmin); CoolPropDbl p_triple = AS->p(); CoolPropDbl p, pmin = p_triple, pmax = 0.9999*AS->p_critical(); for (std::size_t i = 0; i < N-1; ++i) diff --git a/src/Backends/Tabular/TabularBackends.h b/src/Backends/Tabular/TabularBackends.h index 11b74862f9..25624f27ae 100644 --- a/src/Backends/Tabular/TabularBackends.h +++ b/src/Backends/Tabular/TabularBackends.h @@ -292,7 +292,7 @@ class PureFluidSaturationTableData{ */ double first_saturation_deriv(parameters Of1, parameters Wrt1, int Q, double val, std::size_t i) { - if (i < 2 || i > TL.size() - 2){throw ValueError("Invalid index to calc_first_saturation_deriv in TabularBackends");} + if (i < 2 || i > TL.size() - 2){throw ValueError(format("Invalid index (%d) to calc_first_saturation_deriv in TabularBackends",i));} std::vector *x, *y; // Connect pointers for each vector switch(Wrt1){ @@ -517,8 +517,9 @@ class LogPHTable : public SinglePhaseGriddedTableData if (this->AS.get() == NULL){ throw ValueError("AS is not yet set"); } + CoolPropDbl Tmin = std::max(AS->Ttriple(), AS->Tmin()); // Minimum enthalpy is the saturated liquid enthalpy - AS->update(QT_INPUTS, 0, AS->Ttriple()); + AS->update(QT_INPUTS, 0, Tmin); xmin = AS->hmolar(); ymin = AS->p(); // Check both the enthalpies at the Tmax isotherm to see whether to use low or high pressure @@ -562,9 +563,9 @@ class LogPTTable : public SinglePhaseGriddedTableData void set_limits(){ if (this->AS.get() == NULL){ throw ValueError("AS is not yet set"); - } - xmin = AS->Ttriple(); - AS->update(QT_INPUTS, 0, AS->Ttriple()); + } + CoolPropDbl Tmin = std::max(AS->Ttriple(), AS->Tmin()); + AS->update(QT_INPUTS, 0, Tmin); ymin = AS->p(); xmax = AS->Tmax()*1.499; ymax = AS->pmax();