diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index 3b3e34931..4f1fc2ae7 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -765,6 +765,17 @@ public: */ doublereal calculatePsat(doublereal TKelvin, doublereal& molarVolGas, doublereal& molarVolLiquid); + +public: + //! Calculate the saturation pressure at the current mixture content for the given temperature + /*! + * @param TKelvin (input) Temperature (Kelvin) + * @param molarVolGas (return) Molar volume of the gas + * @param molarVolLiquid (return) Molar volume of the liquid + * + * @return Returns the saturation pressure at the given temperature + */ + virtual doublereal satPressure(doublereal TKelvin); protected: //! Calculate the pressure given the temperature and the molar volume diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 09814e76a..ac8cf8d07 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -1278,7 +1278,7 @@ public: /*! * @param t Temperature (Kelvin) */ - virtual doublereal satPressure(doublereal t) const { + virtual doublereal satPressure(doublereal t) { err("satPressure"); return -1.0; } diff --git a/interfaces/matlab/toolbox/@ThermoPhase/calculatePsat.m b/interfaces/matlab/toolbox/@ThermoPhase/calculatePsat.m deleted file mode 100644 index 83efa2624..000000000 --- a/interfaces/matlab/toolbox/@ThermoPhase/calculatePsat.m +++ /dev/null @@ -1,4 +0,0 @@ -function v = calculatePsat(a, T) -% calcPsat - Calculate saturation pressure for temperature T (in K) for a -% fluid with the MFTP thermo model. -v = thermo_get(a.tp_id,26,T); diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index 54f6f0607..e1aaf220c 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -734,7 +734,7 @@ extern "C" { double th_satTemperature(int n, double p) { try { - return ThermoCabinet::get(n).satTemperature(p); + return ThermoCabinet::item(n).satTemperature(p); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -743,7 +743,7 @@ extern "C" { double th_satPressure(int n, double t) { try { - return ThermoCabinet::get(n).satPressure(t); + return ThermoCabinet::item(n).satPressure(t); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -769,18 +769,6 @@ extern "C" { } } - //-------------MFTP Models------------------// - - - double th_calculatePsat(int n, double TKelvin, double molarVolGas, double molarVolLiquid) - { - try { - return ThermoCabinet::get(n).calculatePsat(TKelvin, molarVolGas, molarVolLiquid); - } catch (...) { - return handleAllExceptions(DERR, DERR); - } - } - //-------------- Kinetics ------------------// diff --git a/src/clib/ct.h b/src/clib/ct.h index 86185cdff..324ff21fd 100644 --- a/src/clib/ct.h +++ b/src/clib/ct.h @@ -58,7 +58,6 @@ extern "C" { CANTERA_CAPI double th_cv_mole(int n); CANTERA_CAPI double th_pressure(int n); CANTERA_CAPI int th_setPressure(int n, double p); - CANTERA_CAPI double th_calculatePsat(int n, double TKelvin, double molarVolGas, double molarVolLiquid); CANTERA_CAPI double th_enthalpy_mass(int n); CANTERA_CAPI double th_intEnergy_mass(int n); CANTERA_CAPI double th_entropy_mass(int n); diff --git a/src/matlab/thermomethods.cpp b/src/matlab/thermomethods.cpp index a508eefa0..ec147f235 100644 --- a/src/matlab/thermomethods.cpp +++ b/src/matlab/thermomethods.cpp @@ -175,11 +175,6 @@ static void thermoget(int nlhs, mxArray* plhs[], case 25: vv = th_electricPotential(n); break; - case 26: - double molarVolGas, molarVolLiquid; - TK = getDouble(prhs[3]); - vv = th_calculatePsat(n,TK,molarVolGas,molarVolLiquid); - break; default: ok = false; } diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index f26df034f..e55750795 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -14,6 +14,7 @@ #include "cantera/thermo/VPSSMgr.h" #include "cantera/thermo/PDSS.h" #include "cantera/base/stringUtils.h" +#include "cantera/base/xml.h" using namespace std; @@ -828,6 +829,15 @@ doublereal MixtureFugacityTP::densSpinodalGas() const throw CanteraError("", "unimplmented"); return 0.0; } + +doublereal MixtureFugacityTP::satPressure(doublereal TKelvin) +{ + doublereal molarVolGas; + doublereal molarVolLiquid; + return calculatePsat(TKelvin, molarVolGas, molarVolLiquid); +} + + doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& molarVolGas, doublereal& molarVolLiquid) {