diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 5a7ef34ee..1b48970fd 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -146,7 +146,7 @@ public: * replacing: * * - ThermoPhase::id() - * - ThermoPhase::eosType() + * - ThermoPhase::type() * - ThermoPhase::nSpecies() * * @param tpVector Vector of pointers to ThermoPhase objects. this is the diff --git a/include/cantera/thermo/ConstDensityThermo.h b/include/cantera/thermo/ConstDensityThermo.h index 7c9f5537e..7857da5f6 100644 --- a/include/cantera/thermo/ConstDensityThermo.h +++ b/include/cantera/thermo/ConstDensityThermo.h @@ -36,8 +36,10 @@ public: ConstDensityThermo& operator=(const ConstDensityThermo& right); virtual ThermoPhase* duplMyselfAsThermoPhase() const; - //! Returns a constant corresponding to this class's equation of state virtual int eosType() const; + virtual std::string type() const { + return "ConstDensity"; + } virtual doublereal enthalpy_mole() const; virtual doublereal entropy_mole() const; diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index 6f22e3b57..e8e984776 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -591,6 +591,9 @@ public: //! @{ virtual int eosType() const; + virtual std::string type() const { + return "DebyeHuckel"; + } //! @} //! @name Molar Thermodynamic Properties of the Solution diff --git a/include/cantera/thermo/EdgePhase.h b/include/cantera/thermo/EdgePhase.h index a0c1b3b3d..0cd4004a4 100644 --- a/include/cantera/thermo/EdgePhase.h +++ b/include/cantera/thermo/EdgePhase.h @@ -39,10 +39,14 @@ public: EdgePhase& operator=(const EdgePhase& right); virtual ThermoPhase* duplMyselfAsThermoPhase() const; - //! returns the equation of state type virtual int eosType() const { + warn_deprecated("EdgePhase::eosType", + "To be removed after Cantera 2.3."); return cEdge; } + virtual std::string type() const { + return "Edge"; + } //! Set the Equation-of-State parameters by reading an XML Node Input /*! diff --git a/include/cantera/thermo/FixedChemPotSSTP.h b/include/cantera/thermo/FixedChemPotSSTP.h index c8fad71f6..215c299ff 100644 --- a/include/cantera/thermo/FixedChemPotSSTP.h +++ b/include/cantera/thermo/FixedChemPotSSTP.h @@ -190,8 +190,12 @@ public: * Equation of state flag. * * Returns the value cStoichSubstance, defined in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const; + virtual std::string type() const { + return "FixedChemPot"; + } //! @} //! @name Mechanical Equation of State diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index cb039a803..62afd272d 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -1216,6 +1216,9 @@ public: //! @{ virtual int eosType() const; + virtual std::string type() const { + return "HMWSoln"; + } //! @} //! @name Molar Thermodynamic Properties of the Solution diff --git a/include/cantera/thermo/IdealGasPhase.h b/include/cantera/thermo/IdealGasPhase.h index f945d1dd4..759346756 100644 --- a/include/cantera/thermo/IdealGasPhase.h +++ b/include/cantera/thermo/IdealGasPhase.h @@ -315,10 +315,16 @@ public: //! Equation of state flag. /*! * Returns the value cIdealGas, defined in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const { + warn_deprecated("IdealGasPhase::eosType", + "To be removed after Cantera 2.3."); return cIdealGas; } + virtual std::string type() const { + return "IdealGas"; + } //! @name Molar Thermodynamic Properties of the Solution //! @{ diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 616f3af01..ab4e5383e 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -114,6 +114,10 @@ public: */ IdealMolalSoln(XML_Node& phaseRef, const std::string& id = ""); + virtual std::string type() const { + return "IdealMolalSoln"; + } + //! @} //! @name Molar Thermodynamic Properties of the Solution //! @{ diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index dacfc8cde..82a5f6169 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -22,6 +22,7 @@ namespace Cantera /*! * @name CONSTANTS - Models for the Standard State of IdealSolidSolnPhase's + * @deprecated To be removed after Cantera 2.3. */ //@{ const int cIdealSolidSolnPhase0 = 5010; @@ -99,8 +100,12 @@ public: /** * Equation of state flag. Returns a value depending upon the value of * #m_formGC, which is defined at instantiation. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const; + virtual std::string type() const { + return "IdealSolidSoln"; + } //! @name Molar Thermodynamic Properties of the Solution //! @{ diff --git a/include/cantera/thermo/IdealSolnGasVPSS.h b/include/cantera/thermo/IdealSolnGasVPSS.h index c097e6525..bc88328f4 100644 --- a/include/cantera/thermo/IdealSolnGasVPSS.h +++ b/include/cantera/thermo/IdealSolnGasVPSS.h @@ -21,6 +21,7 @@ namespace Cantera /*! * @name CONSTANTS * Models for the Standard State of an IdealSolnPhase + * @deprecated To be removed after Cantera 2.3. */ //@{ const int cIdealSolnGasPhaseG = 6009; @@ -56,6 +57,9 @@ public: //@{ virtual int eosType() const; + virtual std::string type() const { + return "IdealSolnGas"; + } //! @} //! @name Molar Thermodynamic Properties diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index f4bf2aad6..1d1402a83 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -156,6 +156,10 @@ public: //! @{ virtual int eosType() const; + virtual std::string type() const { + return "IonsFromNeutral"; + } + //! @} //! @name Molar Thermodynamic Properties diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index 8d79fdecb..99bb3d436 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -253,9 +253,15 @@ public: LatticePhase(XML_Node& phaseRef, const std::string& id = ""); //! Equation of state flag. Returns the value cLattice + //! @deprecated To be removed after Cantera 2.3. virtual int eosType() const { + warn_deprecated("LatticePhase::eosType", + "To be removed after Cantera 2.3."); return cLattice; } + virtual std::string type() const { + return "Lattice"; + } //! @name Molar Thermodynamic Properties of the Solution //! @{ diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index d835b8a9b..429e45965 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -115,10 +115,16 @@ public: //! Equation of state type flag. /*! * Returns cLatticeSolid, listed in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const { + warn_deprecated("LatticeSolidPhase::eosType", + "To be removed after Cantera 2.3."); return cLatticeSolid; } + virtual std::string type() const { + return "LatticeSolid"; + } virtual doublereal minTemp(size_t k = npos) const; virtual doublereal maxTemp(size_t k = npos) const; diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 120ce3e26..709025a3b 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -246,6 +246,10 @@ public: MargulesVPSSTP& operator=(const MargulesVPSSTP& b); virtual ThermoPhase* duplMyselfAsThermoPhase() const; + virtual std::string type() const { + return "Margules"; + } + //! @name Molar Thermodynamic Properties //! @{ diff --git a/include/cantera/thermo/MaskellSolidSolnPhase.h b/include/cantera/thermo/MaskellSolidSolnPhase.h index 159044382..67b0a3b10 100644 --- a/include/cantera/thermo/MaskellSolidSolnPhase.h +++ b/include/cantera/thermo/MaskellSolidSolnPhase.h @@ -35,6 +35,10 @@ public: MaskellSolidSolnPhase& operator=(const MaskellSolidSolnPhase&); virtual ThermoPhase* duplMyselfAsThermoPhase() const; + virtual std::string type() const { + return "MaskellSolidsoln"; + } + virtual void getActivityConcentrations(doublereal* c) const; virtual doublereal standardConcentration(size_t k=0) const { return 1.0; } virtual doublereal logStandardConc(size_t k=0) const { return 0.0; } diff --git a/include/cantera/thermo/MetalPhase.h b/include/cantera/thermo/MetalPhase.h index 369df4b67..d6867f21b 100644 --- a/include/cantera/thermo/MetalPhase.h +++ b/include/cantera/thermo/MetalPhase.h @@ -44,8 +44,13 @@ public: // Overloaded methods of class ThermoPhase virtual int eosType() const { + warn_deprecated("MetalPhase::eosType", + "To be removed after Cantera 2.3."); return cMetal; } + virtual std::string type() const { + return "Metal"; + } virtual doublereal enthalpy_mole() const { return 0.0; diff --git a/include/cantera/thermo/MetalSHEelectrons.h b/include/cantera/thermo/MetalSHEelectrons.h index b87ed3aa1..b7808ec26 100644 --- a/include/cantera/thermo/MetalSHEelectrons.h +++ b/include/cantera/thermo/MetalSHEelectrons.h @@ -204,8 +204,12 @@ public: * Equation of state flag. * * Returns the value cMetalSHEelectrons, defined in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const; + virtual std::string type() const { + return "MetalSHEelectrons"; + } //! @name Mechanical Equation of State //! @{ diff --git a/include/cantera/thermo/MineralEQ3.h b/include/cantera/thermo/MineralEQ3.h index de187c4cc..0378b423f 100644 --- a/include/cantera/thermo/MineralEQ3.h +++ b/include/cantera/thermo/MineralEQ3.h @@ -119,8 +119,12 @@ public: * Equation of state flag. * * Returns the value cStoichSubstance, defined in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const; + virtual std::string type() const { + return "MineralEQ3"; + } //! @name Mechanical Equation of State //! @{ diff --git a/include/cantera/thermo/MixedSolventElectrolyte.h b/include/cantera/thermo/MixedSolventElectrolyte.h index adf3fc472..6ceb03236 100644 --- a/include/cantera/thermo/MixedSolventElectrolyte.h +++ b/include/cantera/thermo/MixedSolventElectrolyte.h @@ -238,6 +238,10 @@ public: MixedSolventElectrolyte& operator=(const MixedSolventElectrolyte& b); virtual ThermoPhase* duplMyselfAsThermoPhase() const; + virtual std::string type() const { + return "MixedSolventElectrolyte"; + } + //! @name Molar Thermodynamic Properties //! @{ diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index 99db095cb..c2f1fd809 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -82,6 +82,10 @@ public: //! @name Utilities //! @{ + virtual std::string type() const { + return "MixtureFugacity"; + } + virtual int standardStateConvention() const; //! Set the solution branch to force the ThermoPhase to exist on one branch diff --git a/include/cantera/thermo/MolarityIonicVPSSTP.h b/include/cantera/thermo/MolarityIonicVPSSTP.h index 2a2af1645..e53c7a97e 100644 --- a/include/cantera/thermo/MolarityIonicVPSSTP.h +++ b/include/cantera/thermo/MolarityIonicVPSSTP.h @@ -74,6 +74,10 @@ public: MolarityIonicVPSSTP& operator=(const MolarityIonicVPSSTP& b); virtual ThermoPhase* duplMyselfAsThermoPhase() const; + virtual std::string type() const { + return "MolarityIonic"; + } + /** * @name Activities, Standard States, and Activity Concentrations * diff --git a/include/cantera/thermo/PhaseCombo_Interaction.h b/include/cantera/thermo/PhaseCombo_Interaction.h index df2fd3f8d..d2fb1b0c1 100644 --- a/include/cantera/thermo/PhaseCombo_Interaction.h +++ b/include/cantera/thermo/PhaseCombo_Interaction.h @@ -335,6 +335,9 @@ public: //! @{ virtual int eosType() const; + virtual std::string type() const { + return "PhaseCombo_Interaction"; + } //! @} //! @name Molar Thermodynamic Properties diff --git a/include/cantera/thermo/PureFluidPhase.h b/include/cantera/thermo/PureFluidPhase.h index 000c439d0..43fadc281 100644 --- a/include/cantera/thermo/PureFluidPhase.h +++ b/include/cantera/thermo/PureFluidPhase.h @@ -38,9 +38,15 @@ public: virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! Equation of state type + //! @deprecated To be removed after Cantera 2.3. virtual int eosType() const { + warn_deprecated("PureFluidPhase::eosType", + "To be removed after Cantera 2.3."); return cPureFluid; } + virtual std::string type() const { + return "PureFluid"; + } virtual doublereal enthalpy_mole() const; virtual doublereal intEnergy_mole() const; diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index b2e149a33..24bda80e6 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -247,6 +247,10 @@ public: RedlichKisterVPSSTP& operator=(const RedlichKisterVPSSTP& b); virtual ThermoPhase* duplMyselfAsThermoPhase() const; + virtual std::string type() const { + return "RedlichKister"; + } + //! @name Molar Thermodynamic Properties //! @{ diff --git a/include/cantera/thermo/RedlichKwongMFTP.h b/include/cantera/thermo/RedlichKwongMFTP.h index e0710350e..7e06b9b06 100644 --- a/include/cantera/thermo/RedlichKwongMFTP.h +++ b/include/cantera/thermo/RedlichKwongMFTP.h @@ -50,6 +50,9 @@ public: virtual ThermoPhase* duplMyselfAsThermoPhase() const; virtual int eosType() const; + virtual std::string type() const { + return "RedlichKwong"; + } //! @name Molar Thermodynamic properties //! @{ diff --git a/include/cantera/thermo/SemiconductorPhase.h b/include/cantera/thermo/SemiconductorPhase.h index 9364ac996..b0030d97f 100644 --- a/include/cantera/thermo/SemiconductorPhase.h +++ b/include/cantera/thermo/SemiconductorPhase.h @@ -53,8 +53,13 @@ public: // Overloaded methods of class ThermoPhase virtual int eosType() const { + warn_deprecated("SemiconductorPhase::eosType", + "To be removed after Cantera 2.3."); return cSemiconductor; } + virtual std::string type() const { + return "Semiconductor"; + } virtual void setPressure(doublereal pres) { m_press = pres; diff --git a/include/cantera/thermo/SingleSpeciesTP.h b/include/cantera/thermo/SingleSpeciesTP.h index ac7c07fa0..19e072616 100644 --- a/include/cantera/thermo/SingleSpeciesTP.h +++ b/include/cantera/thermo/SingleSpeciesTP.h @@ -68,8 +68,12 @@ public: * Returns the equation of state type flag. This is a modified base class. * Therefore, if not overridden in derived classes, this call will throw an * exception. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const; + virtual std::string type() const { + return "SingleSpecies"; + } /** * @name Molar Thermodynamic Properties of the Solution diff --git a/include/cantera/thermo/StoichSubstance.h b/include/cantera/thermo/StoichSubstance.h index 8fb4973b1..be9bdaefd 100644 --- a/include/cantera/thermo/StoichSubstance.h +++ b/include/cantera/thermo/StoichSubstance.h @@ -179,8 +179,12 @@ public: * Equation of state flag. * * Returns the value cStoichSubstance, defined in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const; + virtual std::string type() const { + return "StoichSubstance"; + } //! @name Mechanical Equation of State //! @{ diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index c902be9e9..6ab818f68 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -172,10 +172,16 @@ public: //! Equation of state type flag. /*! * Redefine this to return cSurf, listed in mix_defs.h. + * @deprecated To be removed after Cantera 2.3. */ virtual int eosType() const { + warn_deprecated("SurfPhase::eosType", + "To be removed after Cantera 2.3."); return cSurf; } + virtual std::string type() const { + return "Surf"; + } //! Return the Molar Enthalpy. Units: J/kmol. /*! diff --git a/include/cantera/thermo/ThermoFactory.h b/include/cantera/thermo/ThermoFactory.h index 1f8fe5bdd..b506970ef 100644 --- a/include/cantera/thermo/ThermoFactory.h +++ b/include/cantera/thermo/ThermoFactory.h @@ -110,6 +110,7 @@ inline ThermoPhase* newThermoPhase(const std::string& model, * @param ieos eosType id of the phase. This is unique for the phase * @param length maximum length of the return string. Defaults to 100 * @returns a string representation of the eosType id for a phase + * @deprecated To be removed after Cantera 2.3. */ std::string eosTypeString(int ieos, int length = 100); diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 09ed9c72c..5f4a230ec 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -119,11 +119,21 @@ public: * The base class returns zero. Subclasses should define this to return a * unique non-zero value. Constants defined for this purpose are listed in * mix_defs.h. + * @deprecated To be removed after Cantera 2.3. Use `type()` instead. */ virtual int eosType() const { + warn_deprecated("ThermoPhase::eosType", + "To be removed after Cantera 2.3."); return 0; } + //! String indicating the thermodynamic model implemented. Usually + //! corresponds to the name of the derived class, less any suffixes such as + //! "Phase", TP", "VPSS", etc. + virtual std::string type() const { + return "ThermoPhase"; + } + /** * Returns the reference pressure in Pa. This function is a wrapper * that calls the species thermo refPressure function. diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index 3196bc61f..5eb361e18 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -137,8 +137,13 @@ public: explicit WaterSSTP(XML_Node& phaseRef, const std::string& id = ""); virtual int eosType() const { + warn_deprecated("WaterSSTP::eosType", + "To be removed after Cantera 2.3."); return -1; } + virtual std::string type() const { + return "Water"; + } //! @name Molar Thermodynamic Properties of the Solution //! @{ diff --git a/include/cantera/thermo/electrolytes.h b/include/cantera/thermo/electrolytes.h index 3de16ca46..f523a39d5 100644 --- a/include/cantera/thermo/electrolytes.h +++ b/include/cantera/thermo/electrolytes.h @@ -37,6 +37,7 @@ const int cEST_nonpolarNeutral = 5; // Nonpolar neutral species. These /** * eosTypes returned for this ThermoPhase Object + * @deprecated To be removed after Cantera 2.3. */ const int cHMWSoln0 = 45010; const int cHMWSoln1 = 45011; @@ -44,6 +45,7 @@ const int cHMWSoln2 = 45012; /** * eosTypes returned for this ThermoPhase Object + * @deprecated To be removed after Cantera 2.3. */ const int cDebyeHuckel0 = 46010; const int cDebyeHuckel1 = 46011; diff --git a/include/cantera/thermo/mix_defs.h b/include/cantera/thermo/mix_defs.h index d62224870..f4a9a1b56 100644 --- a/include/cantera/thermo/mix_defs.h +++ b/include/cantera/thermo/mix_defs.h @@ -31,6 +31,7 @@ const int cHarmonicOsc = 4; * listed below. The Cantera Kernel however, will not be know about the class * and will therefore not be able to initialize the class within its "factory" * routines. + * @deprecated To be removed after Cantera 2.3. */ const int cIdealGas = 1; // IdealGasPhase in IdealGasPhase.h const int cIncompressible = 2; // ConstDensityThermo in ConstDensityThermo.h diff --git a/interfaces/cython/cantera/_cantera.pxd b/interfaces/cython/cantera/_cantera.pxd index 5f177fe6a..abe0b90b3 100644 --- a/interfaces/cython/cantera/_cantera.pxd +++ b/interfaces/cython/cantera/_cantera.pxd @@ -43,10 +43,6 @@ cdef extern from "cantera/base/global.h" namespace "Cantera": cdef void Cxx_make_deprecation_warnings_fatal "Cantera::make_deprecation_warnings_fatal" () cdef extern from "cantera/thermo/mix_defs.h": - cdef int thermo_type_ideal_gas "Cantera::cIdealGas" - cdef int thermo_type_surf "Cantera::cSurf" - cdef int thermo_type_edge "Cantera::cEdge" - cdef int kinetics_type_gas "Cantera::cGasKinetics" cdef int kinetics_type_interface "Cantera::cInterfaceKinetics" cdef int kinetics_type_edge "Cantera::cEdgeKinetics" @@ -108,7 +104,7 @@ cdef extern from "cantera/thermo/ThermoPhase.h" namespace "Cantera": CxxThermoPhase() # miscellaneous - int eosType() + string type() string report(cbool, double) except + string name() void setName(string) diff --git a/interfaces/cython/cantera/onedim.pyx b/interfaces/cython/cantera/onedim.pyx index b88dc6afe..1e604e5cb 100644 --- a/interfaces/cython/cantera/onedim.pyx +++ b/interfaces/cython/cantera/onedim.pyx @@ -466,7 +466,7 @@ cdef class _FlowBase(Domain1D): cdef CxxIdealGasPhase* getIdealGasPhase(ThermoPhase phase) except *: - if phase.thermo.eosType() != thermo_type_ideal_gas: + if pystr(phase.thermo.type()) != "IdealGas": raise TypeError('ThermoPhase object is not an IdealGasPhase') return (phase.thermo) diff --git a/interfaces/cython/cantera/thermo.pyx b/interfaces/cython/cantera/thermo.pyx index ee398c16b..291e68b4f 100644 --- a/interfaces/cython/cantera/thermo.pyx +++ b/interfaces/cython/cantera/thermo.pyx @@ -1219,7 +1219,7 @@ cdef class ThermoPhase(_SolutionBase): cdef class InterfacePhase(ThermoPhase): """ A class representing a surface or edge phase""" def __cinit__(self, *args, **kwargs): - if self.thermo.eosType() not in (thermo_type_surf, thermo_type_edge): + if pystr(self.thermo.type()) not in ("Surf", "Edge"): raise TypeError('Underlying ThermoPhase object is of the wrong type.') self.surf = (self.thermo) diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 2237e1c93..ae99b77f9 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -715,8 +715,8 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob) size_t nelem = tPhase->nElements(); // Query Cantera for the equation of state type of the current phase. - int eos = tPhase->eosType(); - bool gasPhase = (eos == cIdealGas); + std::string eos = tPhase->type(); + bool gasPhase = (eos == "IdealGas"); // Find out the number of species in the phase size_t nSpPhase = tPhase->nSpecies(); @@ -747,36 +747,22 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob) VolPhase->p_activityConvention = tPhase->activityConvention(); // Assign the value of eqn of state. Handle conflicts here. - switch (eos) { - case cIdealGas: + if (eos == "IdealGas") { VolPhase->m_eqnState = VCS_EOS_IDEAL_GAS; - break; - case cIncompressible: + } else if (eos == "ConstDensity") { VolPhase->m_eqnState = VCS_EOS_CONSTANT; - break; - case cSurf: - throw CanteraError("VCSnonideal", "cSurf not handled yet."); - case cStoichSubstance: + } else if (eos == "StoichSubstance") { VolPhase->m_eqnState = VCS_EOS_STOICH_SUB; - break; - case cPureFluid: - if (printLvl > 1) { - plogf("cPureFluid not recognized yet by VCSnonideal\n"); - } - break; - case cEdge: - throw CanteraError("VCSnonideal", "cEdge not handled yet."); - case cIdealSolidSolnPhase0: - case cIdealSolidSolnPhase1: - case cIdealSolidSolnPhase2: + } else if (eos == "IdealSolidSoln") { VolPhase->m_eqnState = VCS_EOS_IDEAL_SOLN; - break; - default: + } else if (eos == "Surf" || eos == "Edge") { + throw CanteraError("VCSnonideal", + "Surface/edge phase not handled yet."); + } else { if (printLvl > 1) { - plogf("Unknown Cantera EOS to VCSnonideal: %d\n", eos); + writelog("Unknown Cantera EOS to VCSnonideal: '{}'\n", eos); } VolPhase->m_eqnState = VCS_EOS_UNK_CANTERA; - break; } // Transfer all of the element information from the ThermoPhase object diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index d6512d4e3..252d5d08c 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -731,21 +731,13 @@ void vcs_VolPhase::setPtrThermoPhase(ThermoPhase* tp_ptr) if (nsp == 1) { m_isIdealSoln = true; } else { - int eos = TP_ptr->eosType(); - switch (eos) { - case cIdealGas: - case cIncompressible: - case cSurf: - case cMetal: - case cStoichSubstance: - case cSemiconductor: - case cLatticeSolid: - case cLattice: - case cEdge: - case cIdealSolidSolnPhase: + std::string eos = TP_ptr->type(); + if (eos == "IdealGas" || eos == "ConstDensity" || eos == "Surf" + || eos == "Metal" || eos == "StoichSubstance" + || eos == "Semiconductor" || eos == "LatticeSolid" + || eos == "Lattice" || eos == "Edge" || eos == "IdealSolidSoln") { m_isIdealSoln = true; - break; - default: + } else { m_isIdealSoln = false; }; } diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 55a8824ae..90fc25bcc 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -132,9 +132,9 @@ void Kinetics::assignShallowPointers(const std::vector & tpVector) throw CanteraError(" Kinetics::assignShallowPointers", " id() of the ThermoPhase objects isn't the same"); } - if (ntp->eosType() != otp->eosType()) { + if (ntp->type() != otp->type()) { throw CanteraError(" Kinetics::assignShallowPointers", - " eosType() of the ThermoPhase objects isn't the same"); + " type() of the ThermoPhase objects isn't the same"); } if (ntp->nSpecies() != otp->nSpecies()) { throw CanteraError(" Kinetics::assignShallowPointers", @@ -485,13 +485,13 @@ void Kinetics::addPhase(thermo_t& thermo) } // there should only be one surface phase - int ptype = -100; + string ptype; if (type() == cEdgeKinetics) { - ptype = cEdge; + ptype = "Edge"; } else if (type() == cInterfaceKinetics) { - ptype = cSurf; + ptype = "Surf"; } - if (thermo.eosType() == ptype) { + if (thermo.type() == ptype) { m_surfphase = nPhases(); m_rxnphase = nPhases(); } diff --git a/src/thermo/ConstDensityThermo.cpp b/src/thermo/ConstDensityThermo.cpp index c7086da9a..6110088e4 100644 --- a/src/thermo/ConstDensityThermo.cpp +++ b/src/thermo/ConstDensityThermo.cpp @@ -40,6 +40,8 @@ ThermoPhase* ConstDensityThermo::duplMyselfAsThermoPhase() const int ConstDensityThermo::eosType() const { + warn_deprecated("ConstDensityThermo::eosType", + "To be removed after Cantera 2.3."); return cIncompressible; } diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index c612b8e0f..ab573a6ee 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -141,6 +141,8 @@ ThermoPhase* DebyeHuckel::duplMyselfAsThermoPhase() const int DebyeHuckel::eosType() const { + warn_deprecated("DebyeHuckel::eosType", + "To be removed after Cantera 2.3."); int res; switch (m_formGC) { case 0: diff --git a/src/thermo/FixedChemPotSSTP.cpp b/src/thermo/FixedChemPotSSTP.cpp index 412e4b91f..016dc6ad1 100644 --- a/src/thermo/FixedChemPotSSTP.cpp +++ b/src/thermo/FixedChemPotSSTP.cpp @@ -100,6 +100,8 @@ ThermoPhase* FixedChemPotSSTP::duplMyselfAsThermoPhase() const int FixedChemPotSSTP::eosType() const { + warn_deprecated("FixedChemPotSSTP::eosType", + "To be removed after Cantera 2.3."); return cFixedChemPot; } diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index b3b18fefa..4d6bbb237 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -373,6 +373,8 @@ ThermoPhase* HMWSoln::duplMyselfAsThermoPhase() const int HMWSoln::eosType() const { + warn_deprecated("HMWSoln::eosType", + "To be removed after Cantera 2.3."); int res; switch (m_formGC) { case 0: diff --git a/src/thermo/IdealSolidSolnPhase.cpp b/src/thermo/IdealSolidSolnPhase.cpp index 40a98eda9..c790a7b6d 100644 --- a/src/thermo/IdealSolidSolnPhase.cpp +++ b/src/thermo/IdealSolidSolnPhase.cpp @@ -90,6 +90,8 @@ ThermoPhase* IdealSolidSolnPhase::duplMyselfAsThermoPhase() const int IdealSolidSolnPhase::eosType() const { + warn_deprecated("EdgePhase::IdealSolidSolnPhase", + "To be removed after Cantera 2.3."); integer res; switch (m_formGC) { case 0: diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index f85245687..4749ddaa0 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -73,6 +73,8 @@ ThermoPhase* IdealSolnGasVPSS::duplMyselfAsThermoPhase() const int IdealSolnGasVPSS::eosType() const { + warn_deprecated("EdgePhase::IdealSolnGasVPSS", + "To be removed after Cantera 2.3."); if (m_idealGas) { return cIdealSolnGasVPSS; } diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index ff0342293..0d2979eea 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -164,6 +164,8 @@ void IonsFromNeutralVPSSTP::constructPhaseXML(XML_Node& phaseNode, std::string i int IonsFromNeutralVPSSTP::eosType() const { + warn_deprecated("IonsFromNeutralVPSSTP::eosType", + "To be removed after Cantera 2.3."); return cIonsFromNeutral; } diff --git a/src/thermo/MetalSHEelectrons.cpp b/src/thermo/MetalSHEelectrons.cpp index 2193818cd..79f1ef27a 100644 --- a/src/thermo/MetalSHEelectrons.cpp +++ b/src/thermo/MetalSHEelectrons.cpp @@ -59,6 +59,8 @@ ThermoPhase* MetalSHEelectrons::duplMyselfAsThermoPhase() const int MetalSHEelectrons::eosType() const { + warn_deprecated("MetalSHEelectrons::eosType", + "To be removed after Cantera 2.3."); return cMetalSHEelectrons; } diff --git a/src/thermo/MineralEQ3.cpp b/src/thermo/MineralEQ3.cpp index 156192cef..9fbe9edf5 100644 --- a/src/thermo/MineralEQ3.cpp +++ b/src/thermo/MineralEQ3.cpp @@ -68,6 +68,8 @@ ThermoPhase* MineralEQ3::duplMyselfAsThermoPhase() const int MineralEQ3::eosType() const { + warn_deprecated("MineralEQ3::eosType", + "To be removed after Cantera 2.3."); return cStoichSubstance; } diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index 41db6fe52..0e762880c 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -84,6 +84,8 @@ ThermoPhase* PhaseCombo_Interaction::duplMyselfAsThermoPhase() const int PhaseCombo_Interaction::eosType() const { + warn_deprecated("PhaseCombo_Interaction::eosType", + "To be removed after Cantera 2.3."); return cPhaseCombo_Interaction; } diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index 90307fb7c..ea7a0ed50 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -112,6 +112,8 @@ ThermoPhase* RedlichKwongMFTP::duplMyselfAsThermoPhase() const int RedlichKwongMFTP::eosType() const { + warn_deprecated("RedlichKwongMFTP::eosType", + "To be removed after Cantera 2.3."); return cRedlichKwongMFTP; } diff --git a/src/thermo/SingleSpeciesTP.cpp b/src/thermo/SingleSpeciesTP.cpp index d9b1780b6..79b270548 100644 --- a/src/thermo/SingleSpeciesTP.cpp +++ b/src/thermo/SingleSpeciesTP.cpp @@ -51,6 +51,8 @@ ThermoPhase* SingleSpeciesTP::duplMyselfAsThermoPhase() const int SingleSpeciesTP::eosType() const { + warn_deprecated("SingleSpeciesTP::eosType", + "To be removed after Cantera 2.3."); throw NotImplementedError("SingleSpeciesTP::eosType"); } diff --git a/src/thermo/StoichSubstance.cpp b/src/thermo/StoichSubstance.cpp index fbef58522..6266591c6 100644 --- a/src/thermo/StoichSubstance.cpp +++ b/src/thermo/StoichSubstance.cpp @@ -55,6 +55,8 @@ ThermoPhase* StoichSubstance::duplMyselfAsThermoPhase() const int StoichSubstance::eosType() const { + warn_deprecated("StoichSubstance::eosType", + "To be removed after Cantera 2.3."); return cStoichSubstance; } diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 6b4443646..1b8d7401b 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -114,6 +114,7 @@ ThermoPhase* ThermoFactory::newThermoPhase(const std::string& model) std::string eosTypeString(int ieos, int length) { + warn_deprecated("eosTypeString", "To be removed after Cantera 2.3."); for (int n = 0; n < ntypes; n++) { if (_itypes[n] == ieos) { return _types[n]; diff --git a/src/thermo/VPSSMgrFactory.cpp b/src/thermo/VPSSMgrFactory.cpp index c516bb2a9..7ecac5b3c 100644 --- a/src/thermo/VPSSMgrFactory.cpp +++ b/src/thermo/VPSSMgrFactory.cpp @@ -265,13 +265,6 @@ VPSSMgr* VPSSMgrFactory::newVPSSMgr(VPStandardStateTP* vp_ptr, return create(vpssManager, vp_ptr, spth); } - // Handle special cases based on the VPStandardState types - if (vp_ptr->eosType() == cVPSS_IdealGas) { - return new VPSSMgr_IdealGas(vp_ptr, spth); - } else if (vp_ptr->eosType() == cVPSS_ConstVol) { - return new VPSSMgr_ConstVol(vp_ptr, spth); - } - int inasaIG = 0, inasaCV = 0, ishomateIG = 0, ishomateCV = 0, isimpleIG = 0, isimpleCV = 0, iwater = 0, itpx = 0, iother = 0; int ihptx = 0; diff --git a/src/zeroD/IdealGasConstPressureReactor.cpp b/src/zeroD/IdealGasConstPressureReactor.cpp index e51f89b4c..c460b4763 100644 --- a/src/zeroD/IdealGasConstPressureReactor.cpp +++ b/src/zeroD/IdealGasConstPressureReactor.cpp @@ -14,7 +14,7 @@ void IdealGasConstPressureReactor::setThermoMgr(ThermoPhase& thermo) { //! @TODO: Add a method to ThermoPhase that indicates whether a given //! subclass is compatible with this reactor model - if (thermo.eosType() != cIdealGas) { + if (thermo.type() != "IdealGas") { throw CanteraError("IdealGasReactor::setThermoMgr", "Incompatible phase type provided"); } diff --git a/src/zeroD/IdealGasReactor.cpp b/src/zeroD/IdealGasReactor.cpp index 55b993b0a..1b73f1586 100644 --- a/src/zeroD/IdealGasReactor.cpp +++ b/src/zeroD/IdealGasReactor.cpp @@ -13,7 +13,7 @@ void IdealGasReactor::setThermoMgr(ThermoPhase& thermo) { //! @TODO: Add a method to ThermoPhase that indicates whether a given //! subclass is compatible with this reactor model - if (thermo.eosType() != cIdealGas) { + if (thermo.type() != "IdealGas") { throw CanteraError("IdealGasReactor::setThermoMgr", "Incompatible phase type provided"); } diff --git a/test_problems/VCSnonideal/LatticeSolid_LiSi/output_blessed.txt b/test_problems/VCSnonideal/LatticeSolid_LiSi/output_blessed.txt index 7e63bbc02..f284199d5 100644 --- a/test_problems/VCSnonideal/LatticeSolid_LiSi/output_blessed.txt +++ b/test_problems/VCSnonideal/LatticeSolid_LiSi/output_blessed.txt @@ -3,9 +3,9 @@ Number of elements = 3 dg_corr = -1.57754e+08 um_li_chempot = -1.65555e+08 Trying VCS equilibrium solver -Unknown Cantera EOS to VCSnonideal: 0 -Unknown Cantera EOS to VCSnonideal: 20 -Unknown Cantera EOS to VCSnonideal: 70 +Unknown Cantera EOS to VCSnonideal: 'Margules' +Unknown Cantera EOS to VCSnonideal: 'LatticeSolid' +Unknown Cantera EOS to VCSnonideal: 'FixedChemPot' ================================================================================ ================ Cantera_to_vprob: START OF PROBLEM STATEMENT ==================== diff --git a/test_problems/VCSnonideal/LatticeSolid_LiSi/verbose_blessed.txt b/test_problems/VCSnonideal/LatticeSolid_LiSi/verbose_blessed.txt index 9e8555beb..547f895ac 100644 --- a/test_problems/VCSnonideal/LatticeSolid_LiSi/verbose_blessed.txt +++ b/test_problems/VCSnonideal/LatticeSolid_LiSi/verbose_blessed.txt @@ -3,14 +3,14 @@ Number of elements = 3 dg_corr = -1.57754e+08 um_li_chempot = -1.65555e+08 Trying VCS equilibrium solver -Unknown Cantera EOS to VCSnonideal: 0 +Unknown Cantera EOS to VCSnonideal: 'Margules' vcs_Cantera_convert: Species Type 8 not known vcs_Cantera_convert: Species Type 8 not known -Unknown Cantera EOS to VCSnonideal: 20 +Unknown Cantera EOS to VCSnonideal: 'LatticeSolid' vcs_Cantera_convert: Species Type 8 not known vcs_Cantera_convert: Species Type 1 not known vcs_Cantera_convert: Species Type 1 not known -Unknown Cantera EOS to VCSnonideal: 70 +Unknown Cantera EOS to VCSnonideal: 'FixedChemPot' vcs_Cantera_convert: Species Type 1 not known ================================================================================ diff --git a/test_problems/VCSnonideal/NaCl_equil/good_out.txt b/test_problems/VCSnonideal/NaCl_equil/good_out.txt index efb54be23..260da603e 100644 --- a/test_problems/VCSnonideal/NaCl_equil/good_out.txt +++ b/test_problems/VCSnonideal/NaCl_equil/good_out.txt @@ -1,5 +1,5 @@ Trying VCS equilibrium solver -Unknown Cantera EOS to VCSnonideal: 45012 +Unknown Cantera EOS to VCSnonideal: 'HMWSoln' ================================================================================ ================ Cantera_to_vprob: START OF PROBLEM STATEMENT ====================