From 2c005759b7c2f17f4204f44b77d2f8f767678075 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 23 Jun 2016 17:00:15 -0400 Subject: [PATCH] [Thermo] Combine SpeciesThermo and GeneralSpeciesThermo The new class is named MultiSpeciesThermo, so that (eventually) the name SpeciesThermo can be used for the single-species class SpeciesThermoInterpType. Currently, trivial wrappers for classes named SpeciesThermo and GeneralSpeciesThermo to maintain backwards compatibiity for Cantera 2.3. --- include/cantera/thermo/AdsorbateThermo.h | 7 +- include/cantera/thermo/ConstCpPoly.h | 2 +- include/cantera/thermo/DebyeHuckel.h | 4 +- include/cantera/thermo/GeneralSpeciesThermo.h | 128 +------- include/cantera/thermo/HMWSoln.h | 2 +- include/cantera/thermo/IdealGasPhase.h | 12 +- include/cantera/thermo/IdealMolalSoln.h | 4 +- include/cantera/thermo/IdealSolidSolnPhase.h | 12 +- include/cantera/thermo/LatticePhase.h | 10 +- include/cantera/thermo/LatticeSolidPhase.h | 4 +- include/cantera/thermo/Mu0Poly.h | 7 +- include/cantera/thermo/MultiSpeciesThermo.h | 257 ++++++++++++++++ include/cantera/thermo/Nasa9Poly1.h | 2 +- .../cantera/thermo/Nasa9PolyMultiTempRegion.h | 2 +- include/cantera/thermo/NasaPoly1.h | 4 +- include/cantera/thermo/NasaPoly2.h | 3 +- include/cantera/thermo/PDSS.h | 31 +- include/cantera/thermo/PDSS_HKFT.h | 2 +- include/cantera/thermo/PDSS_IonsFromNeutral.h | 2 +- include/cantera/thermo/PDSS_SSVol.h | 4 +- include/cantera/thermo/ShomatePoly.h | 8 +- include/cantera/thermo/SpeciesThermo.h | 282 +----------------- .../cantera/thermo/SpeciesThermoInterpType.h | 51 +--- include/cantera/thermo/SurfPhase.h | 2 +- include/cantera/thermo/ThermoPhase.h | 8 +- include/cantera/thermo/VPSSMgr.h | 36 ++- include/cantera/thermo/VPSSMgr_ConstVol.h | 6 +- include/cantera/thermo/VPSSMgr_General.h | 10 +- include/cantera/thermo/VPSSMgr_IdealGas.h | 4 +- .../cantera/thermo/VPSSMgr_Water_ConstVol.h | 6 +- include/cantera/thermo/VPSSMgr_Water_HKFT.h | 10 +- include/cantera/thermo/WaterSSTP.h | 6 +- samples/cxx/NASA_coeffs/NASA_coeffs.cpp | 2 +- src/equil/vcs_MultiPhaseEquil.cpp | 2 +- src/thermo/ConstCpPoly.cpp | 2 +- src/thermo/LatticeSolidPhase.cpp | 4 +- src/thermo/Mu0Poly.cpp | 3 +- ...eciesThermo.cpp => MultiSpeciesThermo.cpp} | 89 +++--- src/thermo/Nasa9Poly1.cpp | 2 +- src/thermo/Nasa9PolyMultiTempRegion.cpp | 2 +- src/thermo/PDSS.cpp | 2 +- src/thermo/PDSS_HKFT.cpp | 2 +- src/thermo/PDSS_IonsFromNeutral.cpp | 2 +- src/thermo/SpeciesThermo.cpp | 24 -- src/thermo/SpeciesThermoFactory.cpp | 3 +- src/thermo/ThermoFactory.cpp | 2 +- src/thermo/ThermoPhase.cpp | 16 +- src/thermo/VPSSMgr.cpp | 22 +- src/thermo/VPSSMgrFactory.cpp | 6 +- src/thermo/VPSSMgr_ConstVol.cpp | 2 +- src/thermo/VPSSMgr_General.cpp | 24 +- src/thermo/VPSSMgr_IdealGas.cpp | 4 +- src/thermo/VPSSMgr_Water_ConstVol.cpp | 12 +- src/thermo/VPSSMgr_Water_HKFT.cpp | 21 +- test/thermo/thermoParameterizations.cpp | 3 +- 55 files changed, 497 insertions(+), 682 deletions(-) create mode 100644 include/cantera/thermo/MultiSpeciesThermo.h rename src/thermo/{GeneralSpeciesThermo.cpp => MultiSpeciesThermo.cpp} (70%) delete mode 100644 src/thermo/SpeciesThermo.cpp diff --git a/include/cantera/thermo/AdsorbateThermo.h b/include/cantera/thermo/AdsorbateThermo.h index f2e5f4a77..920438646 100644 --- a/include/cantera/thermo/AdsorbateThermo.h +++ b/include/cantera/thermo/AdsorbateThermo.h @@ -19,10 +19,9 @@ namespace Cantera /** * An adsorbed surface species. * - * This class is designed specifically for use by the class - * GeneralSpeciesThermo. It implements a model for the thermodynamic properties - * of a molecule that can be modeled as a set of independent quantum harmonic - * oscillators. + * This class is designed specifically for use by the class MultiSpeciesThermo. + * It implements a model for the thermodynamic properties of a molecule that can + * be modeled as a set of independent quantum harmonic oscillators. * * @ingroup spthermo */ diff --git a/include/cantera/thermo/ConstCpPoly.h b/include/cantera/thermo/ConstCpPoly.h index 55bc2f776..9b400f315 100644 --- a/include/cantera/thermo/ConstCpPoly.h +++ b/include/cantera/thermo/ConstCpPoly.h @@ -87,7 +87,7 @@ public: doublereal* const coeffs) const; //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs); virtual doublereal reportHf298(doublereal* const h298 = 0) const; diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index 7b7936de6..6f22e3b57 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -611,7 +611,7 @@ public: * species thermodynamic * property manager. The pure species entropies are independent of * temperature since the volume expansivities are equal to zero. - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal entropy_mole() const; @@ -783,7 +783,7 @@ public: * reference pressure, \f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param sbar Output vector of species partial molar entropies. * Length = m_kk. units are J/kmol/K. diff --git a/include/cantera/thermo/GeneralSpeciesThermo.h b/include/cantera/thermo/GeneralSpeciesThermo.h index 49ff1857c..00f17ec95 100644 --- a/include/cantera/thermo/GeneralSpeciesThermo.h +++ b/include/cantera/thermo/GeneralSpeciesThermo.h @@ -1,127 +1,27 @@ /** - * @file GeneralSpeciesThermo.h - * Headers for a completely general species thermodynamic property - * manager for a phase (see \ref mgrsrefcalc and - * \link Cantera::GeneralSpeciesThermo GeneralSpeciesThermo\endlink). - * - * Because it is general, it is slow. + * @file GeneralSpeciesThermo.h + * @deprecated To be removed after Cantera 2.3. */ + #ifndef CT_GENERALSPECIESTHERMO_H #define CT_GENERALSPECIESTHERMO_H -#include "SpeciesThermo.h" -#include "SpeciesThermoInterpType.h" +#pragma message "Deprecated. GeneralSpeciesThermo.h will be removed after Cantera 2.3. Use MultiSpeciesThermo.h instead." + +#include "cantera/base/ct_defs.h" +#include "MultiSpeciesThermo.h" namespace Cantera { -//! A species thermodynamic property manager for a phase. -/*! - * This is a general manager that can handle a wide variety of species - * thermodynamic polynomials for individual species. It is slow, however, - * because it recomputes the functions of temperature needed for each species. - * What it does is to create a vector of SpeciesThermoInterpType objects. - * - * @ingroup mgrsrefcalc - */ -class GeneralSpeciesThermo : public SpeciesThermo +//! @deprecated To be removed after Cantera 2.3. Use class MultiSpeciesThermo +//! instead. +class GeneralSpeciesThermo : public MultiSpeciesThermo { -public: - //! Constructor - GeneralSpeciesThermo(); - - GeneralSpeciesThermo(const GeneralSpeciesThermo& b); - GeneralSpeciesThermo& operator=(const GeneralSpeciesThermo& b); - virtual SpeciesThermo* duplMyselfAsSpeciesThermo() const; - - virtual void install_STIT(size_t index, - shared_ptr stit_ptr); - - virtual void modifySpecies(size_t index, - shared_ptr stit_ptr); - - //! Install a PDSS object to handle the reference state thermodynamics - //! calculation - /*! - * @param k species index - * @param PDSS_ptr Pressure dependent standard state (PDSS) object - * that will handle the reference state calc - * @param vpssmgr_ptr Pointer to the variable pressure standard state - * manager that handles the PDSS object. - */ - void installPDSShandler(size_t k, PDSS* PDSS_ptr, VPSSMgr* vpssmgr_ptr); - - //! Like update(), but only updates the single species k. - /*! - * @param k species index - * @param T Temperature (Kelvin) - * @param cp_R Vector of Dimensionless heat capacities. (length m_kk). - * @param h_RT Vector of Dimensionless enthalpies. (length m_kk). - * @param s_R Vector of Dimensionless entropies. (length m_kk). - */ - virtual void update_one(size_t k, doublereal T, doublereal* cp_R, - doublereal* h_RT, - doublereal* s_R) const; - - virtual void update(doublereal T, doublereal* cp_R, - doublereal* h_RT, doublereal* s_R) const; - - virtual doublereal minTemp(size_t k=npos) const; - virtual doublereal maxTemp(size_t k=npos) const; - virtual doublereal refPressure(size_t k=npos) const; - virtual int reportType(size_t index) const; - - virtual void reportParams(size_t index, int& type, - doublereal* const c, - doublereal& minTemp, - doublereal& maxTemp, - doublereal& refPressure) const; - - virtual doublereal reportOneHf298(const size_t k) const; - - virtual void modifyOneHf298(const size_t k, const doublereal Hf298New); - virtual void resetHf298(const size_t k); - -private: - //! Provide the SpeciesthermoInterpType object - /*! - * @param k species index - * @return pointer to the SpeciesThermoInterpType object. - */ - SpeciesThermoInterpType* provideSTIT(size_t k); - const SpeciesThermoInterpType* provideSTIT(size_t k) const; - -protected: - typedef std::pair > index_STIT; - typedef std::map > STIT_map; - typedef std::map tpoly_map; - - //! This is the main data structure, which contains the - //! SpeciesThermoInterpType objects, sorted by the parameterization type. - //! `m_sp[i]` is the vector of [species index, STIT] pairs which use - //! parameterization `i`. - STIT_map m_sp; - - //! Temperature polynomials for each thermo parameterization - mutable tpoly_map m_tpoly; - - //! Map from species index to location within #m_sp, such that - //! `m_sp[m_speciesLoc[k].first][m_speciesLoc[k].second]` is the - //! SpeciesThermoInterpType object for species `k`. - std::map > m_speciesLoc; - - //! Maximum value of the lowest temperature - doublereal m_tlow_max; - - //! Minimum value of the highest temperature - doublereal m_thigh_min; - - //! reference pressure (Pa) - doublereal m_p0; - - //! Make the class VPSSMgr a friend because we need to access the function - //! provideSTIT() - friend class VPSSMgr; + GeneralSpeciesThermo() { + warn_deprecated("class GeneralSpeciesThermo", "To be removed after" + " Cantera 2.3. Use class MultiSpeciesThermo instead."); + } }; } diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 1e9d3a3b2..cb039a803 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -1258,7 +1258,7 @@ public: * are computed by the species thermodynamic property manager. The pure * species entropies are independent of temperature since the volume * expansivities are equal to zero. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * (HKM -> Bump up to Parent object) */ diff --git a/include/cantera/thermo/IdealGasPhase.h b/include/cantera/thermo/IdealGasPhase.h index b552ebdcc..f945d1dd4 100644 --- a/include/cantera/thermo/IdealGasPhase.h +++ b/include/cantera/thermo/IdealGasPhase.h @@ -33,8 +33,8 @@ namespace Cantera * It is assumed that the reference state thermodynamics may be obtained by a * pointer to a populated species thermodynamic property manager class in the * base class, ThermoPhase::m_spthermo (see the base class \link - * Cantera#SpeciesThermo SpeciesThermo \endlink for a description of the - * specification of reference state species thermodynamics functions). The + * Cantera::MultiSpeciesThermo MultiSpeciesThermo \endlink for a description of + * the specification of reference state species thermodynamics functions). The * reference state, where the pressure is fixed at a single pressure, is a key * species property calculation for the Ideal Gas Equation of state. * @@ -44,7 +44,7 @@ namespace Cantera * internal reference state functions, the function #_updateThermo() is called, * that first checks to see whether the temperature has changed. If it has, it * updates the internal reference state thermo functions by calling the - * SpeciesThermo object. + * MultiSpeciesThermo object. * * Functions for the calculation of standard state properties for species at * arbitrary pressure are provided in IdealGasPhase. However, they are all @@ -333,7 +333,7 @@ public: * enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species * thermodynamic property manager. * - * \see SpeciesThermo + * \see MultiSpeciesThermo */ virtual doublereal enthalpy_mole() const { return RT() * mean_X(enthalpy_RT_ref()); @@ -347,7 +347,7 @@ public: * \f] * The reference-state pure-species entropies \f$ \hat s^0_k(T) \f$ are * computed by the species thermodynamic property manager. - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal entropy_mole() const; @@ -359,7 +359,7 @@ public: * \f] * The reference-state pure-species heat capacities \f$ \hat c^0_{p,k}(T) \f$ * are computed by the species thermodynamic property manager. - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal cp_mole() const; diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 747cfd3bd..616f3af01 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -342,7 +342,7 @@ public: * at the reference pressure,\f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param hbar Output vector of partial molar enthalpies. * Length: m_kk. @@ -372,7 +372,7 @@ public: * s^0_k(T) \f$, at the reference pressure, \f$ P_{ref} \f$, are computed by * the species thermodynamic property manager. They are polynomial functions * of temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param sbar Output vector of partial molar entropies. * Length: m_kk. diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index de87f8f73..df9ae701b 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -115,7 +115,7 @@ public: * The reference-state pure-species enthalpies at the reference pressure Pref * \f$ \hat h^0_k(T) \f$, are computed by the species thermodynamic * property manager. They are polynomial functions of temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal enthalpy_mole() const; @@ -130,7 +130,7 @@ public: * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic * property manager. The pure species entropies are independent of * pressure since the volume expansivities are equal to zero. - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal entropy_mole() const; @@ -145,7 +145,7 @@ public: * \f$ \hat g^0_k(T) \f$ are computed by the species thermodynamic * property manager, while the standard state Gibbs free energies * \f$ \hat g^0_k(T,P) \f$ are computed by the member function, gibbs_RT(). - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal gibbs_mole() const; @@ -160,7 +160,7 @@ public: * The heat capacity is independent of pressure. The reference-state pure- * species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the * species thermodynamic property manager. - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal cp_mole() const; @@ -399,7 +399,7 @@ public: * at the reference pressure,\f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param hbar Output vector containing partial molar enthalpies. * Length: m_kk. @@ -418,7 +418,7 @@ public: * the reference pressure, \f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param sbar Output vector containing partial molar entropies. * Length: m_kk. diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index 18c5f4235..8d79fdecb 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -272,7 +272,7 @@ public: * computed first by the species reference state thermodynamic property * manager and then a small pressure dependent term is added in. * - * \see SpeciesThermo + * \see MultiSpeciesThermo */ virtual doublereal enthalpy_mole() const; @@ -290,7 +290,7 @@ public: * * Units: J/kmol/K. * - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal entropy_mole() const; @@ -306,7 +306,7 @@ public: * species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the * species thermodynamic property manager. * - * @see SpeciesThermo + * @see MultiSpeciesThermo */ virtual doublereal cp_mole() const; @@ -443,7 +443,7 @@ public: * at the reference pressure,\f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param hbar Output vector containing partial molar enthalpies. * Length: m_kk. @@ -462,7 +462,7 @@ public: * the reference pressure, \f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param sbar Output vector containing partial molar entropies. * Length: m_kk. diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index 55c56de86..cba300a6c 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -342,7 +342,7 @@ public: * at the reference pressure,\f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param hbar Output vector containing partial molar enthalpies. * Length: m_kk. @@ -361,7 +361,7 @@ public: * the reference pressure, \f$ P_{ref} \f$, are computed by the species * thermodynamic property manager. They are polynomial functions of * temperature. - * @see SpeciesThermo + * @see MultiSpeciesThermo * * @param sbar Output vector containing partial molar entropies. * Length: m_kk. diff --git a/include/cantera/thermo/Mu0Poly.h b/include/cantera/thermo/Mu0Poly.h index 889422ee4..1b97a5c69 100644 --- a/include/cantera/thermo/Mu0Poly.h +++ b/include/cantera/thermo/Mu0Poly.h @@ -12,7 +12,6 @@ namespace Cantera { -class SpeciesThermo; class XML_Node; //! The Mu0Poly class implements an interpolation of the Gibbs free energy based @@ -126,7 +125,7 @@ public: doublereal* const coeffs) const; //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs); protected: @@ -177,8 +176,8 @@ private: //! Install a Mu0 polynomial thermodynamic reference state /*! * Install a Mu0 polynomial thermodynamic reference state property - * parameterization for species k into a SpeciesThermo instance, getting the - * information from an XML database. + * parameterization for species k into a MultiSpeciesThermo instance, getting + * the information from an XML database. * * @param Mu0Node Pointer to the XML element containing the Mu0 information. * diff --git a/include/cantera/thermo/MultiSpeciesThermo.h b/include/cantera/thermo/MultiSpeciesThermo.h new file mode 100644 index 000000000..7d27cc4a2 --- /dev/null +++ b/include/cantera/thermo/MultiSpeciesThermo.h @@ -0,0 +1,257 @@ +/** + * @file MultiSpeciesThermo.h + * Header for a general species thermodynamic property manager for a phase (see + * \link Cantera::MultiSpeciesThermo MultiSpeciesThermo\endlink). + */ +#ifndef CT_MULTISPECIESTHERMO_H +#define CT_MULTISPECIESTHERMO_H + +#include "SpeciesThermoInterpType.h" + +namespace Cantera +{ + +//! A species thermodynamic property manager for a phase. +/*! + * This is a general manager that can handle a wide variety of species + * thermodynamic polynomials for individual species and compute their + * nondimensional, reference-state thermodynamic properties (i.e. as a function + * of temperature only). + * + * The ThermoPhase object relies on MultiSpeciesThermo to calculate the + * thermodynamic properties of the reference state for all of the species in the + * phase, for a range of temperatures. Note, the pressure dependence of the + * species thermodynamic functions is not handled at this level. Species using + * the same parameterization are grouped together in order to minimize the + * operation count and achieve better efficiency. + * + * The most important member function for the MultiSpeciesThermo class is the + * member function MultiSpeciesThermo::update(). The function calculates the + * values of Cp/R, H/RT, and S/R for all of the species at once at the specified + * temperature. + * + * Usually, all of the species in a phase are installed into a + * MultiSpeciesThermo object. However, there is no requirement that a + * MultiSpeciesThermo object handles all of the species in a phase. The member + * function + * \link MultiSpeciesThermo::install_STIT() install_STIT()\endlink + * is called to install each species into the MultiSpeciesThermo object. + * + * @ingroup spthermo + */ +class MultiSpeciesThermo +{ +public: + //! Constructor + MultiSpeciesThermo(); + + MultiSpeciesThermo(const MultiSpeciesThermo& b); + MultiSpeciesThermo& operator=(const MultiSpeciesThermo& b); + virtual ~MultiSpeciesThermo() {} + + //! Duplication routine for objects derived from MultiSpeciesThermo + /*! + * This function can be used to duplicate objects derived from + * MultiSpeciesThermo even if the application only has a pointer to + * MultiSpeciesThermo to work with. + * @deprecated To be removed after Cantera 2.3. + */ + virtual MultiSpeciesThermo* duplMyselfAsSpeciesThermo() const; + + //! Install a new species thermodynamic property parameterization for one + //! species. + /*! + * @param index Index of the species being installed + * @param stit Pointer to the SpeciesThermoInterpType object + * This will set up the thermo for one species + */ + virtual void install_STIT(size_t index, + shared_ptr stit_ptr); + + //! Modify the species thermodynamic property parameterization for a species + /*! + * @param index Index of the species being installed + * @param spec Pointer to the SpeciesThermoInterpType object + */ + virtual void modifySpecies(size_t index, + shared_ptr stit_ptr); + + //! Install a PDSS object to handle the reference state thermodynamics + //! calculation + /*! + * @param k species index + * @param PDSS_ptr Pressure dependent standard state (PDSS) object + * that will handle the reference state calc + * @param vpssmgr_ptr Pointer to the variable pressure standard state + * manager that handles the PDSS object. + */ + void installPDSShandler(size_t k, PDSS* PDSS_ptr, VPSSMgr* vpssmgr_ptr); + + //! Like update(), but only updates the single species k. + /*! + * @param k species index + * @param T Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. (length m_kk). + * @param s_R Vector of Dimensionless entropies. (length m_kk). + */ + virtual void update_one(size_t k, doublereal T, doublereal* cp_R, + doublereal* h_RT, + doublereal* s_R) const; + + //! Compute the reference-state properties for all species. + /*! + * Given temperature T in K, this method updates the values of the non- + * dimensional heat capacity at constant pressure, enthalpy, and entropy, + * at the reference pressure, Pref of each of the standard states. + * + * @param T Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. (length m_kk). + * @param s_R Vector of Dimensionless entropies. (length m_kk). + */ + virtual void update(doublereal T, doublereal* cp_R, + doublereal* h_RT, doublereal* s_R) const; + + //! Minimum temperature. + /*! + * If no argument is supplied, this method returns the minimum temperature + * for which \e all parameterizations are valid. If an integer index k is + * supplied, then the value returned is the minimum temperature for + * species k in the phase. + * + * @param k Species index + */ + virtual doublereal minTemp(size_t k=npos) const; + + //! Maximum temperature. + /*! + * If no argument is supplied, this method returns the maximum temperature + * for which \e all parameterizations are valid. If an integer index k is + * supplied, then the value returned is the maximum temperature for + * parameterization k. + * + * @param k Species Index + */ + virtual doublereal maxTemp(size_t k=npos) const; + + //! The reference-state pressure for species k. + /*! + * Returns the reference state pressure in Pascals for species k. If k is + * left out of the argument list, it returns the reference state pressure + * for the first species. + * + * @param k Species Index + */ + virtual doublereal refPressure(size_t k=npos) const; + + //! This utility function reports the type of parameterization used for the + //! species with index number *index*. + /*! + * @param index Species index + */ + virtual int reportType(size_t index) const; + + //! This utility function reports back the type of parameterization and + //! all of the parameters for the species with index number *index*. + /*! + * @param index Species index + * @param type Integer type of the standard type + * @param c Vector of coefficients used to set the + * parameters for the standard state. + * @param minTemp output - Minimum temperature + * @param maxTemp output - Maximum temperature + * @param refPressure output - reference pressure (Pa). + */ + virtual void reportParams(size_t index, int& type, + doublereal* const c, + doublereal& minTemp, + doublereal& maxTemp, + doublereal& refPressure) const; + + //! Report the 298 K Heat of Formation of the standard state of one species + //! (J kmol-1) + /*! + * The 298K Heat of Formation is defined as the enthalpy change to create + * the standard state of the species from its constituent elements in their + * standard states at 298 K and 1 bar. + * + * @param k species index + * @returns the current value of the Heat of Formation at 298K and 1 bar + */ + virtual doublereal reportOneHf298(const size_t k) const; + + //! Modify the value of the 298 K Heat of Formation of the standard state of + //! one species in the phase (J kmol-1) + /*! + * The 298K heat of formation is defined as the enthalpy change to create + * the standard state of the species from its constituent elements in their + * standard states at 298 K and 1 bar. + * + * @param k Index of the species + * @param Hf298New Specify the new value of the Heat of Formation at + * 298K and 1 bar. units = J/kmol. + */ + virtual void modifyOneHf298(const size_t k, const doublereal Hf298New); + + //! Restore the original heat of formation of one or more species + /*! + * Resets changes made by modifyOneHf298(). If the species index is not + * specified, the heats of formation for all species are restored. + */ + virtual void resetHf298(const size_t k); + + //! Check if data for all species (0 through nSpecies-1) has been installed. + bool ready(size_t nSpecies); + +private: + //! Provide the SpeciesthermoInterpType object + /*! + * @param k species index + * @return pointer to the SpeciesThermoInterpType object. + */ + SpeciesThermoInterpType* provideSTIT(size_t k); + const SpeciesThermoInterpType* provideSTIT(size_t k) const; + +protected: + //! Mark species *k* as having its thermodynamic data installed + void markInstalled(size_t k); + + typedef std::pair > index_STIT; + typedef std::map > STIT_map; + typedef std::map tpoly_map; + + //! This is the main data structure, which contains the + //! SpeciesThermoInterpType objects, sorted by the parameterization type. + //! `m_sp[i]` is the vector of [species index, STIT] pairs which use + //! parameterization `i`. + STIT_map m_sp; + + //! Temperature polynomials for each thermo parameterization + mutable tpoly_map m_tpoly; + + //! Map from species index to location within #m_sp, such that + //! `m_sp[m_speciesLoc[k].first][m_speciesLoc[k].second]` is the + //! SpeciesThermoInterpType object for species `k`. + std::map > m_speciesLoc; + + //! Maximum value of the lowest temperature + doublereal m_tlow_max; + + //! Minimum value of the highest temperature + doublereal m_thigh_min; + + //! reference pressure (Pa) + doublereal m_p0; + + //! indicates if data for species has been installed + std::vector m_installed; + + //! Make the class VPSSMgr a friend because we need to access the function + //! provideSTIT() + friend class VPSSMgr; +}; + +} + +#endif diff --git a/include/cantera/thermo/Nasa9Poly1.h b/include/cantera/thermo/Nasa9Poly1.h index c414648b9..4f32ce9e4 100644 --- a/include/cantera/thermo/Nasa9Poly1.h +++ b/include/cantera/thermo/Nasa9Poly1.h @@ -128,7 +128,7 @@ public: doublereal* const coeffs) const; //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs); protected: diff --git a/include/cantera/thermo/Nasa9PolyMultiTempRegion.h b/include/cantera/thermo/Nasa9PolyMultiTempRegion.h index 6b33b31dc..e39897732 100644 --- a/include/cantera/thermo/Nasa9PolyMultiTempRegion.h +++ b/include/cantera/thermo/Nasa9PolyMultiTempRegion.h @@ -97,7 +97,7 @@ public: doublereal* const coeffs) const; //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs); protected: diff --git a/include/cantera/thermo/NasaPoly1.h b/include/cantera/thermo/NasaPoly1.h index 3f3f37314..10ad1f515 100644 --- a/include/cantera/thermo/NasaPoly1.h +++ b/include/cantera/thermo/NasaPoly1.h @@ -139,10 +139,10 @@ public: } //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs) { warn_deprecated("NasaPoly1::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); std::copy(coeffs, coeffs+7, m_coeff.begin()); } diff --git a/include/cantera/thermo/NasaPoly2.h b/include/cantera/thermo/NasaPoly2.h index 9339134dd..15f1b5d28 100644 --- a/include/cantera/thermo/NasaPoly2.h +++ b/include/cantera/thermo/NasaPoly2.h @@ -39,8 +39,7 @@ namespace Cantera * + \frac{a_3}{3} T^3 + \frac{a_4}{4} T^4 + a_6. * \f] * - * This class is designed specifically for use by the class - * GeneralSpeciesThermo. + * This class is designed specifically for use by the class MultiSpeciesThermo. * * @ingroup spthermo */ diff --git a/include/cantera/thermo/PDSS.h b/include/cantera/thermo/PDSS.h index da87bb87f..6693bfd19 100644 --- a/include/cantera/thermo/PDSS.h +++ b/include/cantera/thermo/PDSS.h @@ -112,10 +112,10 @@ namespace Cantera * on its own determination/knowledge for how to calculate thermo quantities * quickly given what it knows about the PDSS objects under its control. * - * The PDSS objects may or may not utilize the SpeciesThermo reference state + * The PDSS objects may or may not utilize the MultiSpeciesThermo reference state * manager class to calculate the reference state thermodynamics functions in * its own calculation. There are some classes, such as PDSS_IdealGas and - * PDSS+_ConstVol, which utilize the SpeciesThermo object because the + * PDSS+_ConstVol, which utilize the MultiSpeciesThermo object because the * calculation is very similar to the reference state calculation, while there * are other classes, PDSS_Water and PDSS_HKFT, which don't utilize the * reference state calculation at all, because it wouldn't make sense to. For @@ -127,17 +127,18 @@ namespace Cantera * situations where the liquid is unstable, i.e., beyond the spinodal curve * leading to potentially wrong evaluation results. * - * For cases where the PDSS object doesn't use the SpeciesThermo object, a dummy - * SpeciesThermoInterpType object is actually installed into the SpeciesThermo - * object for that species. This dummy SpeciesThermoInterpType object is called - * a STITbyPDSS object. This object satisfies calls to SpeciesThermo member - * functions by actually calling the PDSS object at the reference pressure. + * For cases where the PDSS object doesn't use the MultiSpeciesThermo object, a + * dummy SpeciesThermoInterpType object is actually installed into the + * MultiSpeciesThermo object for that species. This dummy + * SpeciesThermoInterpType object is called a STITbyPDSS object. This object + * satisfies calls to MultiSpeciesThermo member functions by actually calling + * the PDSS object at the reference pressure. * * @ingroup thermoprops */ class XML_Node; -class SpeciesThermo; +class MultiSpeciesThermo; class VPStandardStateTP; class VPSSMgr; @@ -149,7 +150,7 @@ class VPSSMgr; * Class PDSS is the base class for a family of classes that compute * properties of a set of species in their standard states at a range of * temperatures and pressures. The independent variables for this object are - * temperature and pressure. The class may have a reference to a SpeciesThermo + * temperature and pressure. The class may have a reference to a MultiSpeciesThermo * object which handles the calculation of the reference state temperature * behavior of a subset of species. * @@ -164,9 +165,9 @@ class VPSSMgr; * * These classes are designed such that they are not thread safe when called by * themselves. The reason for this is that they sometimes use shared - * SpeciesThermo resources where they set the states. This condition may be + * MultiSpeciesThermo resources where they set the states. This condition may be * remedied in the future if we get serious about employing multithreaded - * capabilities by adding mutex locks to the SpeciesThermo resources. + * capabilities by adding mutex locks to the MultiSpeciesThermo resources. * * However, in many other respects they can be thread safe. They use separate * memory and hold intermediate data. @@ -515,12 +516,12 @@ public: * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object * @param vpssmgr_ptr Pointer to the variable pressure standard state * calculator for this phase - * @param spthermo_ptr Pointer to the optional SpeciesThermo object + * @param spthermo_ptr Pointer to the optional MultiSpeciesThermo object * that will handle the calculation of the reference * state thermodynamic coefficients. */ virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr, - SpeciesThermo* spthermo_ptr); + MultiSpeciesThermo* spthermo_ptr); //@} protected: @@ -562,11 +563,11 @@ protected: //! Pointer to the species thermodynamic property manager. /*! * This is a copy of the pointer in the ThermoPhase object. Note, this - * object doesn't own the pointer. If the SpeciesThermo ThermoPhase object + * object doesn't own the pointer. If the MultiSpeciesThermo object * doesn't know or doesn't control the calculation, this will be set to * zero. */ - SpeciesThermo* m_spthermo; + MultiSpeciesThermo* m_spthermo; //! Reference state enthalpy divided by RT. /*! diff --git a/include/cantera/thermo/PDSS_HKFT.h b/include/cantera/thermo/PDSS_HKFT.h index b90e1f133..509c13eeb 100644 --- a/include/cantera/thermo/PDSS_HKFT.h +++ b/include/cantera/thermo/PDSS_HKFT.h @@ -168,7 +168,7 @@ public: const XML_Node& phaseNode, bool spInstalled); virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr, - SpeciesThermo* spthermo_ptr); + MultiSpeciesThermo* spthermo_ptr); //! This utility function reports back the type of parameterization and //! all of the parameters for the species, index. diff --git a/include/cantera/thermo/PDSS_IonsFromNeutral.h b/include/cantera/thermo/PDSS_IonsFromNeutral.h index 6a6963d34..845a3a8d6 100644 --- a/include/cantera/thermo/PDSS_IonsFromNeutral.h +++ b/include/cantera/thermo/PDSS_IonsFromNeutral.h @@ -73,7 +73,7 @@ public: PDSS_IonsFromNeutral& operator=(const PDSS_IonsFromNeutral& b); virtual PDSS* duplMyselfAsPDSS() const; virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr, - SpeciesThermo* spthermo_ptr); + MultiSpeciesThermo* spthermo_ptr); //! @} //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution diff --git a/include/cantera/thermo/PDSS_SSVol.h b/include/cantera/thermo/PDSS_SSVol.h index 64c293490..09c5d71ed 100644 --- a/include/cantera/thermo/PDSS_SSVol.h +++ b/include/cantera/thermo/PDSS_SSVol.h @@ -66,7 +66,7 @@ namespace Cantera * G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P) * \f] * - * The enthalpy is calculated mostly from the SpeciesThermo object's enthalpy + * The enthalpy is calculated mostly from the MultiSpeciesThermo object's enthalpy * evaluator. The dependence on pressure originates from the Maxwell relation * * \f[ @@ -78,7 +78,7 @@ namespace Cantera * {\left(\frac{dH^o_k}{dP}\right)}_T = V^o_k - T {\left(\frac{dV^o_k}{dT}\right)}_P * \f] * - * The entropy is calculated mostly from the SpeciesThermo objects entropy + * The entropy is calculated mostly from the MultiSpeciesThermo objects entropy * evaluator. The dependence on pressure originates from the Maxwell relation: * * \f[ diff --git a/include/cantera/thermo/ShomatePoly.h b/include/cantera/thermo/ShomatePoly.h index 86c5c8103..5f55a32d8 100644 --- a/include/cantera/thermo/ShomatePoly.h +++ b/include/cantera/thermo/ShomatePoly.h @@ -155,10 +155,10 @@ public: } //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs) { warn_deprecated("ShomatePoly::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); for (size_t i = 0; i < 7; i++) { m_coeff[i] = coeffs[i] * 1000 / GasConstant; } @@ -316,11 +316,11 @@ public: * @param coeffs Vector of coefficients used to set the * parameters for the standard state. * @deprecated To be removed after Cantera 2.3. Use - * SpeciesThermo::modifySpecies instead. + * MultiSpeciesThermo::modifySpecies instead. */ virtual void modifyParameters(doublereal* coeffs) { warn_deprecated("ShomatePoly2::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); std::copy(coeffs, coeffs + 15, m_coeff.begin()); m_midT = coeffs[0]; msp_low = ShomatePoly(m_lowT, m_midT, m_Pref, coeffs+1); diff --git a/include/cantera/thermo/SpeciesThermo.h b/include/cantera/thermo/SpeciesThermo.h index 00675cb29..56921914b 100644 --- a/include/cantera/thermo/SpeciesThermo.h +++ b/include/cantera/thermo/SpeciesThermo.h @@ -1,289 +1,29 @@ /** * @file SpeciesThermo.h - * Virtual base class for the calculation of multiple-species thermodynamic - * reference-state property managers and text for the mgrsrefcalc module (see \ref mgrsrefcalc - * and class \link Cantera::SpeciesThermo SpeciesThermo\endlink). + * @deprecated To be removed after Cantera 2.3. */ -// Copyright 2001 California Institute of Technology #ifndef CT_SPECIESTHERMO_H #define CT_SPECIESTHERMO_H +#pragma message "Deprecated. SpeciesThermo.h will be removed after Cantera 2.3. Use MultiSpeciesThermo.h instead." + #include "cantera/base/ct_defs.h" +#include "MultiSpeciesThermo.h" namespace Cantera { -class SpeciesThermoInterpType; -/** - * @defgroup mgrsrefcalc Managers for Calculating Reference-State Thermodynamics - * - * The ThermoPhase object relies on a set of manager classes to calculate the - * thermodynamic properties of the reference state for all of the species in the - * phase. This may be a computationally significant cost, so efficiency is - * important. This group describes how this is done efficiently within Cantera. - * - * To compute the thermodynamic properties of multicomponent solutions, it is - * necessary to know something about the thermodynamic properties of the - * individual species present in the solution. Exactly what sort of species - * properties are required depends on the thermodynamic model for the solution. - * For a gaseous solution (i.e., a gas mixture), the species properties required - * are usually ideal gas properties at the mixture temperature and at a - * reference pressure (almost always at 1 bar). - * - * In defining these standard states for species in a phase, we make the - * following definition. A reference state is a standard state of a species in a - * phase limited to one particular pressure, the reference pressure. The - * reference state specifies the dependence of all thermodynamic functions as a - * function of the temperature, in between a minimum temperature and a maximum - * temperature. The reference state also specifies the molar volume of the - * species as a function of temperature. The molar volume is a thermodynamic - * function. By contrast, a full standard state does the same thing as a - * reference state, but specifies the thermodynamics functions at all pressures. - * - * Whatever the conventions used by a particular solution model, means need to - * be provided to compute the species properties in the reference state. Class - * SpeciesThermo is the base class for a family of classes that compute - * properties of all species in a phase in their reference states, for a range - * of temperatures. Note, the pressure dependence of the species thermodynamic - * functions is not handled by this particular species thermodynamic model. - * SpeciesThermo calculates the reference-state thermodynamic values of all - * species in a single phase during each call. The vector nature of the - * operation leads to a lower operation count and better efficiency, especially - * if the individual reference state classes are known to the reference-state - * manager class so that common operations may be grouped together. - * - * The most important member function for the SpeciesThermo class is the member - * function \link SpeciesThermo::update() update()\endlink. The function - * calculates the values of Cp, H, and S for all of the species at once at the - * specified temperature. - * - * Usually, all of the species in a phase are installed into a SpeciesThermo - * class. However, there is no requirement that a SpeciesThermo object handles - * all of the species in a phase. The member function - * \link SpeciesThermo::install_STIT() install_STIT()\endlink - * is called to install each species into the SpeciesThermo object. - * - * The following classes inherit from SpeciesThermo. Each of these classes - * handle multiple species, usually all of the species in a phase. However, - * there is no requirement that a SpeciesThermo object handles all of the - * species in a phase. - * - * - GeneralSpeciesThermo in file GeneralSpeciesThermo.h - * - This is a general model. Each species is handled separately - * via a vector over SpeciesThermoInterpType classes. - * - * The class SpeciesThermoInterpType is a pure virtual base class for - * calculation of thermodynamic functions for a single species in its reference - * state. The following classes inherit from SpeciesThermoInterpType. - * - * - NasaPoly1 in file NasaPoly1.h - * - This is a one zone model, consisting of a 7 coefficient NASA Polynomial - * format. - * - NasaPoly2 in file NasaPoly2.h - * - This is a two zone model, with each zone consisting of a 7 coefficient - * NASA Polynomial format. - * - ShomatePoly in file ShomatePoly.h - * - This is a one zone model, consisting of a 7 coefficient Shomate - * Polynomial format. - * - ShomatePoly2 in file ShomatePoly.h - * - This is a two zone model, with each zone consisting of a 7 coefficient - * Shomate Polynomial format. - * - ConstCpPoly in file ConstCpPoly.h - * - This is a one-zone constant heat capacity model. - * - Mu0Poly in file Mu0Poly.h - * - This is a multi-zone model. The chemical potential is given at a set - * number of temperatures. Between each temperature the heat capacity is - * treated as a constant. - * - Nasa9Poly1 in file Nasa9Poly1.h - * - This is a one zone model, consisting of the 9 coefficient NASA - * Polynomial format. - * - Nasa9PolyMultiTempRegion in file Nasa9PolyMultiTempRegion.h - * - This is a multiple zone model, consisting of the 9 coefficient NASA - * Polynomial format in each zone. - * - * The GeneralSpeciesThermo SpeciesThermo object is completely general. It does - * not try to coordinate the individual species calculations at all and - * therefore is the slowest but most general implementation. - * - * @ingroup thermoprops - */ -//@{ - -//! Pure Virtual base class for the species thermo manager classes. -/*! - * This class defines the interface which all subclasses must implement. - * - * Class SpeciesThermo is the base class for a family of classes that compute - * properties of a set of species in their reference state at a range of - * temperatures. Note, the pressure dependence of the reference state is not - * handled by this particular species standard state model. - */ -class SpeciesThermo +//! @deprecated To be removed after Cantera 2.3. Use class MultiSpeciesThermo +//! instead. +class SpeciesThermo : public MultiSpeciesThermo { -public: - SpeciesThermo() {} - virtual ~SpeciesThermo() {} - - //! Duplication routine for objects derived from SpeciesThermo - /*! - * This function can be used to duplicate objects derived from SpeciesThermo - * even if the application only has a pointer to SpeciesThermo to work with. - */ - virtual SpeciesThermo* duplMyselfAsSpeciesThermo() const = 0; - - //! Install a new species thermodynamic property parameterization for one - //! species. - /*! - * @param index Index of the species being installed - * @param stit Pointer to the SpeciesThermoInterpType object - * This will set up the thermo for one species - */ - virtual void install_STIT(size_t index, - shared_ptr stit) = 0; - - //! Modify the species thermodynamic property parameterization for a species - /*! - * @param index Index of the species being installed - * @param spec Pointer to the SpeciesThermoInterpType object - */ - virtual void modifySpecies(size_t index, - shared_ptr spec) = 0; - - //! Compute the reference-state properties for all species. - /*! - * Given temperature T in K, this method updates the values of the non- - * dimensional heat capacity at constant pressure, enthalpy, and entropy, - * at the reference pressure, Pref of each of the standard states. - * - * @param T Temperature (Kelvin) - * @param cp_R Vector of Dimensionless heat capacities. (length m_kk). - * @param h_RT Vector of Dimensionless enthalpies. (length m_kk). - * @param s_R Vector of Dimensionless entropies. (length m_kk). - */ - virtual void update(doublereal T, doublereal* cp_R, - doublereal* h_RT, doublereal* s_R) const=0; - - //! Like update(), but only updates the single species k. - /*! - * The default treatment is to just call update() which means that - * potentially the operation takes a m_kk*m_kk hit. - * - * @param k species index - * @param T Temperature (Kelvin) - * @param cp_R Vector of Dimensionless heat capacities. (length m_kk). - * @param h_RT Vector of Dimensionless enthalpies. (length m_kk). - * @param s_R Vector of Dimensionless entropies. (length m_kk). - */ - virtual void update_one(size_t k, doublereal T, - doublereal* cp_R, - doublereal* h_RT, - doublereal* s_R) const { - update(T, cp_R, h_RT, s_R); + SpeciesThermo() { + warn_deprecated("class SpeciesThermo", "To be removed after Cantera 2.3. " + "Use class MultiSpeciesThermo instead."); } - - //! Minimum temperature. - /*! - * If no argument is supplied, this method returns the minimum temperature - * for which \e all parameterizations are valid. If an integer index k is - * supplied, then the value returned is the minimum temperature for - * species k in the phase. - * - * @param k Species index - */ - virtual doublereal minTemp(size_t k=npos) const =0; - - //! Maximum temperature. - /*! - * If no argument is supplied, this method returns the maximum temperature - * for which \e all parameterizations are valid. If an integer index k is - * supplied, then the value returned is the maximum temperature for - * parameterization k. - * - * @param k Species Index - */ - virtual doublereal maxTemp(size_t k=npos) const =0; - - //! The reference-state pressure for species k. - /*! - * Returns the reference state pressure in Pascals for species k. If k is - * left out of the argument list, it returns the reference state pressure - * for the first species. Note that some SpeciesThermo implementations, - * such as those for ideal gases, require that all species in the same - * phase have the same reference state pressures. - * - * @param k Species Index - */ - virtual doublereal refPressure(size_t k=npos) const =0; - - //! This utility function reports the type of parameterization used for the - //! species with index number *index*. - /*! - * @param index Species index - */ - virtual int reportType(size_t index=npos) const = 0; - - //! This utility function reports back the type of parameterization and - //! all of the parameters for the species with index number *index*. - /*! - * @param index Species index - * @param type Integer type of the standard type - * @param c Vector of coefficients used to set the - * parameters for the standard state. - * @param minTemp output - Minimum temperature - * @param maxTemp output - Maximum temperature - * @param refPressure output - reference pressure (Pa). - */ - virtual void reportParams(size_t index, int& type, - doublereal* const c, - doublereal& minTemp, - doublereal& maxTemp, - doublereal& refPressure) const =0; - - //! Report the 298 K Heat of Formation of the standard state of one species - //! (J kmol-1) - /*! - * The 298K Heat of Formation is defined as the enthalpy change to create - * the standard state of the species from its constituent elements in their - * standard states at 298 K and 1 bar. - * - * @param k species index - * @returns the current value of the Heat of Formation at 298K and 1 bar - */ - virtual doublereal reportOneHf298(const size_t k) const = 0; - - //! Modify the value of the 298 K Heat of Formation of the standard state of - //! one species in the phase (J kmol-1) - /*! - * The 298K heat of formation is defined as the enthalpy change to create - * the standard state of the species from its constituent elements in their - * standard states at 298 K and 1 bar. - * - * @param k Index of the species - * @param Hf298New Specify the new value of the Heat of Formation at - * 298K and 1 bar. units = J/kmol. - */ - virtual void modifyOneHf298(const size_t k, const doublereal Hf298New) = 0; - - //! Restore the original heat of formation of one or more species - /*! - * Resets changes made by modifyOneHf298(). If the species index is not - * specified, the heats of formation for all species are restored. - */ - virtual void resetHf298(const size_t k) = 0; - - //! Check if data for all species (0 through nSpecies-1) has been installed. - bool ready(size_t nSpecies); - -protected: - //! Mark species *k* as having its thermodynamic data installed - void markInstalled(size_t k); - -private: - //! indicates if data for species has been installed - std::vector m_installed; }; -//@} + } #endif diff --git a/include/cantera/thermo/SpeciesThermoInterpType.h b/include/cantera/thermo/SpeciesThermoInterpType.h index afa18ae8a..86b7da06b 100644 --- a/include/cantera/thermo/SpeciesThermoInterpType.h +++ b/include/cantera/thermo/SpeciesThermoInterpType.h @@ -25,11 +25,6 @@ class VPSSMgr; /** * @defgroup spthermo Species Reference-State Thermodynamic Properties * - * The ThermoPhase object relies on classes to calculate the thermodynamic - * properties of the reference state for all of the species in the phase. This - * group describes the types and functionality of the classes that calculate - * the reference state thermodynamic functions within %Cantera. - * * To compute the thermodynamic properties of multicomponent solutions, it is * necessary to know something about the thermodynamic properties of the * individual species present in the solution. Exactly what sort of species @@ -57,18 +52,9 @@ class VPSSMgr; * function. A full standard state does the same thing as a reference state, * but specifies the thermodynamics functions at all pressures. * - * Whatever the conventions used by a particular solution model, means need to - * be provided to compute the species properties in the reference state. Class - * SpeciesThermo is the base class for a family of classes that compute - * properties of all species in a phase in their reference states, for a range - * of temperatures. Note, the pressure dependence of the species thermodynamic - * functions is not handled by this particular species thermodynamic model. - * SpeciesThermo calculates the reference-state thermodynamic values of all - * species in a single phase during each call. - * - * The class SpeciesThermoInterpType is a pure virtual base class for - * calculation of thermodynamic functions for a single species in its reference - * state. The following classes inherit from SpeciesThermoInterpType. + * The class SpeciesThermoInterpType is an abstract base class for calculation + * of thermodynamic functions for a single species in its reference state. The + * following classes inherit from SpeciesThermoInterpType. * * - NasaPoly1 in file NasaPoly1.h * - This is a one zone model, consisting of a 7 @@ -111,9 +97,7 @@ class VPSSMgr; * The most important member function for the SpeciesThermoInterpType class is * the member function SpeciesThermoInterpType::updatePropertiesTemp(). The * function calculates the values of Cp, H, and S for the specific species - * pertaining to this class. It takes as its arguments the base pointer for the - * vector of Cp, H, and S values for all species in the phase. The offset for - * the species is known within the object. + * pertaining to this class. * * A key concept for reference states is that there is a maximum and a minimum * temperature beyond which the thermodynamic formulation isn't valid. Calls @@ -123,25 +107,12 @@ class VPSSMgr; * @ingroup thermoprops */ -//! Pure Virtual Base class for the thermodynamic manager for an individual +//! Abstract Base class for the thermodynamic manager for an individual //! species' reference state /*! - * This differs from the SpeciesThermo virtual base class in the sense that this - * class is meant to handle only one species. The speciesThermo class is meant - * to handle the calculation of all the species (or a large subset) in a phase. - * * One key feature is that the update routines use the same form as the update - * routines in the speciesThermo class. They update into a vector of cp_R, s_R, - * and H_R that spans all of the species in a phase. Therefore, this class must - * carry along a species index into that vector. - * - * These routine may be templated. A key requirement of the template is that - * there is a constructor with the following form: - * - * @code - * SpeciesThermoInterpType(int index, doublereal tlow, doublereal thigh, - * doublereal pref, const doublereal* coeffs) - * @endcode + * routines in the MultiSpeciesThermo class. They update values of cp_R, + * s_R, and H_R. * * @ingroup spthermo */ @@ -250,11 +221,11 @@ public: * @param coeffs Vector of coefficients used to set the parameters for the * standard state. * @deprecated To be removed after Cantera 2.3. Use - * SpeciesThermo::modifySpecies instead. + * MultiSpeciesThermo::modifySpecies instead. */ virtual void modifyParameters(doublereal* coeffs) { warn_deprecated("SpeciesThermoInterpType::modifyParameters", "To be " - "removed after Cantera 2.3. Use SpeciesThermo::modifySpecies " + "removed after Cantera 2.3. Use MultiSpeciesThermo::modifySpecies " "instead."); } @@ -374,10 +345,10 @@ public: doublereal* const coeffs) const; //! @deprecated To be removed after Cantera 2.3. Use - //! SpeciesThermo::modifySpecies instead. + //! MultiSpeciesThermo::modifySpecies instead. virtual void modifyParameters(doublereal* coeffs) { warn_deprecated("STITbyPDSS::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); } private: diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index 249afd574..c902be9e9 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -187,7 +187,7 @@ public: * Enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species * thermodynamic property manager. * - * \see SpeciesThermo + * \see MultiSpeciesThermo */ virtual doublereal enthalpy_mole() const; diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 928002db9..2b41d8194 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -11,7 +11,7 @@ #define CT_THERMOPHASE_H #include "Phase.h" -#include "SpeciesThermo.h" +#include "MultiSpeciesThermo.h" #include "cantera/base/global.h" namespace Cantera @@ -1427,7 +1427,7 @@ public: * * @internal */ - void setSpeciesThermo(SpeciesThermo* spthermo); + void setSpeciesThermo(MultiSpeciesThermo* spthermo); //! Return a changeable reference to the calculation manager for species //! reference-state thermodynamic properties @@ -1436,7 +1436,7 @@ public: * * @internal */ - virtual SpeciesThermo& speciesThermo(int k = -1); + virtual MultiSpeciesThermo& speciesThermo(int k = -1); /** * @internal @@ -1678,7 +1678,7 @@ protected: * This class is called when the reference-state thermodynamic properties * of all the species in the phase needs to be evaluated. */ - SpeciesThermo* m_spthermo; + MultiSpeciesThermo* m_spthermo; //! Vector of pointers to the species databases. /*! diff --git a/include/cantera/thermo/VPSSMgr.h b/include/cantera/thermo/VPSSMgr.h index 774c592b4..314a6bcda 100644 --- a/include/cantera/thermo/VPSSMgr.h +++ b/include/cantera/thermo/VPSSMgr.h @@ -22,7 +22,7 @@ namespace Cantera { class VPStandardStateTP; -class SpeciesThermo; +class MultiSpeciesThermo; class PDSS; /** * @defgroup mgrpdssthermocalc Managers for Calculating Standard-State @@ -76,7 +76,7 @@ class PDSS; * Typically calls to calculate standard state thermo properties are virtual * calls at the ThermoPhase level. It is left to the child classes of * ThermoPhase to specify how these are carried out. Usually, this will involve - * calling the m_spthermo pointer to a SpeciesThermo object to calculate the + * calling the m_spthermo pointer to a MultiSpeciesThermo object to calculate the * reference state thermodynamic properties. Then, the pressure dependence is * added in within the child ThermoPhase object to complete the specification of * the standard state. The VPStandardStateTP class, however, redefines the calls @@ -85,14 +85,14 @@ class PDSS; * * - ThermoPhase * - \link Cantera::ThermoPhase::m_spthermo m_spthermo\endlink - * This is a pointer to a SpeciesThermo manager class that + * This is a pointer to a MultiSpeciesThermo manager class that * handles the reference %state Thermodynamic calculations. * - VPStandardStateTP (inherits from ThermoPhase) * - \link Cantera::ThermoPhase::m_spthermo m_spthermo\endlink - * SpeciesThermo manager handling reference %state Thermodynamic calculations. + * MultiSpeciesThermo manager handling reference %state Thermodynamic calculations. * may or may not be used by the VPSSMgr class. For species * which don't have a reference state class defined, a default - * class, called STITbyPDSS which is installed into the SpeciesThermo + * class, called STITbyPDSS which is installed into the MultiSpeciesThermo * class, actually calculates reference state * thermo by calling a PDSS object. * - \link Cantera::VPStandardStateTP::m_VPSS_ptr m_VPSS_ptr\endlink @@ -108,19 +108,19 @@ class PDSS; * - standardState model = "IdealGas" * - This model assumes that all species in the phase obey the * ideal gas law for their pressure dependence. The manager - * uses a SpeciesThermo object to handle the calculation of the + * uses a MultiSpeciesThermo object to handle the calculation of the * reference state. * - VPSSMgr_ConstVol * - standardState model = "ConstVol" * - This model assumes that all species in the phase obey the * constant partial molar volume pressure dependence. - * The manager uses a SpeciesThermo object to handle the + * The manager uses a MultiSpeciesThermo object to handle the * calculation of the reference state. * - VPSSMgr_Water_ConstVol * - standardState model = "Water_ConstVol" * - This model assumes that all species but one in the phase obey the * constant partial molar volume pressure dependence. - * The manager uses a SpeciesThermo object to handle the + * The manager uses a MultiSpeciesThermo object to handle the * calculation of the reference state for those species. * Species 0 is assumed to be water, and a real equation * of state is used to model the T, P behavior. @@ -233,11 +233,11 @@ public: //! Constructor /*! * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object - * @param spth Pointer to the optional SpeciesThermo object + * @param spth Pointer to the optional MultiSpeciesThermo object * that will handle the calculation of the reference * state thermodynamic coefficients. */ - VPSSMgr(VPStandardStateTP* vptp_ptr, SpeciesThermo* spth = 0); + VPSSMgr(VPStandardStateTP* vptp_ptr, MultiSpeciesThermo* spth = 0); virtual ~VPSSMgr() {} VPSSMgr(const VPSSMgr& right); @@ -489,8 +489,8 @@ public: } //! Return the pointer to the reference-state Thermo calculator - //! SpeciesThermo object. - SpeciesThermo* SpeciesThermoMgr() { + //! MultiSpeciesThermo object. + MultiSpeciesThermo* SpeciesThermoMgr() { return m_spthermo; } @@ -601,9 +601,7 @@ public: /*! * Returns the reference state pressure in Pascals for species k. If k is * left out of the argument list, it returns the reference state pressure - * for the first species. Note that some SpeciesThermo implementations, - * such as those for ideal gases, require that all species in the same - * phase have the same reference state pressures. + * for the first species. * * @param k Species index. Default is -1, which returns the generic answer. */ @@ -682,13 +680,13 @@ public: //! Initialize the internal shallow pointers in this object /*! * There are a bunch of internal shallow pointers that point to the owning - * VPStandardStateTP and SpeciesThermo objects. This function reinitializes + * VPStandardStateTP and MultiSpeciesThermo objects. This function reinitializes * them. This function is called like an onion. * * @param vp_ptr Pointer to the VPStandardStateTP standard state - * @param sp_ptr Pointer to the SpeciesThermo standard state + * @param sp_ptr Pointer to the MultiSpeciesThermo standard state */ - virtual void initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr); + virtual void initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr); //!@} @@ -703,7 +701,7 @@ protected: /*! * Note, this can have a value of 0 */ - SpeciesThermo* m_spthermo; + MultiSpeciesThermo* m_spthermo; //! The last temperature at which the standard state thermodynamic //! properties were calculated at. diff --git a/include/cantera/thermo/VPSSMgr_ConstVol.h b/include/cantera/thermo/VPSSMgr_ConstVol.h index cfd308368..c87748634 100644 --- a/include/cantera/thermo/VPSSMgr_ConstVol.h +++ b/include/cantera/thermo/VPSSMgr_ConstVol.h @@ -33,9 +33,9 @@ public: /*! * @param vp_ptr Pointer to the owning VPStandardStateTP object for the * phase. - * @param spth Pointer to the SpeciesThermo object for the phase. + * @param spth Pointer to the MultiSpeciesThermo object for the phase. */ - VPSSMgr_ConstVol(VPStandardStateTP* vp_ptr, SpeciesThermo* spth); + VPSSMgr_ConstVol(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* spth); VPSSMgr_ConstVol(const VPSSMgr_ConstVol& right); VPSSMgr_ConstVol& operator=(const VPSSMgr_ConstVol& right); @@ -86,7 +86,7 @@ public: * This function sets up the internal data within this object for * handling the calculation of the standard state for the species. * - * - It registers the species with the SpeciesThermo object for the + * - It registers the species with the MultiSpeciesThermo object for the * containing VPStandardStateTP phase. * - It grabs the molar volume property and installs its value within * this object. diff --git a/include/cantera/thermo/VPSSMgr_General.h b/include/cantera/thermo/VPSSMgr_General.h index da6468c1a..ba5405d88 100644 --- a/include/cantera/thermo/VPSSMgr_General.h +++ b/include/cantera/thermo/VPSSMgr_General.h @@ -37,10 +37,10 @@ public: /*! * @param vp_ptr Pointer to the owning VPStandardStateTP object for the * phase. - * @param spth Pointer to the SpeciesThermo object for the phase. + * @param spth Pointer to the MultiSpeciesThermo object for the phase. */ VPSSMgr_General(VPStandardStateTP* vp_ptr, - SpeciesThermo* spth); + MultiSpeciesThermo* spth); VPSSMgr_General(const VPSSMgr_General& right); VPSSMgr_General& operator=(const VPSSMgr_General& right); @@ -95,8 +95,8 @@ private: * @param k Species number * @param phaseNode_ptr pointer to the phase XML node * @param doST output variable indicating whether the - * instantiation has resulted in a SpeciesThermo object - * being created and registered with the SpeciesThermo + * instantiation has resulted in a MultiSpeciesThermo object + * being created and registered with the MultiSpeciesThermo * manager class. * @returns the pointer to a newly created PDSS object */ @@ -125,7 +125,7 @@ public: virtual PDSS_enumType reportPDSSType(int index = -1) const; virtual VPSSMgr_enumType reportVPSSMgrType() const; - virtual void initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr); + virtual void initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr); private: //! Shallow pointers containing the PDSS objects for the species diff --git a/include/cantera/thermo/VPSSMgr_IdealGas.h b/include/cantera/thermo/VPSSMgr_IdealGas.h index 90226cba3..b1f2935be 100644 --- a/include/cantera/thermo/VPSSMgr_IdealGas.h +++ b/include/cantera/thermo/VPSSMgr_IdealGas.h @@ -28,7 +28,7 @@ public: * @param vp_ptr Pointer to the owning ThermoPhase * @param spth Species thermo pointer. */ - VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, SpeciesThermo* spth); + VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* spth); VPSSMgr_IdealGas(const VPSSMgr_IdealGas& right); VPSSMgr_IdealGas& operator=(const VPSSMgr_IdealGas& right); @@ -55,7 +55,7 @@ public: * This function sets up the internal data within this object for * handling the calculation of the standard state for the species. * - * - It registers the species with the SpeciesThermo object for the + * - It registers the species with the MultiSpeciesThermo object for the * containing VPStandardStateTP phase. * - It also creates a PDSS object, which basically contains a * duplication of some of this information and returns a pointer to diff --git a/include/cantera/thermo/VPSSMgr_Water_ConstVol.h b/include/cantera/thermo/VPSSMgr_Water_ConstVol.h index 11d170e82..d7be6cdf5 100644 --- a/include/cantera/thermo/VPSSMgr_Water_ConstVol.h +++ b/include/cantera/thermo/VPSSMgr_Water_ConstVol.h @@ -33,9 +33,9 @@ public: * Initialize the object. * * @param vp_ptr Pointer to the VPStandardStateTP standard state - * @param sp_ptr Pointer to the SpeciesThermo standard state + * @param sp_ptr Pointer to the MultiSpeciesThermo standard state */ - VPSSMgr_Water_ConstVol(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr); + VPSSMgr_Water_ConstVol(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr); VPSSMgr_Water_ConstVol(const VPSSMgr_Water_ConstVol& right); VPSSMgr_Water_ConstVol& operator=(const VPSSMgr_Water_ConstVol& right); @@ -89,7 +89,7 @@ public: virtual PDSS_enumType reportPDSSType(int index = -1) const; virtual VPSSMgr_enumType reportVPSSMgrType() const; - virtual void initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr); + virtual void initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr); private: //! Pointer to the Water PDSS object. diff --git a/include/cantera/thermo/VPSSMgr_Water_HKFT.h b/include/cantera/thermo/VPSSMgr_Water_HKFT.h index ba5d370be..543db0d76 100644 --- a/include/cantera/thermo/VPSSMgr_Water_HKFT.h +++ b/include/cantera/thermo/VPSSMgr_Water_HKFT.h @@ -29,12 +29,12 @@ public: //! Constructor /*! * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object - * @param spth Pointer to the optional SpeciesThermo object + * @param spth Pointer to the optional MultiSpeciesThermo object * that will handle the calculation of the reference * state thermodynamic coefficients. */ VPSSMgr_Water_HKFT(VPStandardStateTP* vptp_ptr, - SpeciesThermo* spth); + MultiSpeciesThermo* spth); VPSSMgr_Water_HKFT(const VPSSMgr_Water_HKFT& right); VPSSMgr_Water_HKFT& operator=(const VPSSMgr_Water_HKFT& right); @@ -110,13 +110,13 @@ public: //! Initialize the internal shallow pointers in this object /*! * There are a bunch of internal shallow pointers that point to the owning - * VPStandardStateTP and SpeciesThermo objects. This function reinitializes + * VPStandardStateTP and MultiSpeciesThermo objects. This function reinitializes * them. This function is called like an onion. * * @param vp_ptr Pointer to the VPStandardStateTP standard state - * @param sp_ptr Pointer to the SpeciesThermo standard state + * @param sp_ptr Pointer to the MultiSpeciesThermo standard state */ - virtual void initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr); + virtual void initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr); private: //! Shallow pointer to the water object PDSS_Water* m_waterSS; diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index 4a239e97d..63407e7fb 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -172,9 +172,9 @@ public: //@} //! @name Thermodynamic Values for the Species Reference State /*! - * All functions in this group need to be overrided, because the - * m_spthermo SpeciesThermo function is not adequate for the real equation - * of state. + * All functions in this group need to be overrided, because the m_spthermo + * MultiSpeciesThermo function is not adequate for the real equation of + * state. */ //@{ diff --git a/samples/cxx/NASA_coeffs/NASA_coeffs.cpp b/samples/cxx/NASA_coeffs/NASA_coeffs.cpp index 59923dc20..b6f37f264 100644 --- a/samples/cxx/NASA_coeffs/NASA_coeffs.cpp +++ b/samples/cxx/NASA_coeffs/NASA_coeffs.cpp @@ -19,7 +19,7 @@ void demoprog() doublereal minTemp, maxTemp, refPressure; // get a reference to the species thermo property manager - SpeciesThermo& sp = gas.speciesThermo(); + MultiSpeciesThermo& sp = gas.speciesThermo(); int n, j; diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 4a716b68b..2237e1c93 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -863,7 +863,7 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob) ts_ptr->OwningPhase = VolPhase; // get a reference to the Cantera species thermo. - SpeciesThermo& sp = tPhase->speciesThermo(); + MultiSpeciesThermo& sp = tPhase->speciesThermo(); int spType = sp.reportType(k); if (spType == SIMPLE) { diff --git a/src/thermo/ConstCpPoly.cpp b/src/thermo/ConstCpPoly.cpp index d54735ba6..2bc621064 100644 --- a/src/thermo/ConstCpPoly.cpp +++ b/src/thermo/ConstCpPoly.cpp @@ -83,7 +83,7 @@ void ConstCpPoly::reportParameters(size_t& n, int& type, void ConstCpPoly::modifyParameters(doublereal* coeffs) { warn_deprecated("ConstCpPoly::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); m_t0 = coeffs[0]; m_h0_R = coeffs[1] / GasConstant; m_s0_R = coeffs[2] / GasConstant; diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 8aec25c33..0ed1fa6b0 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -9,7 +9,7 @@ #include "cantera/thermo/LatticeSolidPhase.h" #include "cantera/thermo/ThermoFactory.h" #include "cantera/thermo/SpeciesThermoFactory.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/base/ctml.h" #include "cantera/base/stringUtils.h" #include "cantera/base/utilities.h" @@ -443,7 +443,7 @@ void LatticeSolidPhase::modifyOneHf298SS(const size_t k, const doublereal Hf298N for (size_t n = 0; n < m_lattice.size(); n++) { if (lkstart_[n+1] < k) { size_t kk = k-lkstart_[n]; - SpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo(); + MultiSpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo(); l_spthermo.modifyOneHf298(kk, Hf298New); } } diff --git a/src/thermo/Mu0Poly.cpp b/src/thermo/Mu0Poly.cpp index 0072f8934..110182fe6 100644 --- a/src/thermo/Mu0Poly.cpp +++ b/src/thermo/Mu0Poly.cpp @@ -6,7 +6,6 @@ * (see \ref spthermo and class \link Cantera::Mu0Poly Mu0Poly\endlink). */ #include "cantera/thermo/Mu0Poly.h" -#include "cantera/thermo/SpeciesThermo.h" #include "cantera/base/ctml.h" #include "cantera/base/stringUtils.h" @@ -84,7 +83,7 @@ void Mu0Poly::reportParameters(size_t& n, int& type, void Mu0Poly::modifyParameters(doublereal* coeffs) { warn_deprecated("Mu0Poly::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); processCoeffs(coeffs); } diff --git a/src/thermo/GeneralSpeciesThermo.cpp b/src/thermo/MultiSpeciesThermo.cpp similarity index 70% rename from src/thermo/GeneralSpeciesThermo.cpp rename to src/thermo/MultiSpeciesThermo.cpp index 1840cf0dc..6c74bbebe 100644 --- a/src/thermo/GeneralSpeciesThermo.cpp +++ b/src/thermo/MultiSpeciesThermo.cpp @@ -1,12 +1,12 @@ /** - * @file GeneralSpeciesThermo.cpp - * Declarations for a completely general species thermodynamic property - * manager for a phase (see \ref spthermo and - * \link Cantera::GeneralSpeciesThermo GeneralSpeciesThermo\endlink). + * @file MultiSpeciesThermo.cpp + * Declarations for a thermodynamic property manager for multiple species + * in a phase (see \ref spthermo and + * \link Cantera::MultiSpeciesThermo MultiSpeciesThermo\endlink). */ // Copyright 2001-2004 California Institute of Technology -#include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/thermo/SpeciesThermoFactory.h" #include "cantera/base/stringUtils.h" #include "cantera/base/utilities.h" @@ -14,15 +14,14 @@ namespace Cantera { -GeneralSpeciesThermo::GeneralSpeciesThermo() : +MultiSpeciesThermo::MultiSpeciesThermo() : m_tlow_max(0.0), m_thigh_min(1.0E30), m_p0(OneAtm) { } -GeneralSpeciesThermo::GeneralSpeciesThermo(const GeneralSpeciesThermo& b) : - SpeciesThermo(b), +MultiSpeciesThermo::MultiSpeciesThermo(const MultiSpeciesThermo& b) : m_tpoly(b.m_tpoly), m_speciesLoc(b.m_speciesLoc), m_tlow_max(b.m_tlow_max), @@ -41,14 +40,13 @@ GeneralSpeciesThermo::GeneralSpeciesThermo(const GeneralSpeciesThermo& b) : } } -GeneralSpeciesThermo& -GeneralSpeciesThermo::operator=(const GeneralSpeciesThermo& b) +MultiSpeciesThermo& +MultiSpeciesThermo::operator=(const MultiSpeciesThermo& b) { if (&b == this) { return *this; } - SpeciesThermo::operator=(b); m_sp.clear(); // Copy SpeciesThermoInterpType objects from 'b' for (const auto& sp : b.m_sp) { @@ -68,20 +66,22 @@ GeneralSpeciesThermo::operator=(const GeneralSpeciesThermo& b) return *this; } -SpeciesThermo* GeneralSpeciesThermo::duplMyselfAsSpeciesThermo() const +MultiSpeciesThermo* MultiSpeciesThermo::duplMyselfAsSpeciesThermo() const { - return new GeneralSpeciesThermo(*this); + warn_deprecated("MultiSpeciesThermo::duplMyselfAsSpeciesThermo", + "To be removed after Cantera 2.3"); + return new MultiSpeciesThermo(*this); } -void GeneralSpeciesThermo::install_STIT(size_t index, +void MultiSpeciesThermo::install_STIT(size_t index, shared_ptr stit_ptr) { if (!stit_ptr) { - throw CanteraError("GeneralSpeciesThermo::install_STIT", + throw CanteraError("MultiSpeciesThermo::install_STIT", "null pointer"); } AssertThrowMsg(m_speciesLoc.find(index) == m_speciesLoc.end(), - "GeneralSpeciesThermo::install_STIT", + "MultiSpeciesThermo::install_STIT", "Index position isn't null, duplication of assignment: {}", index); int type = stit_ptr->reportType(); m_speciesLoc[index] = {type, m_sp[type].size()}; @@ -96,31 +96,31 @@ void GeneralSpeciesThermo::install_STIT(size_t index, markInstalled(index); } -void GeneralSpeciesThermo::modifySpecies(size_t index, +void MultiSpeciesThermo::modifySpecies(size_t index, shared_ptr spthermo) { if (!spthermo) { - throw CanteraError("GeneralSpeciesThermo::modifySpecies", + throw CanteraError("MultiSpeciesThermo::modifySpecies", "null pointer"); } if (m_speciesLoc.find(index) == m_speciesLoc.end()) { - throw CanteraError("GeneralSpeciesThermo::modifySpecies", + throw CanteraError("MultiSpeciesThermo::modifySpecies", "Species with this index not previously added: {}", index); } int type = spthermo->reportType(); if (m_speciesLoc[index].first != type) { - throw CanteraError("GeneralSpeciesThermo::modifySpecies", + throw CanteraError("MultiSpeciesThermo::modifySpecies", "Type of parameterization changed: {} != {}", type, m_speciesLoc[index].first); } if (spthermo->minTemp() > m_tlow_max) { - throw CanteraError("GeneralSpeciesThermo::modifySpecies", + throw CanteraError("MultiSpeciesThermo::modifySpecies", "Cannot increase minimum temperature for phase from {} to {}", m_tlow_max, spthermo->minTemp()); } if (spthermo->maxTemp() < m_thigh_min) { - throw CanteraError("GeneralSpeciesThermo::modifySpecies", + throw CanteraError("MultiSpeciesThermo::modifySpecies", "Cannot increase minimum temperature for phase from {} to {}", m_thigh_min, spthermo->maxTemp()); } @@ -128,14 +128,14 @@ void GeneralSpeciesThermo::modifySpecies(size_t index, m_sp[type][m_speciesLoc[index].second] = {index, spthermo}; } -void GeneralSpeciesThermo::installPDSShandler(size_t k, PDSS* PDSS_ptr, +void MultiSpeciesThermo::installPDSShandler(size_t k, PDSS* PDSS_ptr, VPSSMgr* vpssmgr_ptr) { auto stit_ptr = make_shared(vpssmgr_ptr, PDSS_ptr); install_STIT(k, stit_ptr); } -void GeneralSpeciesThermo::update_one(size_t k, doublereal t, doublereal* cp_R, +void MultiSpeciesThermo::update_one(size_t k, doublereal t, doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const { const SpeciesThermoInterpType* sp_ptr = provideSTIT(k); @@ -144,7 +144,7 @@ void GeneralSpeciesThermo::update_one(size_t k, doublereal t, doublereal* cp_R, } } -void GeneralSpeciesThermo::update(doublereal t, doublereal* cp_R, +void MultiSpeciesThermo::update(doublereal t, doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const { auto iter = m_sp.begin(); @@ -160,7 +160,7 @@ void GeneralSpeciesThermo::update(doublereal t, doublereal* cp_R, } } -int GeneralSpeciesThermo::reportType(size_t index) const +int MultiSpeciesThermo::reportType(size_t index) const { const SpeciesThermoInterpType* sp = provideSTIT(index); if (sp) { @@ -169,7 +169,7 @@ int GeneralSpeciesThermo::reportType(size_t index) const return -1; } -void GeneralSpeciesThermo::reportParams(size_t index, int& type, +void MultiSpeciesThermo::reportParams(size_t index, int& type, doublereal* const c, doublereal& minTemp_, doublereal& maxTemp_, doublereal& refPressure_) const { @@ -183,7 +183,7 @@ void GeneralSpeciesThermo::reportParams(size_t index, int& type, } } -doublereal GeneralSpeciesThermo::minTemp(size_t k) const +doublereal MultiSpeciesThermo::minTemp(size_t k) const { if (k != npos) { const SpeciesThermoInterpType* sp = provideSTIT(k); @@ -194,7 +194,7 @@ doublereal GeneralSpeciesThermo::minTemp(size_t k) const return m_tlow_max; } -doublereal GeneralSpeciesThermo::maxTemp(size_t k) const +doublereal MultiSpeciesThermo::maxTemp(size_t k) const { if (k != npos) { const SpeciesThermoInterpType* sp = provideSTIT(k); @@ -205,7 +205,7 @@ doublereal GeneralSpeciesThermo::maxTemp(size_t k) const return m_thigh_min; } -doublereal GeneralSpeciesThermo::refPressure(size_t k) const +doublereal MultiSpeciesThermo::refPressure(size_t k) const { if (k != npos) { const SpeciesThermoInterpType* sp = provideSTIT(k); @@ -216,7 +216,7 @@ doublereal GeneralSpeciesThermo::refPressure(size_t k) const return m_p0; } -SpeciesThermoInterpType* GeneralSpeciesThermo::provideSTIT(size_t k) +SpeciesThermoInterpType* MultiSpeciesThermo::provideSTIT(size_t k) { try { const std::pair& loc = m_speciesLoc.at(k); @@ -226,7 +226,7 @@ SpeciesThermoInterpType* GeneralSpeciesThermo::provideSTIT(size_t k) } } -const SpeciesThermoInterpType* GeneralSpeciesThermo::provideSTIT(size_t k) const +const SpeciesThermoInterpType* MultiSpeciesThermo::provideSTIT(size_t k) const { try { const std::pair& loc = m_speciesLoc.at(k); @@ -236,7 +236,7 @@ const SpeciesThermoInterpType* GeneralSpeciesThermo::provideSTIT(size_t k) const } } -doublereal GeneralSpeciesThermo::reportOneHf298(const size_t k) const +doublereal MultiSpeciesThermo::reportOneHf298(const size_t k) const { const SpeciesThermoInterpType* sp_ptr = provideSTIT(k); doublereal h = -1.0; @@ -246,7 +246,7 @@ doublereal GeneralSpeciesThermo::reportOneHf298(const size_t k) const return h; } -void GeneralSpeciesThermo::modifyOneHf298(const size_t k, const doublereal Hf298New) +void MultiSpeciesThermo::modifyOneHf298(const size_t k, const doublereal Hf298New) { SpeciesThermoInterpType* sp_ptr = provideSTIT(k); if (sp_ptr) { @@ -254,7 +254,7 @@ void GeneralSpeciesThermo::modifyOneHf298(const size_t k, const doublereal Hf298 } } -void GeneralSpeciesThermo::resetHf298(const size_t k) +void MultiSpeciesThermo::resetHf298(const size_t k) { SpeciesThermoInterpType* sp_ptr = provideSTIT(k); if (sp_ptr) { @@ -262,4 +262,23 @@ void GeneralSpeciesThermo::resetHf298(const size_t k) } } +bool MultiSpeciesThermo::ready(size_t nSpecies) { + if (m_installed.size() < nSpecies) { + return false; + } + for (size_t k = 0; k < nSpecies; k++) { + if (!m_installed[k]) { + return false; + } + } + return true; +} + +void MultiSpeciesThermo::markInstalled(size_t k) { + if (k >= m_installed.size()) { + m_installed.resize(k+1, false); + } + m_installed[k] = true; +} + } diff --git a/src/thermo/Nasa9Poly1.cpp b/src/thermo/Nasa9Poly1.cpp index e6762433d..abf685a8a 100644 --- a/src/thermo/Nasa9Poly1.cpp +++ b/src/thermo/Nasa9Poly1.cpp @@ -105,7 +105,7 @@ void Nasa9Poly1::reportParameters(size_t& n, int& type, void Nasa9Poly1::modifyParameters(doublereal* coeffs) { warn_deprecated("Nasa9Poly1::modifyParameters", "To be removed after " - "Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); for (int i = 0; i < 9; i++) { m_coeff[i] = coeffs[i]; } diff --git a/src/thermo/Nasa9PolyMultiTempRegion.cpp b/src/thermo/Nasa9PolyMultiTempRegion.cpp index 911824f7a..c40f6885b 100644 --- a/src/thermo/Nasa9PolyMultiTempRegion.cpp +++ b/src/thermo/Nasa9PolyMultiTempRegion.cpp @@ -170,7 +170,7 @@ void Nasa9PolyMultiTempRegion::reportParameters(size_t& n, int& type, void Nasa9PolyMultiTempRegion::modifyParameters(doublereal* coeffs) { warn_deprecated("Nasa9PolyMultiTempRegion::modifyParameters", "To be " - "removed after Cantera 2.3. Use SpeciesThermo::modifySpecies instead."); + "removed after Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead."); int index = 3; for (size_t iReg = 0; iReg < m_regionPts.size(); iReg++) { m_regionPts[iReg]->modifyParameters(coeffs + index); diff --git a/src/thermo/PDSS.cpp b/src/thermo/PDSS.cpp index f14be86f1..3d5b7ea23 100644 --- a/src/thermo/PDSS.cpp +++ b/src/thermo/PDSS.cpp @@ -176,7 +176,7 @@ void PDSS::initThermo() } void PDSS::initAllPtrs(VPStandardStateTP* tp, VPSSMgr* vpssmgr_ptr, - SpeciesThermo* spthermo) + MultiSpeciesThermo* spthermo) { m_tp = tp; m_vpssmgr_ptr = vpssmgr_ptr; diff --git a/src/thermo/PDSS_HKFT.cpp b/src/thermo/PDSS_HKFT.cpp index e56496f32..622afee25 100644 --- a/src/thermo/PDSS_HKFT.cpp +++ b/src/thermo/PDSS_HKFT.cpp @@ -445,7 +445,7 @@ void PDSS_HKFT::initThermo() } void PDSS_HKFT::initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr, - SpeciesThermo* spthermo_ptr) + MultiSpeciesThermo* spthermo_ptr) { PDSS::initAllPtrs(vptp_ptr, vpssmgr_ptr, spthermo_ptr); m_waterSS = &dynamic_cast(*m_tp->providePDSS(0)); diff --git a/src/thermo/PDSS_IonsFromNeutral.cpp b/src/thermo/PDSS_IonsFromNeutral.cpp index 5b5b45b51..6a6ca871f 100644 --- a/src/thermo/PDSS_IonsFromNeutral.cpp +++ b/src/thermo/PDSS_IonsFromNeutral.cpp @@ -95,7 +95,7 @@ PDSS* PDSS_IonsFromNeutral::duplMyselfAsPDSS() const } void PDSS_IonsFromNeutral::initAllPtrs(VPStandardStateTP* tp, VPSSMgr* vpssmgr_ptr, - SpeciesThermo* spthermo) + MultiSpeciesThermo* spthermo) { PDSS::initAllPtrs(tp, vpssmgr_ptr, spthermo); diff --git a/src/thermo/SpeciesThermo.cpp b/src/thermo/SpeciesThermo.cpp deleted file mode 100644 index 7754403ce..000000000 --- a/src/thermo/SpeciesThermo.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "cantera/thermo/SpeciesThermo.h" - -namespace Cantera { - -bool SpeciesThermo::ready(size_t nSpecies) { - if (m_installed.size() < nSpecies) { - return false; - } - for (size_t k = 0; k < nSpecies; k++) { - if (!m_installed[k]) { - return false; - } - } - return true; -} - -void SpeciesThermo::markInstalled(size_t k) { - if (k >= m_installed.size()) { - m_installed.resize(k+1, false); - } - m_installed[k] = true; -} - -} diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 0295c8106..c2db4023a 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -7,8 +7,7 @@ // Copyright 2001 California Institute of Technology #include "cantera/thermo/SpeciesThermoFactory.h" -#include "cantera/thermo/SpeciesThermo.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/thermo/Mu0Poly.h" #include "cantera/thermo/Nasa9PolyMultiTempRegion.h" #include "cantera/thermo/Nasa9Poly1.h" diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 3eade5f3e..de78f59c0 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -10,7 +10,7 @@ #include "cantera/thermo/Species.h" #include "cantera/thermo/speciesThermoTypes.h" #include "cantera/thermo/SpeciesThermoFactory.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/thermo/IdealGasPhase.h" #include "cantera/thermo/VPSSMgr.h" #include "VPSSMgrFactory.h" diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 5e60a84c0..8da3ac243 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -11,7 +11,6 @@ #include "cantera/base/stringUtils.h" #include "cantera/thermo/ThermoFactory.h" #include "cantera/thermo/SpeciesThermoInterpType.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" #include "cantera/equil/ChemEquil.h" #include "cantera/equil/MultiPhase.h" #include "cantera/base/ctml.h" @@ -25,7 +24,7 @@ namespace Cantera { ThermoPhase::ThermoPhase() : - m_spthermo(new GeneralSpeciesThermo()), m_speciesData(0), + m_spthermo(new MultiSpeciesThermo()), m_speciesData(0), m_phi(0.0), m_hasElementPotentials(false), m_chargeNeutralityNecessary(false), @@ -43,7 +42,7 @@ ThermoPhase::~ThermoPhase() } ThermoPhase::ThermoPhase(const ThermoPhase& right) : - m_spthermo(new GeneralSpeciesThermo()), + m_spthermo(new MultiSpeciesThermo()), m_speciesData(0), m_phi(0.0), m_hasElementPotentials(false), @@ -72,7 +71,7 @@ ThermoPhase& ThermoPhase::operator=(const ThermoPhase& right) // Pointer to the species thermodynamic property manager // We own this, so we need to do a deep copy - m_spthermo = (right.m_spthermo)->duplMyselfAsSpeciesThermo(); + m_spthermo = new MultiSpeciesThermo(*right.m_spthermo); // Do a deep copy of species Data, because we own this m_speciesData.resize(m_kk); @@ -630,20 +629,15 @@ void ThermoPhase::setState_SPorSV(doublereal Starget, doublereal p, } } -void ThermoPhase::setSpeciesThermo(SpeciesThermo* spthermo) +void ThermoPhase::setSpeciesThermo(MultiSpeciesThermo* spthermo) { - if (!dynamic_cast(spthermo)) { - warn_deprecated("ThermoPhase::setSpeciesThermo", - "Use of SpeciesThermo classes other than " - "GeneralSpeciesThermo is deprecated."); - } if (m_spthermo && m_spthermo != spthermo) { delete m_spthermo; } m_spthermo = spthermo; } -SpeciesThermo& ThermoPhase::speciesThermo(int k) +MultiSpeciesThermo& ThermoPhase::speciesThermo(int k) { if (!m_spthermo) { throw CanteraError("ThermoPhase::speciesThermo()", diff --git a/src/thermo/VPSSMgr.cpp b/src/thermo/VPSSMgr.cpp index 38ced50c1..8c961c548 100644 --- a/src/thermo/VPSSMgr.cpp +++ b/src/thermo/VPSSMgr.cpp @@ -16,7 +16,7 @@ #include "cantera/thermo/VPStandardStateTP.h" #include "cantera/thermo/SpeciesThermoFactory.h" #include "cantera/thermo/PDSS.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/base/utilities.h" #include "cantera/base/xml.h" @@ -24,7 +24,7 @@ using namespace std; namespace Cantera { -VPSSMgr::VPSSMgr(VPStandardStateTP* vptp_ptr, SpeciesThermo* spthermo) : +VPSSMgr::VPSSMgr(VPStandardStateTP* vptp_ptr, MultiSpeciesThermo* spthermo) : m_kk(0), m_vptp_ptr(vptp_ptr), m_spthermo(spthermo), @@ -115,22 +115,18 @@ VPSSMgr* VPSSMgr::duplMyselfAsVPSSMgr() const } void VPSSMgr::initAllPtrs(VPStandardStateTP* vp_ptr, - SpeciesThermo* sp_ptr) + MultiSpeciesThermo* sp_ptr) { m_vptp_ptr = vp_ptr; m_spthermo = sp_ptr; // Take care of STITTbyPDSS objects - // Go see if the SpeciesThermo type is a GeneralSpeciesThermo - GeneralSpeciesThermo* gst = dynamic_cast(sp_ptr); - if (gst) { - for (size_t k = 0; k < m_kk; k++) { - SpeciesThermoInterpType* st = gst->provideSTIT(k); - STITbyPDSS* stpd = dynamic_cast(st); - if (stpd) { - PDSS* PDSS_ptr = vp_ptr->providePDSS(k); - stpd->initAllPtrs(k, this, PDSS_ptr); - } + for (size_t k = 0; k < m_kk; k++) { + SpeciesThermoInterpType* st = m_spthermo->provideSTIT(k); + STITbyPDSS* stpd = dynamic_cast(st); + if (stpd) { + PDSS* PDSS_ptr = vp_ptr->providePDSS(k); + stpd->initAllPtrs(k, this, PDSS_ptr); } } } diff --git a/src/thermo/VPSSMgrFactory.cpp b/src/thermo/VPSSMgrFactory.cpp index 3c8a860c4..ac25db771 100644 --- a/src/thermo/VPSSMgrFactory.cpp +++ b/src/thermo/VPSSMgrFactory.cpp @@ -20,7 +20,7 @@ #include "cantera/thermo/VPSSMgr_General.h" #include "cantera/thermo/SpeciesThermoFactory.h" - #include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/base/stringUtils.h" #include "cantera/base/ctml.h" @@ -235,7 +235,7 @@ VPSSMgr* VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr, } // first get the reference state handler. - SpeciesThermo* spth = new GeneralSpeciesThermo(); + MultiSpeciesThermo* spth = new MultiSpeciesThermo(); vp_ptr->setSpeciesThermo(spth); // Next, if we have specific directions, use them to get the VPSSSMgr object @@ -292,7 +292,7 @@ VPSSMgr* VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr, VPSSMgr* VPSSMgrFactory::newVPSSMgr(VPSSMgr_enumType type, VPStandardStateTP* vp_ptr) { - SpeciesThermo& spthermoRef = vp_ptr->speciesThermo(); + MultiSpeciesThermo& spthermoRef = vp_ptr->speciesThermo(); switch (type) { case cVPSSMGR_IDEALGAS: return new VPSSMgr_IdealGas(vp_ptr, &spthermoRef); diff --git a/src/thermo/VPSSMgr_ConstVol.cpp b/src/thermo/VPSSMgr_ConstVol.cpp index d4e183727..7f304b93e 100644 --- a/src/thermo/VPSSMgr_ConstVol.cpp +++ b/src/thermo/VPSSMgr_ConstVol.cpp @@ -22,7 +22,7 @@ using namespace std; namespace Cantera { -VPSSMgr_ConstVol::VPSSMgr_ConstVol(VPStandardStateTP* vp_ptr, SpeciesThermo* spth) : +VPSSMgr_ConstVol::VPSSMgr_ConstVol(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* spth) : VPSSMgr(vp_ptr, spth) { m_useTmpRefStateStorage = true; diff --git a/src/thermo/VPSSMgr_General.cpp b/src/thermo/VPSSMgr_General.cpp index 5e13d33ce..6e99c377a 100644 --- a/src/thermo/VPSSMgr_General.cpp +++ b/src/thermo/VPSSMgr_General.cpp @@ -21,7 +21,6 @@ #include "cantera/thermo/PDSS_SSVol.h" #include "cantera/thermo/PDSS_HKFT.h" #include "cantera/thermo/PDSS_IonsFromNeutral.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" #include "cantera/base/utilities.h" using namespace std; @@ -30,7 +29,7 @@ namespace Cantera { VPSSMgr_General::VPSSMgr_General(VPStandardStateTP* vp_ptr, - SpeciesThermo* spth) : + MultiSpeciesThermo* spth) : VPSSMgr(vp_ptr, spth) { // Might want to do something other than holding this true. @@ -72,7 +71,7 @@ VPSSMgr* VPSSMgr_General::duplMyselfAsVPSSMgr() const return new VPSSMgr_General(*this); } -void VPSSMgr_General::initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr) +void VPSSMgr_General::initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr) { VPSSMgr::initAllPtrs(vp_ptr, sp_ptr); @@ -138,7 +137,6 @@ PDSS* VPSSMgr_General::returnPDSS_ptr(size_t k, const XML_Node& speciesNode, { PDSS* kPDSS = 0; doST = true; - GeneralSpeciesThermo* genSpthermo = dynamic_cast(m_spthermo); const XML_Node* const ss = speciesNode.findByName("standardState"); if (!ss) { @@ -155,32 +153,20 @@ PDSS* VPSSMgr_General::returnPDSS_ptr(size_t k, const XML_Node& speciesNode, } } else if (model == "waterIAPWS" || model == "waterPDSS") { kPDSS = new PDSS_Water(m_vptp_ptr, 0); - if (!genSpthermo) { - throw CanteraError("VPSSMgr_General::returnPDSS_ptr", - "failed dynamic cast"); - } - genSpthermo->installPDSShandler(k, kPDSS, this); + m_spthermo->installPDSShandler(k, kPDSS, this); m_useTmpRefStateStorage = false; } else if (model == "HKFT") { doST = false; kPDSS = new PDSS_HKFT(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true); - if (!genSpthermo) { - throw CanteraError("VPSSMgr_General::returnPDSS_ptr", - "failed dynamic cast"); - } - genSpthermo->installPDSShandler(k, kPDSS, this); + m_spthermo->installPDSShandler(k, kPDSS, this); } else if (model == "IonFromNeutral") { - if (!genSpthermo) { - throw CanteraError("VPSSMgr_General::returnPDSS_ptr", - "failed dynamic cast"); - } doST = false; kPDSS = new PDSS_IonsFromNeutral(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true); if (!kPDSS) { throw CanteraError("VPSSMgr_General::returnPDSS_ptr", "new PDSS_IonsFromNeutral failed"); } - genSpthermo->installPDSShandler(k, kPDSS, this); + m_spthermo->installPDSShandler(k, kPDSS, this); } else if (model == "constant" || model == "temperature_polynomial" || model == "density_temperature_polynomial") { VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr); kPDSS = new PDSS_SSVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true); diff --git a/src/thermo/VPSSMgr_IdealGas.cpp b/src/thermo/VPSSMgr_IdealGas.cpp index c63a507ac..ad07d691b 100644 --- a/src/thermo/VPSSMgr_IdealGas.cpp +++ b/src/thermo/VPSSMgr_IdealGas.cpp @@ -15,7 +15,7 @@ #include "cantera/thermo/VPSSMgr_IdealGas.h" #include "cantera/base/ctml.h" #include "cantera/thermo/SpeciesThermoFactory.h" -#include "cantera/thermo/SpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/thermo/PDSS_IdealGas.h" using namespace std; @@ -23,7 +23,7 @@ using namespace std; namespace Cantera { -VPSSMgr_IdealGas::VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, SpeciesThermo* spth) : +VPSSMgr_IdealGas::VPSSMgr_IdealGas(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* spth) : VPSSMgr(vp_ptr, spth) { m_useTmpRefStateStorage = true; diff --git a/src/thermo/VPSSMgr_Water_ConstVol.cpp b/src/thermo/VPSSMgr_Water_ConstVol.cpp index ff1db0dc9..64e6cd834 100644 --- a/src/thermo/VPSSMgr_Water_ConstVol.cpp +++ b/src/thermo/VPSSMgr_Water_ConstVol.cpp @@ -17,7 +17,6 @@ #include "cantera/thermo/VPSSMgr_Water_ConstVol.h" #include "cantera/thermo/PDSS_Water.h" #include "cantera/thermo/PDSS_ConstVol.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" #include "cantera/thermo/VPStandardStateTP.h" #include "cantera/base/ctml.h" @@ -26,7 +25,7 @@ using namespace std; namespace Cantera { VPSSMgr_Water_ConstVol::VPSSMgr_Water_ConstVol(VPStandardStateTP* vp_ptr, - SpeciesThermo* spth) : + MultiSpeciesThermo* spth) : VPSSMgr(vp_ptr, spth), m_waterSS(0) { @@ -58,7 +57,7 @@ VPSSMgr* VPSSMgr_Water_ConstVol::duplMyselfAsVPSSMgr() const } void VPSSMgr_Water_ConstVol::initAllPtrs(VPStandardStateTP* vp_ptr, - SpeciesThermo* sp_ptr) + MultiSpeciesThermo* sp_ptr) { VPSSMgr::initAllPtrs(vp_ptr, sp_ptr); m_waterSS = dynamic_cast(m_vptp_ptr->providePDSS(0)); @@ -242,12 +241,7 @@ PDSS* VPSSMgr_Water_ConstVol::createInstallPDSS(size_t k, } delete m_waterSS; m_waterSS = new PDSS_Water(m_vptp_ptr, 0); - GeneralSpeciesThermo* genSpthermo = dynamic_cast(m_spthermo); - if (!genSpthermo) { - throw CanteraError("VPSSMgr_Water_ConstVol::installSpecies", - "failed dynamic cast"); - } - genSpthermo->installPDSShandler(k, m_waterSS, this); + m_spthermo->installPDSShandler(k, m_waterSS, this); kPDSS = m_waterSS; } else { VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr); diff --git a/src/thermo/VPSSMgr_Water_HKFT.cpp b/src/thermo/VPSSMgr_Water_HKFT.cpp index fb0e40fbd..b6d632b71 100644 --- a/src/thermo/VPSSMgr_Water_HKFT.cpp +++ b/src/thermo/VPSSMgr_Water_HKFT.cpp @@ -18,7 +18,7 @@ #include "cantera/thermo/PDSS_Water.h" #include "cantera/thermo/PDSS_HKFT.h" #include "cantera/thermo/VPStandardStateTP.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" +#include "cantera/thermo/MultiSpeciesThermo.h" #include "cantera/base/xml.h" #include "cantera/base/stringUtils.h" @@ -28,7 +28,7 @@ namespace Cantera { VPSSMgr_Water_HKFT::VPSSMgr_Water_HKFT(VPStandardStateTP* vp_ptr, - SpeciesThermo* spth) : + MultiSpeciesThermo* spth) : VPSSMgr(vp_ptr, spth), m_waterSS(0), m_tlastRef(-1.0) @@ -241,13 +241,7 @@ PDSS* VPSSMgr_Water_HKFT::createInstallPDSS(size_t k, } delete m_waterSS; m_waterSS = new PDSS_Water(m_vptp_ptr, 0); - - GeneralSpeciesThermo* genSpthermo = dynamic_cast(m_spthermo); - if (!genSpthermo) { - throw CanteraError("VPSSMgr_Water_HKFT::installSpecies", - "failed dynamic cast"); - } - genSpthermo->installPDSShandler(k, m_waterSS, this); + m_spthermo->installPDSShandler(k, m_waterSS, this); kPDSS = m_waterSS; } else { if (ss->attrib("model") != "HKFT") { @@ -257,18 +251,13 @@ PDSS* VPSSMgr_Water_HKFT::createInstallPDSS(size_t k, } kPDSS = new PDSS_HKFT(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true); - GeneralSpeciesThermo* genSpthermo = dynamic_cast(m_spthermo); - if (!genSpthermo) { - throw CanteraError("VPSSMgr_Water_HKFT::installSpecies", - "failed dynamic cast"); - } - genSpthermo->installPDSShandler(k, kPDSS, this); + m_spthermo->installPDSShandler(k, kPDSS, this); } return kPDSS; } void VPSSMgr_Water_HKFT::initAllPtrs(VPStandardStateTP* vp_ptr, - SpeciesThermo* sp_ptr) + MultiSpeciesThermo* sp_ptr) { VPSSMgr::initAllPtrs(vp_ptr, sp_ptr); m_waterSS = dynamic_cast(m_vptp_ptr->providePDSS(0)); diff --git a/test/thermo/thermoParameterizations.cpp b/test/thermo/thermoParameterizations.cpp index a93c2add5..48649a7c7 100644 --- a/test/thermo/thermoParameterizations.cpp +++ b/test/thermo/thermoParameterizations.cpp @@ -2,7 +2,6 @@ #include "cantera/thermo/speciesThermoTypes.h" #include "cantera/thermo/IdealGasPhase.h" #include "cantera/thermo/ConstCpPoly.h" -#include "cantera/thermo/GeneralSpeciesThermo.h" #include "cantera/thermo/NasaPoly2.h" #include "cantera/thermo/ShomatePoly.h" #include "cantera/base/stringUtils.h" @@ -52,7 +51,7 @@ TEST_F(SpeciesThermoInterpTypeTest, install_const_cp) TEST_F(SpeciesThermoInterpTypeTest, DISABLED_install_bad_pref) { - // Currently broken because GeneralSpeciesThermo does not enforce reference + // Currently broken because MultiSpeciesThermo does not enforce reference // pressure consistency. auto sO2 = make_shared("O2", parseCompString("O:2")); auto sH2 = make_shared("H2", parseCompString("H:2"));