[Thermo] VPStandardStateTP does not use reference thermo objects

Since VPStandardStateTP and derived classes do not use the reference state
thermodynamic properties in the m_spthermo object, we can just install
placeholder objects there, and eliminate the wrapper clas STITbyPDSS.
This commit is contained in:
Ray Speth 2019-01-11 16:14:29 -05:00
parent 311ae76510
commit 27c64b76f8
10 changed files with 41 additions and 144 deletions

View file

@ -117,10 +117,7 @@ namespace Cantera
*
* 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.
* MultiSpeciesThermo object for that species.
*
* @ingroup thermoprops
*/
@ -429,13 +426,6 @@ public:
m_spthermo = stit;
}
//! Returns 'true' if this object should be used in an STITbyPDSS object
//! in the phase's reference thermo manager, or 'false' if a separate
//! SpeciesThermoInterpType should be constructed
virtual bool useSTITbyPDSS() const {
return false;
}
//! Set the parent VPStandardStateTP object of this PDSS object
/*!
* This information is only used by certain PDSS subclasses

View file

@ -84,7 +84,6 @@ public:
m_spindex = k;
}
virtual bool useSTITbyPDSS() const { return true; }
virtual void initThermo();
//! Set enthalpy of formation at Pr, Tr [J/kmol]

View file

@ -88,8 +88,6 @@ public:
void setParent(VPStandardStateTP* phase, size_t k);
virtual bool useSTITbyPDSS() const { return true; }
void setNeutralSpeciesMultiplier(const std::string& species, double mult);
void setSpecialSpecies(bool special=true);
void setParametersFromXML(const XML_Node& speciesNode);

View file

@ -150,8 +150,6 @@ public:
//! @}
virtual bool useSTITbyPDSS() const { return true; }
private:
//! Pointer to the WaterPropsIAPWS object, which does the actual calculations
//! for the real equation of state

View file

@ -88,12 +88,6 @@ class PDSS;
* - This is a multiple zone model, consisting of the 9
* coefficient NASA Polynomial format in each zone.
* .
* - STITbyPDSS in file SpeciesThermoInterpType.h
* - This is an object that calculates reference state thermodynamic
* functions by relying on a pressure dependent
* standard state object (i.e., a PDSS object) to calculate
* the thermodynamic functions.
*
* 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
@ -261,56 +255,6 @@ protected:
doublereal m_Pref;
};
//! Class for the thermodynamic manager for an individual species' reference
//! state which uses the PDSS base class to satisfy the requests.
/*!
* This class is a pass-through class for handling thermodynamics calls for
* reference state thermo to an pressure dependent standard state (PDSS) class.
* For some situations, it makes no sense to have a reference state at all. One
* example of this is the real water standard state.
*
* What this class does is just to pass through the calls for thermo at (T, p0)
* to the PDSS class, which evaluates the calls at (T, p0).
*
* @ingroup spthermo
*/
class STITbyPDSS : public SpeciesThermoInterpType
{
public:
//! Main Constructor
/*!
* @param PDSS_ptr Pointer to the PDSS object that handles calls for
* this object
*/
explicit STITbyPDSS(PDSS* PDSS_ptr);
virtual doublereal minTemp() const;
virtual doublereal maxTemp() const;
virtual doublereal refPressure() const;
virtual int reportType() const;
virtual void updateProperties(const doublereal* tempPoly,
doublereal* cp_R, doublereal* h_RT,
doublereal* s_R) const;
virtual void updatePropertiesTemp(const doublereal temp,
doublereal* cp_R,
doublereal* h_RT,
doublereal* s_R) const;
virtual void reportParameters(size_t& index, int& type,
doublereal& minTemp, doublereal& maxTemp,
doublereal& refPressure,
doublereal* const coeffs) const;
private:
//! Pointer to the PDSS object that handles calls for this object
/*!
* This object is not owned by the current one.
*/
PDSS* m_PDSS_ptr;
};
}
#endif

View file

@ -160,6 +160,9 @@ public:
*/
virtual void updateStandardStateThermo() const;
virtual double minTemp(size_t k=npos) const;
virtual double maxTemp(size_t k=npos) const;
//@}
protected:
@ -265,6 +268,12 @@ protected:
*/
doublereal m_Pcurrent;
//! The minimum temperature at which data for all species is valid
double m_minTemp;
//! The maximum temperature at which data for all species is valid
double m_maxTemp;
//! The last temperature at which the standard statethermodynamic properties
//! were calculated at.
mutable doublereal m_Tlast_ss;

View file

@ -59,9 +59,4 @@
//! This is implemented in the class Nasa9PolyMultiTempRegion in Nasa9Poly1MultiTempRegion
#define NASA9MULTITEMP 513
//! Type of reference state thermo which is a wrapper around a pressure dependent
//! standard state object. Basically, the reference state pressure isn't special.
//! A general object is called with the pressure set at the reference state.
#define PDSS_TYPE 37
#endif

View file

@ -62,62 +62,4 @@ void SpeciesThermoInterpType::modifyOneHf298(const size_t k,
"Not implemented");
}
//=============================================================================
STITbyPDSS::STITbyPDSS(PDSS* PDSS_ptr) :
m_PDSS_ptr(PDSS_ptr)
{
}
doublereal STITbyPDSS::minTemp() const
{
return m_PDSS_ptr->minTemp();
}
doublereal STITbyPDSS::maxTemp() const
{
return m_PDSS_ptr->maxTemp();
}
doublereal STITbyPDSS::refPressure() const
{
return m_PDSS_ptr->refPressure();
}
int STITbyPDSS::reportType() const
{
return PDSS_TYPE;
}
void STITbyPDSS::updateProperties(const doublereal* tempPoly,
doublereal* cp_R, doublereal* h_RT,
doublereal* s_R) const
{
doublereal T = tempPoly[0];
updatePropertiesTemp(T, cp_R, h_RT, s_R);
}
void STITbyPDSS::updatePropertiesTemp(const doublereal temp,
doublereal* cp_R,
doublereal* h_RT,
doublereal* s_R) const
{
m_PDSS_ptr->setTemperature(temp);
*h_RT = m_PDSS_ptr->enthalpy_RT_ref();
*cp_R = m_PDSS_ptr->cp_R_ref();
*s_R = m_PDSS_ptr->entropy_R_ref();
}
void STITbyPDSS::reportParameters(size_t& index, int& type,
doublereal& minTemp, doublereal& maxTemp,
doublereal& refPressure,
doublereal* const coeffs) const
{
index = 0;
type = PDSS_TYPE;
minTemp = m_PDSS_ptr->minTemp();
maxTemp = m_PDSS_ptr->maxTemp();
refPressure = m_PDSS_ptr->refPressure();
}
}

View file

@ -25,6 +25,8 @@ namespace Cantera
VPStandardStateTP::VPStandardStateTP() :
m_Pcurrent(OneAtm),
m_minTemp(0.0),
m_maxTemp(BigNumber),
m_Tlast_ss(-1.0),
m_Plast_ss(-1.0)
{
@ -170,6 +172,9 @@ bool VPStandardStateTP::addSpecies(shared_ptr<Species> spec)
if (!added) {
return false;
}
// VPStandardState does not use m_spthermo - install a dummy object
m_spthermo.install_STIT(m_kk-1, make_shared<SpeciesThermoInterpType>());
m_h0_RT.push_back(0.0);
m_cp0_R.push_back(0.0);
m_g0_RT.push_back(0.0);
@ -225,14 +230,12 @@ void VPStandardStateTP::installPDSS(size_t k, unique_ptr<PDSS>&& pdss)
{
pdss->setParent(this, k);
pdss->setMolecularWeight(molecularWeight(k));
if (pdss->useSTITbyPDSS()) {
m_spthermo.install_STIT(k, make_shared<STITbyPDSS>(pdss.get()));
} else {
auto stit = species(k)->thermo;
stit->validate(speciesName(k));
pdss->setReferenceThermo(stit);
m_spthermo.install_STIT(k, stit);
if (species(k)->thermo) {
pdss->setReferenceThermo(species(k)->thermo);
species(k)->thermo->validate(speciesName(k));
}
m_minTemp = std::max(m_minTemp, pdss->minTemp());
m_maxTemp = std::min(m_maxTemp, pdss->maxTemp());
if (m_PDSS_storage.size() < k+1) {
m_PDSS_storage.resize(k+1);
@ -289,4 +292,23 @@ void VPStandardStateTP::updateStandardStateThermo() const
_updateStandardStateThermo();
}
}
double VPStandardStateTP::minTemp(size_t k) const
{
if (k == npos) {
return m_minTemp;
} else {
return m_PDSS_storage.at(k)->minTemp();
}
}
double VPStandardStateTP::maxTemp(size_t k) const
{
if (k == npos) {
return m_maxTemp;
} else {
return m_PDSS_storage.at(k)->maxTemp();
}
}
}

View file

@ -4,8 +4,8 @@ dg_corr = -1.57754e+08
um_li_chempot = -1.65555e+08
Trying VCS equilibrium solver
Unknown Cantera EOS to VCSnonideal: 'Margules'
vcs_Cantera_convert: Species Type 8 not known
vcs_Cantera_convert: Species Type 8 not known
vcs_Cantera_convert: Species Type 0 not known
vcs_Cantera_convert: Species Type 0 not known
Unknown Cantera EOS to VCSnonideal: 'LatticeSolid'
vcs_Cantera_convert: Species Type 8 not known
vcs_Cantera_convert: Species Type 1 not known