Added a density function to the PDSS objects.

HMWSoln's m_waterSS object is now a PDSS object and not a PDSS_water object.
Added a dummy satPressure() value for PDSS_ConstVol objects of 1.0E-200.
This commit is contained in:
Harry Moffat 2008-08-27 15:43:51 +00:00
parent f650649725
commit 94c066d1a4
12 changed files with 87 additions and 18 deletions

View file

@ -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<PDSS_Water *>(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<PDSS_Water*>(m_waterSS));
}
m_expg0_RT = b.m_expg0_RT;

View file

@ -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
/*!

View file

@ -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<PDSS_Water*>(m_waterSS));
/*

View file

@ -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

View file

@ -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.

View file

@ -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);
}
}

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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.
/*!