[Thermo] Move modifyOneHf298SS and m_tlast to ThermoPhase

This eliminates many duplicate implementations of this function and
declarations of this variable.
This commit is contained in:
Ray Speth 2014-03-08 21:46:58 +00:00
parent ee94266939
commit 6a51eb88dc
20 changed files with 19 additions and 121 deletions

View file

@ -324,9 +324,6 @@ public:
virtual void setParametersFromXML(const XML_Node& eosdata);
protected:
//! last value of the temperature processed by reference state
mutable doublereal m_tlast;
//! Temporary storage for dimensionless reference state enthalpies
mutable vector_fp m_h0_RT;

View file

@ -768,10 +768,6 @@ public:
*/
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
m_spthermo->modifyOneHf298(k, Hf298New);
m_tlast += 0.0001234;
}
//! Returns the vector of nondimensional
//! Gibbs Free Energies of the reference state at the current temperature
//! of the solution and the reference pressure for the species.
@ -920,9 +916,6 @@ protected:
*/
doublereal m_p0;
//! last value of the temperature processed by reference state
mutable doublereal m_tlast;
//! Temporary storage for log of p/RT
mutable doublereal m_logc0;

View file

@ -907,12 +907,6 @@ protected:
*/
vector_fp m_speciesMolarVolume;
/**
* Value of the temperature at which the thermodynamics functions
* for the reference state of the species were last evaluated.
*/
mutable doublereal m_tlast;
//! Vector containing the species reference enthalpies at T = m_tlast
mutable vector_fp m_h0_RT;

View file

@ -733,19 +733,6 @@ public:
/// @name Thermodynamic Values for the Species Reference States
//@{
//! Modify the value of the 298 K Heat of Formation 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 Species k
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
*/
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
m_spthermo->modifyOneHf298(k, Hf298New);
m_tlast += 0.0001234;
}
//! Returns the vector of nondimensional
//! Enthalpies of the reference state at the current temperature
//! of the solution and the reference pressure for the phase.
@ -908,9 +895,6 @@ protected:
*/
doublereal m_Pcurrent;
//! Current value of the temperature (Kelvin)
mutable doublereal m_tlast;
//! Reference state enthalpies / RT
mutable vector_fp m_h0_RT;

View file

@ -644,9 +644,6 @@ private:
doublereal err(const std::string& msg) const;
protected:
//! Last temperature at which the reference thermo was calculated
mutable doublereal m_tlast;
//! Current value of the pressure
doublereal m_press;

View file

@ -296,12 +296,6 @@ protected:
*/
void _updateThermo() const;
/**
* Value of the temperature at which the thermodynamics functions
* for the reference state of the species were last evaluated.
*/
mutable doublereal m_tlast;
//! Vector containing the species reference enthalpies at T = m_tlast
mutable vector_fp m_h0_RT;

View file

@ -326,19 +326,6 @@ public:
/// equation of state.
//@{
//! Modify the value of the 298 K Heat of Formation 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 Species k
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
*/
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
m_spthermo->modifyOneHf298(k, Hf298New);
m_tlast += 0.0001234;
}
/*!
* Returns the vector of nondimensional
* enthalpies of the reference state at the current temperature
@ -647,9 +634,6 @@ protected:
*/
doublereal m_p0;
//! Last temperature used to evaluate the thermodynamic polynomial.
mutable doublereal m_tlast;
//! Dimensionless enthalpy at the (mtlast, m_p0)
mutable vector_fp m_h0_RT;
//! Dimensionless heat capacity at the (mtlast, m_p0)

View file

@ -297,11 +297,6 @@ public:
*/
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
m_spthermo->modifyOneHf298(k, Hf298New);
m_tlast += 0.0001234;
}
/**
* Returns the vector of nondimensional
* enthalpies of the reference state at the current temperature
@ -362,7 +357,6 @@ protected:
doublereal m_press;
doublereal m_p0;
mutable doublereal m_tlast;
mutable vector_fp m_h0_RT;
mutable vector_fp m_cp0_R;
mutable vector_fp m_s0_R;

View file

@ -511,19 +511,6 @@ public:
*/
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
//! Modify the value of the 298 K Heat of Formation 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 Species k
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
*/
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
m_spthermo->modifyOneHf298(k, Hf298New);
m_tlast += 0.0001234;
}
//! Returns the vector of nondimensional
//! entropies of the reference state at the current temperature
//! of the solution and the reference pressure for each species.
@ -600,9 +587,6 @@ protected:
//! Current value of the pressure (Pa)
doublereal m_press;
//! Current value of the temperature (Kelvin)
mutable doublereal m_tlast;
//! Temporary storage for the reference state enthalpies
mutable vector_fp m_h0;

View file

@ -191,6 +191,7 @@ public:
*/
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
m_spthermo->modifyOneHf298(k, Hf298New);
m_tlast += 0.0001234;
}
//! Maximum temperature for which the thermodynamic data for the species
@ -1610,6 +1611,9 @@ protected:
*/
std::vector<doublereal> xMol_Ref;
//! last value of the temperature processed by reference state
mutable doublereal m_tlast;
private:
//! Error function that gets called for unhandled cases
/*!

View file

@ -16,13 +16,12 @@ using namespace ctml;
namespace Cantera
{
ConstDensityThermo::ConstDensityThermo() : m_tlast(0.0)
ConstDensityThermo::ConstDensityThermo()
{
}
ConstDensityThermo::ConstDensityThermo(const ConstDensityThermo& right)
: m_tlast(0.0)
{
*this = operator=(right);
}
@ -33,7 +32,6 @@ ConstDensityThermo& ConstDensityThermo::operator=(const ConstDensityThermo& righ
return *this;
}
m_tlast = right.m_tlast;
m_h0_RT = right.m_h0_RT;
m_cp0_R = right.m_cp0_R;
m_g0_RT = right.m_g0_RT;

View file

@ -17,14 +17,12 @@ namespace Cantera
IdealGasPhase::IdealGasPhase() :
m_p0(-1.0),
m_tlast(0.0),
m_logc0(0.0)
{
}
IdealGasPhase::IdealGasPhase(const std::string& inputFile, const std::string& id_) :
m_p0(-1.0),
m_tlast(0.0),
m_logc0(0.0)
{
initThermoFile(inputFile, id_);
@ -32,7 +30,6 @@ IdealGasPhase::IdealGasPhase(const std::string& inputFile, const std::string& id
IdealGasPhase::IdealGasPhase(XML_Node& phaseRef, const std::string& id_) :
m_p0(-1.0),
m_tlast(0.0),
m_logc0(0.0)
{
initThermoXML(phaseRef, id_);
@ -40,7 +37,6 @@ IdealGasPhase::IdealGasPhase(XML_Node& phaseRef, const std::string& id_) :
IdealGasPhase::IdealGasPhase(const IdealGasPhase& right) :
m_p0(right.m_p0),
m_tlast(right.m_tlast),
m_logc0(right.m_logc0)
{
/*
@ -55,7 +51,6 @@ IdealGasPhase& IdealGasPhase::operator=(const IdealGasPhase& right)
if (&right != this) {
ThermoPhase::operator=(right);
m_p0 = right.m_p0;
m_tlast = right.m_tlast;
m_logc0 = right.m_logc0;
m_h0_RT = right.m_h0_RT;
m_cp0_R = right.m_cp0_R;

View file

@ -22,8 +22,7 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(int formGC) :
ThermoPhase(),
m_formGC(formGC),
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(0.0)
m_Pcurrent(OneAtm)
{
if (formGC < 0 || formGC > 2) {
throw CanteraError(" IdealSolidSolnPhase Constructor",
@ -36,8 +35,7 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(const std::string& inputFile,
ThermoPhase(),
m_formGC(formGC),
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(0.0)
m_Pcurrent(OneAtm)
{
if (formGC < 0 || formGC > 2) {
throw CanteraError(" IdealSolidSolnPhase Constructor",
@ -51,8 +49,7 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, const std::string& id_,
ThermoPhase(),
m_formGC(formGC),
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(0.0)
m_Pcurrent(OneAtm)
{
if (formGC < 0 || formGC > 2) {
throw CanteraError(" IdealSolidSolnPhase Constructor",
@ -76,7 +73,6 @@ operator=(const IdealSolidSolnPhase& b)
m_Pref = b.m_Pref;
m_Pcurrent = b.m_Pcurrent;
m_speciesMolarVolume = b.m_speciesMolarVolume;
m_tlast = b.m_tlast;
m_h0_RT = b.m_h0_RT;
m_cp0_R = b.m_cp0_R;
m_g0_RT = b.m_g0_RT;

View file

@ -21,7 +21,6 @@ namespace Cantera
LatticePhase::LatticePhase() :
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(0.0),
m_speciesMolarVolume(0),
m_site_density(0.0)
{
@ -30,7 +29,6 @@ LatticePhase::LatticePhase() :
LatticePhase::LatticePhase(const LatticePhase& right) :
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(0.0),
m_speciesMolarVolume(0),
m_site_density(0.0)
{
@ -43,7 +41,6 @@ LatticePhase& LatticePhase::operator=(const LatticePhase& right)
ThermoPhase::operator=(right);
m_Pref = right.m_Pref;
m_Pcurrent = right.m_Pcurrent;
m_tlast = right.m_tlast;
m_h0_RT = right.m_h0_RT;
m_cp0_R = right.m_cp0_R;
m_g0_RT = right.m_g0_RT;

View file

@ -20,7 +20,6 @@ using namespace std;
namespace Cantera
{
LatticeSolidPhase::LatticeSolidPhase() :
m_tlast(0.0),
m_press(-1.0),
m_molar_density(0.0),
m_nlattice(0),
@ -32,7 +31,6 @@ LatticeSolidPhase::LatticeSolidPhase() :
}
LatticeSolidPhase::LatticeSolidPhase(const LatticeSolidPhase& right) :
m_tlast(0.0),
m_press(-1.0),
m_molar_density(0.0),
m_nlattice(0),

View file

@ -23,7 +23,6 @@ namespace Cantera
MaskellSolidSolnPhase::MaskellSolidSolnPhase() :
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(-1.0),
m_h0_RT(2),
m_cp0_R(2),
m_g0_RT(2),
@ -37,7 +36,6 @@ MaskellSolidSolnPhase::MaskellSolidSolnPhase() :
MaskellSolidSolnPhase::MaskellSolidSolnPhase(const MaskellSolidSolnPhase& b) :
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
m_tlast(-1.0),
m_h0_RT(2),
m_cp0_R(2),
m_g0_RT(2),

View file

@ -20,16 +20,14 @@ namespace Cantera
SingleSpeciesTP::SingleSpeciesTP() :
ThermoPhase(),
m_press(OneAtm),
m_p0(OneAtm),
m_tlast(-1.0)
m_p0(OneAtm)
{
}
SingleSpeciesTP::SingleSpeciesTP(const SingleSpeciesTP& right):
ThermoPhase(),
m_press(OneAtm),
m_p0(OneAtm),
m_tlast(-1.0)
m_p0(OneAtm)
{
*this = operator=(right);
}
@ -40,7 +38,6 @@ SingleSpeciesTP& SingleSpeciesTP::operator=(const SingleSpeciesTP& right)
ThermoPhase::operator=(right);
m_press = right.m_press;
m_p0 = right.m_p0;
m_tlast = right.m_tlast;
m_h0_RT = right.m_h0_RT;
m_cp0_R = right.m_cp0_R;
m_s0_R = right.m_s0_R;

View file

@ -15,15 +15,13 @@ namespace Cantera
{
StoichSubstance::StoichSubstance() :
m_press(OneAtm),
m_p0(OneAtm),
m_tlast(-1.0)
m_p0(OneAtm)
{
}
StoichSubstance::StoichSubstance(const StoichSubstance& right) :
m_press(OneAtm),
m_p0(OneAtm),
m_tlast(-1.0)
m_p0(OneAtm)
{
*this = operator=(right);
}
@ -35,7 +33,6 @@ operator=(const StoichSubstance& right)
ThermoPhase::operator=(right);
m_press = right.m_press;
m_p0 = right.m_p0;
m_tlast = right.m_tlast;
m_h0_RT = right.m_h0_RT;
m_cp0_R = right.m_cp0_R;
m_s0_R = right.m_s0_R;

View file

@ -21,8 +21,7 @@ SurfPhase::SurfPhase(doublereal n0):
ThermoPhase(),
m_n0(n0),
m_logn0(0.0),
m_press(OneAtm),
m_tlast(0.0)
m_press(OneAtm)
{
if (n0 > 0.0) {
m_logn0 = log(n0);
@ -34,8 +33,7 @@ SurfPhase::SurfPhase(const std::string& infile, std::string id_) :
ThermoPhase(),
m_n0(0.0),
m_logn0(0.0),
m_press(OneAtm),
m_tlast(0.0)
m_press(OneAtm)
{
XML_Node* root = get_XML_File(infile);
if (id_ == "-") {
@ -60,8 +58,7 @@ SurfPhase::SurfPhase(XML_Node& xmlphase) :
ThermoPhase(),
m_n0(0.0),
m_logn0(0.0),
m_press(OneAtm),
m_tlast(0.0)
m_press(OneAtm)
{
const XML_Node& th = xmlphase.child("thermo");
string model = th["model"];
@ -75,8 +72,7 @@ SurfPhase::SurfPhase(XML_Node& xmlphase) :
SurfPhase::SurfPhase(const SurfPhase& right) :
m_n0(right.m_n0),
m_logn0(right.m_logn0),
m_press(right.m_press),
m_tlast(right.m_tlast)
m_press(right.m_press)
{
*this = operator=(right);
}
@ -89,7 +85,6 @@ operator=(const SurfPhase& right)
m_n0 = right.m_n0;
m_logn0 = right.m_logn0;
m_press = right.m_press;
m_tlast = right.m_tlast;
m_h0 = right.m_h0;
m_s0 = right.m_s0;
m_cp0 = right.m_cp0;

View file

@ -25,7 +25,8 @@ ThermoPhase::ThermoPhase() :
m_phi(0.0),
m_hasElementPotentials(false),
m_chargeNeutralityNecessary(false),
m_ssConvention(cSS_CONVENTION_TEMPERATURE)
m_ssConvention(cSS_CONVENTION_TEMPERATURE),
m_tlast(0.0)
{
}
@ -92,6 +93,7 @@ ThermoPhase& ThermoPhase::operator=(const ThermoPhase& right)
m_hasElementPotentials = right.m_hasElementPotentials;
m_chargeNeutralityNecessary = right.m_chargeNeutralityNecessary;
m_ssConvention = right.m_ssConvention;
m_tlast = right.m_tlast;
return *this;
}