diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 0768de34cb..62ba66723c 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -821,6 +821,7 @@ class HMWSoln : public MolalityVPSSTP */ virtual double relative_molal_enthalpy() const; + double intEnergy_mole() const override; double cv_mole() const override; //! @} diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 49445ba31a..7c069806cb 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -86,22 +86,6 @@ class IdealMolalSoln : public MolalityVPSSTP return true; } - //! @name Molar Thermodynamic Properties of the Solution - //! @{ - - //! Molar internal energy of the solution: Units: J/kmol. - /*! - * Returns the amount of internal energy per mole of solution. For an ideal - * molal solution, - * @f[ - * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T) - * @f] - * The formula is written in terms of the partial molar internal energy. - * @f$ \bar{u}_k(T, p, m_k) @f$. - */ - double intEnergy_mole() const override; - - //! @} //! @name Mechanical Equation of State Properties //! //! In this equation of state implementation, the density is a function only diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index c222c05ce7..770f96a75e 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -70,6 +70,8 @@ class IdealSolidSolnPhase : public ThermoPhase //! @name Molar Thermodynamic Properties of the Solution //! @{ + double intEnergy_mole() const override; + /** * Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant * partial molar volume solution mixture with pure species phases which diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index 8b8733d381..17e1987cda 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -222,6 +222,8 @@ class LatticePhase : public ThermoPhase */ double enthalpy_mole() const override; + double intEnergy_mole() const override; + //! Molar entropy of the solution. Units: J/kmol/K /*! * For an ideal, constant partial molar volume solution mixture with diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 195ef4483b..4d6c1dacea 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -230,6 +230,7 @@ class MargulesVPSSTP : public GibbsExcessVPSSTP //! @name Molar Thermodynamic Properties //! @{ + double intEnergy_mole() const override; double cv_mole() const override; //! @} diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index 76431d7d95..2d070602b3 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -111,6 +111,7 @@ class MixtureFugacityTP : public ThermoPhase //! @{ double enthalpy_mole() const override; + double intEnergy_mole() const override; double entropy_mole() const override; //! @} diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index c89e7aa5b8..6a691a92a7 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -539,8 +539,19 @@ class ThermoPhase : public Phase } //! Molar internal energy. Units: J/kmol. + /*! + * Returns the amount of internal energy per mole of solution. For an ideal + * molal solution, + * @f[ + * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T) + * @f] + * The formula is written in terms of the partial molar internal energy. + * @f$ \bar{u}_k(T, p, m_k) @f$. + * @relates getPartialMolarIntEnergies + */ virtual double intEnergy_mole() const { - return enthalpy_mole() - pressure()* molarVolume(); + getPartialMolarIntEnergies(m_tmpV.data()); + return mean_X(m_tmpV); } //! Molar entropy. Units: J/kmol/K. diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index d37c6efc68..7e1885663c 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -103,6 +103,11 @@ double HMWSoln::relative_molal_enthalpy() const return L / xuse; } +double HMWSoln::intEnergy_mole() const +{ + return enthalpy_mole() - pressure() * molarVolume(); +} + double HMWSoln::cv_mole() const { double kappa_t = isothermalCompressibility(); diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index 59623f930a..00c5963424 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -45,12 +45,6 @@ IdealMolalSoln::IdealMolalSoln(const string& inputFile, const string& id_) : initThermoFile(inputFile, id_); } -double IdealMolalSoln::intEnergy_mole() const -{ - getPartialMolarIntEnergies(m_tmpV.data()); - return mean_X(m_tmpV); -} - // ------- Mechanical Equation of State Properties ------------------------ double IdealMolalSoln::isothermalCompressibility() const diff --git a/src/thermo/IdealSolidSolnPhase.cpp b/src/thermo/IdealSolidSolnPhase.cpp index d4240f32c7..276757263a 100644 --- a/src/thermo/IdealSolidSolnPhase.cpp +++ b/src/thermo/IdealSolidSolnPhase.cpp @@ -24,6 +24,11 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(const string& inputFile, const string& // Molar Thermodynamic Properties of the Solution +double IdealSolidSolnPhase::intEnergy_mole() const +{ + return enthalpy_mole() - pressure() * molarVolume(); +} + double IdealSolidSolnPhase::entropy_mole() const { return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx()); diff --git a/src/thermo/LatticePhase.cpp b/src/thermo/LatticePhase.cpp index 4061291d88..c88778d4bb 100644 --- a/src/thermo/LatticePhase.cpp +++ b/src/thermo/LatticePhase.cpp @@ -34,6 +34,11 @@ double LatticePhase::entropy_mole() const return GasConstant * (mean_X(entropy_R_ref()) - sum_xlogx()); } +double LatticePhase::intEnergy_mole() const +{ + return enthalpy_mole() - pressure() * molarVolume(); +} + double LatticePhase::gibbs_mole() const { return enthalpy_mole() - temperature() * entropy_mole(); } diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index c9bfa73728..b22ff3d965 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -49,6 +49,11 @@ void MargulesVPSSTP::getChemPotentials(double* mu) const } } +double MargulesVPSSTP::intEnergy_mole() const +{ + return enthalpy_mole() - pressure() * molarVolume(); +} + double MargulesVPSSTP::cv_mole() const { return cp_mole() - GasConstant; diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index 39c1697d95..1f486cfb0b 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -47,6 +47,12 @@ double MixtureFugacityTP::enthalpy_mole() const } +double MixtureFugacityTP::intEnergy_mole() const +{ + return enthalpy_mole() - pressure() * molarVolume(); +} + + double MixtureFugacityTP::entropy_mole() const { double s_ideal = GasConstant * (mean_X(m_s0_R) - sum_xlogx()