diff --git a/Cantera/src/thermo/HMWSoln.cpp b/Cantera/src/thermo/HMWSoln.cpp index e6c42f566..51f8f76ee 100644 --- a/Cantera/src/thermo/HMWSoln.cpp +++ b/Cantera/src/thermo/HMWSoln.cpp @@ -166,7 +166,7 @@ namespace Cantera { m_A_Debye = b.m_A_Debye; // This is an internal shallow copy of the PDSS_Water pointer - m_waterSS = dynamic_cast(providePDSS(0)) ; + m_waterSS = providePDSS(0); if (!m_waterSS) { throw CanteraError("HMWSoln::operator=()", "Dynamic cast to PDSS_Water failed"); } @@ -178,7 +178,7 @@ namespace Cantera { m_waterProps = 0; } if (b.m_waterProps) { - m_waterProps = new WaterProps(m_waterSS); + m_waterProps = new WaterProps(dynamic_cast(m_waterSS)); } m_expg0_RT = b.m_expg0_RT; diff --git a/Cantera/src/thermo/HMWSoln.h b/Cantera/src/thermo/HMWSoln.h index 44c9fa335..be0ee07b8 100644 --- a/Cantera/src/thermo/HMWSoln.h +++ b/Cantera/src/thermo/HMWSoln.h @@ -2342,7 +2342,8 @@ namespace Cantera { /*! * derived from the equation of state for water. */ - PDSS_Water *m_waterSS; + PDSS *m_waterSS; + //PDSS *m_waterSS; //! density of standard-state water /*! diff --git a/Cantera/src/thermo/HMWSoln_input.cpp b/Cantera/src/thermo/HMWSoln_input.cpp index c4cb26275..53a70b797 100644 --- a/Cantera/src/thermo/HMWSoln_input.cpp +++ b/Cantera/src/thermo/HMWSoln_input.cpp @@ -969,9 +969,14 @@ namespace Cantera { m_speciesSize[k] << endl; #endif } else { - throw CanteraError("HMWSoln::initThermoXML", - "Solvent SS Model \"" + modelStringa + - "\" is not allowed"); + // throw CanteraError("HMWSoln::initThermoXML", + // "Solvent SS Model \"" + modelStringa + + // "\" is not allowed, name = " + sss[0]); + m_waterSS = providePDSS(0); + m_waterSS->setState_TP(300., OneAtm); + double dens = m_waterSS->density(); + double mw = m_waterSS->molecularWeight(); + m_speciesSize[0] = mw / dens; } } else { if (modelString != "constant_incompressible" && modelString != "hkft") { @@ -994,7 +999,7 @@ namespace Cantera { * Initialize the water property calculator. It will share * the internal eos water calculator. */ - m_waterProps = new WaterProps(m_waterSS); + m_waterProps = new WaterProps(dynamic_cast(m_waterSS)); /* diff --git a/Cantera/src/thermo/PDSS.cpp b/Cantera/src/thermo/PDSS.cpp index 37cde085a..33e4771c4 100644 --- a/Cantera/src/thermo/PDSS.cpp +++ b/Cantera/src/thermo/PDSS.cpp @@ -274,6 +274,11 @@ namespace Cantera { return 0.0; } + doublereal PDSS::density() const { + err("density()"); + return 0.0; + } + // Return the molar const volume heat capacity in units of J kmol-1 K-1 /* * Returns the species standard state Cv in J kmol-1 K-1 at the diff --git a/Cantera/src/thermo/PDSS.h b/Cantera/src/thermo/PDSS.h index a3c801e15..66aad718c 100644 --- a/Cantera/src/thermo/PDSS.h +++ b/Cantera/src/thermo/PDSS.h @@ -240,6 +240,16 @@ namespace Cantera { * units are m**3 kmol-1. */ virtual doublereal molarVolume() const; + + //! Return the standard state density at standard state + /*! + * Returns the species standard state density at the + * current temperature and pressure + * + * @return returns the standard state density + * units are kg m-3 + */ + virtual doublereal density() const; //! Get the difference in the standard state enthalpy //! between the current pressure and the reference pressure, p0. diff --git a/Cantera/src/thermo/PDSS_ConstVol.cpp b/Cantera/src/thermo/PDSS_ConstVol.cpp index b8afd7263..4b07333dd 100644 --- a/Cantera/src/thermo/PDSS_ConstVol.cpp +++ b/Cantera/src/thermo/PDSS_ConstVol.cpp @@ -267,6 +267,12 @@ namespace Cantera { return (val); } + doublereal + PDSS_ConstVol::density() const { + double val = m_Vss_ptr[m_spindex]; + return (m_mw/val); + } + doublereal PDSS_ConstVol::gibbs_RT_ref() const { double val = m_g0_RT_ptr[m_spindex]; @@ -343,8 +349,7 @@ namespace Cantera { /// saturation pressure doublereal PDSS_ConstVol::satPressure(doublereal t){ - throw CanteraError("PDSS_ConstVol::satPressure()", "unimplemented"); - return (0.0); + return (1.0E-200); } } diff --git a/Cantera/src/thermo/PDSS_ConstVol.h b/Cantera/src/thermo/PDSS_ConstVol.h index 26a5389bc..dcae51c7e 100644 --- a/Cantera/src/thermo/PDSS_ConstVol.h +++ b/Cantera/src/thermo/PDSS_ConstVol.h @@ -206,6 +206,16 @@ namespace Cantera { */ virtual doublereal molarVolume() const; + //! Return the standard state density at standard state + /*! + * Returns the species standard state density at the + * current temperature and pressure + * + * @return returns the standard state density + * units are kg m-3 + */ + virtual doublereal density() const; + /** * @} * @name Properties of the Reference State of the Species diff --git a/Cantera/src/thermo/PDSS_HKFT.cpp b/Cantera/src/thermo/PDSS_HKFT.cpp index f2975c5fb..50e3d7581 100644 --- a/Cantera/src/thermo/PDSS_HKFT.cpp +++ b/Cantera/src/thermo/PDSS_HKFT.cpp @@ -313,6 +313,12 @@ namespace Cantera { return molVol; } + doublereal + PDSS_HKFT::density() const { + double val = molarVolume(); + return (m_mw/val); + } + doublereal PDSS_HKFT::gibbs_RT_ref() const { double m_psave = m_pres; diff --git a/Cantera/src/thermo/PDSS_HKFT.h b/Cantera/src/thermo/PDSS_HKFT.h index a169f97e5..41cd51687 100644 --- a/Cantera/src/thermo/PDSS_HKFT.h +++ b/Cantera/src/thermo/PDSS_HKFT.h @@ -212,6 +212,16 @@ namespace Cantera { */ virtual doublereal molarVolume() const; + //! Return the standard state density at standard state + /*! + * Returns the species standard state density at the + * current temperature and pressure + * + * @return returns the standard state density + * units are kg m-3 + */ + virtual doublereal density() const; + /** * @} * @name Properties of the Reference State of the Species diff --git a/Cantera/src/thermo/PDSS_IdealGas.cpp b/Cantera/src/thermo/PDSS_IdealGas.cpp index fabee4196..6205f7723 100644 --- a/Cantera/src/thermo/PDSS_IdealGas.cpp +++ b/Cantera/src/thermo/PDSS_IdealGas.cpp @@ -233,6 +233,12 @@ namespace Cantera { return (GasConstant * m_temp / m_pres); } + + doublereal + PDSS_IdealGas::density() const { + return (m_pres * m_mw / (GasConstant * m_temp)); + } + /** * Calculate the constant volume heat capacity * in mks units of J kmol-1 K-1 diff --git a/Cantera/src/thermo/PDSS_IdealGas.h b/Cantera/src/thermo/PDSS_IdealGas.h index d288f4327..963a4a50a 100644 --- a/Cantera/src/thermo/PDSS_IdealGas.h +++ b/Cantera/src/thermo/PDSS_IdealGas.h @@ -209,6 +209,16 @@ namespace Cantera { */ virtual doublereal molarVolume() const; + //! Return the standard state density at standard state + /*! + * Returns the species standard state density at the + * current temperature and pressure + * + * @return returns the standard state density + * units are kg m-3 + */ + virtual doublereal density() const; + /** * @} * @name Properties of the Reference State of the Species @@ -286,9 +296,6 @@ namespace Cantera { */ virtual void setPressure(doublereal pres); - //! Returns the density of the species - double density() const; - //! Set the internal temperature /*! * @param temp Temperature (Kelvin) diff --git a/Cantera/src/thermo/PDSS_Water.h b/Cantera/src/thermo/PDSS_Water.h index 1607b61e7..0411f7213 100644 --- a/Cantera/src/thermo/PDSS_Water.h +++ b/Cantera/src/thermo/PDSS_Water.h @@ -216,6 +216,16 @@ namespace Cantera { */ virtual doublereal molarVolume() const; + //! Return the standard state density at standard state + /*! + * Returns the species standard state density at the + * current temperature and pressure + * + * @return returns the standard state density + * units are kg m-3 + */ + virtual doublereal density() const; + /** * @} * @name Properties of the Reference State of the Species @@ -310,12 +320,6 @@ namespace Cantera { */ void setDensity(doublereal dens); - //! Report the current density of the water - /*! - * This is a non-virtual function because it specific - * to this object. - */ - doublereal density() const; //! Return the volumetric thermal expansion coefficient. Units: 1/K. /*!