diff --git a/Cantera/src/thermo/PDSS_HKFT.cpp b/Cantera/src/thermo/PDSS_HKFT.cpp index 2bd59bf00..f2975c5fb 100644 --- a/Cantera/src/thermo/PDSS_HKFT.cpp +++ b/Cantera/src/thermo/PDSS_HKFT.cpp @@ -836,6 +836,12 @@ namespace Cantera { return dfac1dT + dfac2dT + dfac3dT; + } else if (ifunc == 3) { + double beta = m_waterSS->isothermalCompressibility(); + + double dgdp = - bfunc * gval * dens * beta / (1.0 - dens); + + return dgdp; } else { throw CanteraError("HKFT_PDSS::gg", "unimplemented"); } diff --git a/Cantera/src/thermo/PDSS_HKFT.h b/Cantera/src/thermo/PDSS_HKFT.h index 35804760a..a169f97e5 100644 --- a/Cantera/src/thermo/PDSS_HKFT.h +++ b/Cantera/src/thermo/PDSS_HKFT.h @@ -431,6 +431,20 @@ namespace Cantera { double ag(const double temp, const int ifunc = 0) const; double bg(const double temp, const int ifunc = 0) const; double g(const double temp, const double pres, const int ifunc = 0) const; + + //! Difference function f appearing in the formulation + /*! + * Function f appearing in the Johnson et al formulation of omega_j + * Eqn. 33 ref + * + * @param temp Temperature kelvin + * @param pres Pressure (pascal) + * @param ifunc parameters specifying the desired information + * - 0 function value + * - 1 derivative wrt temperature + * - 2 2nd derivative wrt temperature + * - 3 derivative wrt pressure + */ double f(const double temp, const double pres, const int ifunc = 0) const; double gstar(const double temp, const double pres, const int ifunc = 0) const; diff --git a/Cantera/src/thermo/PDSS_Water.cpp b/Cantera/src/thermo/PDSS_Water.cpp index 0bc11c0ed..477e20e53 100644 --- a/Cantera/src/thermo/PDSS_Water.cpp +++ b/Cantera/src/thermo/PDSS_Water.cpp @@ -449,7 +449,12 @@ namespace Cantera { doublereal val = (val2 - vald) / 0.04; return val; } - + + doublereal PDSS_Water::isothermalCompressibility() const { + doublereal pres = pressure(); + doublereal val = m_sub->isothermalCompressibility(m_temp, pres); + return val; + } /// critical temperature doublereal PDSS_Water::critTemperature() const { return m_sub->Tcrit(); } @@ -480,7 +485,7 @@ namespace Cantera { setPressure(pres); } - /// saturation pressure + // saturation pressure doublereal PDSS_Water::satPressure(doublereal t){ doublereal pp = m_sub->psat(t); doublereal dens = m_dens; diff --git a/Cantera/src/thermo/PDSS_Water.h b/Cantera/src/thermo/PDSS_Water.h index 90734d398..1607b61e7 100644 --- a/Cantera/src/thermo/PDSS_Water.h +++ b/Cantera/src/thermo/PDSS_Water.h @@ -335,6 +335,19 @@ namespace Cantera { */ virtual doublereal dthermalExpansionCoeffdT() const; + //! Returns the isothermal compressibility. Units: 1/Pa. + /*! + * The isothermal compressibility is defined as + * \f[ + * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T + * \f] + * or + * \f[ + * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T + * \f] + */ + virtual doublereal isothermalCompressibility() const; + /** * @} * @name Miscellaneous properties of the standard state diff --git a/Cantera/src/thermo/ThermoPhase.h b/Cantera/src/thermo/ThermoPhase.h index 7679e18cd..eb1a8ac8d 100755 --- a/Cantera/src/thermo/ThermoPhase.h +++ b/Cantera/src/thermo/ThermoPhase.h @@ -873,6 +873,10 @@ namespace Cantera { * \f[ * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T * \f] + * or + * \f[ + * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T + * \f] */ virtual doublereal isothermalCompressibility() const { err("isothermalCompressibility"); return -1.0; diff --git a/Cantera/src/thermo/WaterSSTP.cpp b/Cantera/src/thermo/WaterSSTP.cpp index 72db00445..dc052a78b 100644 --- a/Cantera/src/thermo/WaterSSTP.cpp +++ b/Cantera/src/thermo/WaterSSTP.cpp @@ -513,7 +513,18 @@ namespace Cantera { doublereal val = m_sub->coeffThermExp(T, pres); return val; } - + + doublereal WaterSSTP::dthermalExpansionCoeffdT() const { + doublereal pres = pressure(); + double T = temperature(); + double tt = T - 0.04; + doublereal vald = m_sub->coeffThermExp(tt, pres); + doublereal val2 = m_sub->coeffThermExp(T, pres); + doublereal val = (val2 - vald) / 0.04; + return val; + } + + // critical temperature doublereal WaterSSTP::critTemperature() const { return m_sub->Tcrit(); } diff --git a/Cantera/src/thermo/WaterSSTP.h b/Cantera/src/thermo/WaterSSTP.h index c2fcbb597..2df13b6e7 100644 --- a/Cantera/src/thermo/WaterSSTP.h +++ b/Cantera/src/thermo/WaterSSTP.h @@ -195,7 +195,15 @@ namespace Cantera { */ virtual doublereal thermalExpansionCoeff() const; - + //! Return the derivative of the volumetric thermal expansion coefficient. Units: 1/K2. + /*! + * The thermal expansion coefficient is defined as + * \f[ + * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P + * \f] + */ + virtual doublereal dthermalExpansionCoeffdT() const; + /** * @} * @name Potential Energy