Cleaned up Doxygen docs for class SingleSpeciesTP and descendants

This commit is contained in:
Ray Speth 2013-02-14 01:02:46 +00:00
parent da33cc66c3
commit 6b0a708389
14 changed files with 346 additions and 1998 deletions

View file

@ -28,7 +28,6 @@ namespace Cantera
* density to pressure. This is necessary because the phase is
* incompressible. It uses a zero volume approximation.
*
*
* <b> Specification of Species Standard %State Properties </b>
*
* This class inherits from SingleSpeciesTP.
@ -44,7 +43,6 @@ namespace Cantera
* equal to the chemical potential. The entropy, the heat capacity, and the molar volume
* are equal to zero.
*
*
* <b> Specification of Solution Thermodynamic Properties </b>
*
* All solution properties are obtained from the standard state
@ -76,8 +74,6 @@ namespace Cantera
* for %Cantera. This new %FixedChemPotSSTP object must then have a standalone xml file
* description an example of which is given below.
*
*
*
* It may also be created by the following code snippets. The code
* includes the special member function setChemicalPotential( chempot), which
* sets the chemical potential to a specific value in J / kmol.
@ -112,56 +108,52 @@ namespace Cantera
* The phase model name for this is called FixedChemPot. It must be supplied
* as the model attribute of the thermo XML element entry.
*
* @code
* <?xml version="1.0"?>
* <ctml>
* <validate reactions="yes" species="yes"/>
*
* @verbatim
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<!-- phase NaCl(S) -->
<phase dim="3" id="LiFixed">
<elementArray datasrc="elements.xml">
Li
</elementArray>
<speciesArray datasrc="#species_Li(Fixed)">
LiFixed
</speciesArray>
<thermo model="FixedChemPot">
<chemicalPotential units="J/kmol"> -2.3E7 </chemicalPotential>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<!-- species definitions -->
<speciesData id="species_Li(Fixed)">
<species name="LiFixed">
<atomArray> Li:1 </atomArray>
<thermo>
<Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
<floatArray size="7">
50.72389, 6.672267, -2.517167,
10.15934, -0.200675, -427.2115,
130.3973
</floatArray>
</Shomate>
</thermo>
</species>
</speciesData>
</ctml>
@endverbatim
*
* The model attribute, "FixedChemPot", on the thermo element
* identifies the phase as being a FixedChemPotSSTP object.
*
* @ingroup thermoprops
*/
* <!-- phase NaCl(S) -->
* <phase dim="3" id="LiFixed">
* <elementArray datasrc="elements.xml">
* Li
* </elementArray>
* <speciesArray datasrc="#species_Li(Fixed)">
* LiFixed
* </speciesArray>
* <thermo model="FixedChemPot">
* <chemicalPotential units="J/kmol"> -2.3E7 </chemicalPotential>
* </thermo>
* <transport model="None"/>
* <kinetics model="none"/>
* </phase>
*
* <!-- species definitions -->
* <speciesData id="species_Li(Fixed)">
* <species name="LiFixed">
* <atomArray> Li:1 </atomArray>
* <thermo>
* <Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
* <floatArray size="7">
* 50.72389, 6.672267, -2.517167,
* 10.15934, -0.200675, -427.2115,
* 130.3973
* </floatArray>
* </Shomate>
* </thermo>
* </species>
* </speciesData>
* </ctml>
* @endcode
*
* The model attribute, "FixedChemPot", on the thermo element
* identifies the phase as being a FixedChemPotSSTP object.
*
* @ingroup thermoprops
*/
class FixedChemPotSSTP : public SingleSpeciesTP
{
public:
//! Default constructor for the FixedChemPotSSTP class
FixedChemPotSSTP();
@ -206,7 +198,7 @@ public:
*/
FixedChemPotSSTP& operator=(const FixedChemPotSSTP& right);
//! Destructor for the routine (virtual)
//! Destructor for the routine
virtual ~FixedChemPotSSTP();
//! Duplication function
@ -219,12 +211,6 @@ public:
*/
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Utilities
* @{
*/
/**
* Equation of state flag.
*
@ -232,18 +218,9 @@ public:
*/
virtual int eosType() const;
/**
* @}
* @name Molar Thermodynamic Properties of the Solution
* @{
*/
/**
* @}
* @name Mechanical Equation of State
* @{
*/
//! @}
//! @name Mechanical Equation of State
//! @{
//! Report the Pressure. Units: Pa.
/*!
@ -363,14 +340,16 @@ public:
* Inherited classes are responsible for overriding the default
* values if necessary.
*
* @param uA Output vector containing the units
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
* @param uA Output vector containing the units:
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*
* @param k species index. Defaults to 0.
* @param sizeUA output int containing the size of the vector.
* Currently, this is equal to 6.
@ -379,10 +358,8 @@ public:
int sizeUA = 6) const;
//@}
/// @name Partial Molar Properties of the Solution
///
/// These properties are handled by the parent class,
/// SingleSpeciesTP
/// @name Partial Molar Properties of the Solution
/// These properties are handled by the parent class, SingleSpeciesTP
//@{
//! Get the species partial molar volumes. Units: m^3/kmol.
@ -468,9 +445,8 @@ public:
//! internal Energies of the reference state at the current temperature
//! of the solution and the reference pressure for each species.
/*!
* @param urt Output vector of nondimensional reference state
* internal energies of the species.
* Length: m_kk
* @param urt Output vector of nondimensional reference state internal
* energies of the species. Length: m_kk
*/
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
@ -504,7 +480,6 @@ public:
*/
virtual void getGibbs_RT_ref(doublereal* grt) const;
/*!
* Returns the vector of the
* gibbs function of the reference state at the current temperature
@ -547,18 +522,6 @@ public:
*/
virtual void getCp_R_ref(doublereal* cprt) const;
/*
* ---- Critical State Properties
*/
/*
* ---- Saturation Properties
*/
/*
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
@ -574,15 +537,12 @@ public:
*/
virtual void initThermo();
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
//! Set the equation of state parameters
/*!
* @internal
* The number and meaning of these depends on the subclass.
*
* @param n number of parameters
* @param n number of parameters = 1
* @param c array of \a n coefficients
* c[0] = density of phase [ kg/m3 ]
*/
@ -617,17 +577,16 @@ public:
*
* eosdata points to the thermo block, and looks like this:
*
* @verbatim
<phase id="stoichsolid" >
<thermo model="FixedChemPot">
<chemicalPotential units="J/kmol"> -2.7E7 </chemicalPotential>
</thermo>
</phase> @endverbatim
*
* @code
* <phase id="stoichsolid" >
* <thermo model="FixedChemPot">
* <chemicalPotential units="J/kmol"> -2.7E7 </chemicalPotential>
* </thermo>
* </phase>
* @endcode
*/
virtual void setParametersFromXML(const XML_Node& eosdata);
//! Function to set the chemical potential directly
/*!
* @param chemPot Value of the chemical potential (units J/kmol)
@ -635,16 +594,13 @@ public:
void setChemicalPotential(doublereal chemPot);
protected:
//! Value of the chemical potential of the bath species
/*!
* units are J/kmol
*/
doublereal chemPot_;
};
}
#endif

View file

@ -26,7 +26,6 @@ namespace Cantera
* The class is based on the electron having a chemical potential
* equal to one-half of the entropy of the H<SUP>2</SUP> gas at the system pressure
*
*
* <b> Specification of Species Standard %State Properties </b>
*
* This class inherits from SingleSpeciesTP.
@ -75,7 +74,6 @@ namespace Cantera
* u^o_k(T,P) = h^o_k(T) - R T
* \f]
*
*
* <b> Specification of Solution Thermodynamic Properties </b>
*
* All solution properties are obtained from the standard state
@ -94,7 +92,6 @@ namespace Cantera
* is equal to 1/2 of the H2 gas chemical potential, and the voltage assigned
* to the electron, which is the voltage of the metal.
*
*
* <b> Instantiation of the Class </b>
*
* The constructor for this phase is located in the default ThermoFactory
@ -116,7 +113,7 @@ namespace Cantera
* @endcode
*
* @code
* ThermoPhase *eMetal = newPhase(" MetalSHEelectrons.xml", "MetalSHEelectrons");
* ThermoPhase *eMetal = newPhase("MetalSHEelectrons.xml", "MetalSHEelectrons");
* @endcode
*
* Additionally, this phase may be created without including an xml file with
@ -126,8 +123,6 @@ namespace Cantera
* MetalSHEelectrons *eMetal = new MetalSHEelectrons("MetalSHEelectrons_default.xml", "");
* @endcode
*
*
*
* <b> XML Example </b>
*
* The phase model name for this is called %MetalSHEelectrons. It must be supplied
@ -136,58 +131,56 @@ namespace Cantera
* the density of the phase must be specified though it's not used. An example of an XML file
* this phase is given below.
*
* @verbatim
<?xml version="1.0"?>
<ctml>
<validate reactions="yes" species="yes"/>
<phase dim="3" id="MetalSHEelectrons">
<elementArray datasrc="elements.xml">
E
</elementArray>
<speciesArray datasrc="#species_Metal_SHEelectrons"> she_electron </speciesArray>
<thermo model="metalSHEelectrons">
<density units="g/cm3">2.165</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<!-- species definitions -->
<speciesData id="species_Metal_SHEelectrons">
<species name="she_electron">
<atomArray> E:1 </atomArray>
<charge> -1 </charge>
<thermo>
<NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
<floatArray name="coeffs" size="7">
1.172165560E+00, 3.990260375E-03, -9.739075500E-06, 1.007860470E-08,
-3.688058805E-12, -4.589675865E+02, 3.415051190E-01
</floatArray>
</NASA>
<NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
<floatArray name="coeffs" size="7">
1.466432895E+00, 4.133039835E-04, -7.320116750E-08, 7.705017950E-12,
-3.444022160E-16, -4.065327985E+02, -5.121644350E-01
</floatArray>
</NASA>
</thermo>
<density units="g/cm3">2.165</density>
</species>
</speciesData>
</ctml>
@endverbatim
* @code
* <?xml version="1.0"?>
* <ctml>
* <validate reactions="yes" species="yes"/>
*
* The model attribute, "MetalSHEelectrons", on the thermo element
* identifies the phase as being a %MetalSHEelectrons object.
* <phase dim="3" id="MetalSHEelectrons">
* <elementArray datasrc="elements.xml">
* E
* </elementArray>
* <speciesArray datasrc="#species_Metal_SHEelectrons"> she_electron </speciesArray>
* <thermo model="metalSHEelectrons">
* <density units="g/cm3">2.165</density>
* </thermo>
* <transport model="None"/>
* <kinetics model="none"/>
* </phase>
*
* <!-- species definitions -->
* <speciesData id="species_Metal_SHEelectrons">
* <species name="she_electron">
* <atomArray> E:1 </atomArray>
* <charge> -1 </charge>
* <thermo>
* <NASA Tmax="1000.0" Tmin="200.0" P0="100000.0">
* <floatArray name="coeffs" size="7">
* 1.172165560E+00, 3.990260375E-03, -9.739075500E-06, 1.007860470E-08,
* -3.688058805E-12, -4.589675865E+02, 3.415051190E-01
* </floatArray>
* </NASA>
* <NASA Tmax="6000.0" Tmin="1000.0" P0="100000.0">
* <floatArray name="coeffs" size="7">
* 1.466432895E+00, 4.133039835E-04, -7.320116750E-08, 7.705017950E-12,
* -3.444022160E-16, -4.065327985E+02, -5.121644350E-01
* </floatArray>
* </NASA>
* </thermo>
* <density units="g/cm3">2.165</density>
* </species>
* </speciesData>
* </ctml>
* @endcode
*
* The model attribute, "MetalSHEelectrons", on the thermo element
* identifies the phase as being a %MetalSHEelectrons object.
*
* @ingroup thermoprops
*/
class MetalSHEelectrons : public SingleSpeciesTP
{
public:
//! Default constructor for the MetalSHEelectrons class
MetalSHEelectrons();
@ -220,7 +213,7 @@ public:
*/
MetalSHEelectrons& operator=(const MetalSHEelectrons& right);
//! Destructor for the routine (virtual)
//! Destructor for the routine
virtual ~MetalSHEelectrons();
//! Duplication function
@ -233,37 +226,20 @@ public:
*/
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Utilities
* @{
*/
/**
* Equation of state flag.
*
* Returns the value cStoichSubstance, defined in mix_defs.h.
* Returns the value cMetalSHEelectrons, defined in mix_defs.h.
*/
virtual int eosType() const;
/**
* @}
* @name Molar Thermodynamic Properties of the Solution
* @{
*/
/**
* @}
* @name Mechanical Equation of State
* @{
*/
//! @name Mechanical Equation of State
//! @{
//! Report the Pressure. Units: Pa.
/*!
* For an incompressible substance, the density is independent
* of pressure. This method simply returns the stored
* pressure value.
* For an incompressible substance, the density is independent of
* pressure. This method simply returns the stored pressure value.
*/
virtual doublereal pressure() const;
@ -296,14 +272,12 @@ public:
*/
virtual doublereal thermalExpansionCoeff() const ;
/**
* @}
* @name Activities, Standard States, and Activity Concentrations
*
* This section is largely handled by parent classes, since there
* is only one species. Therefore, the activity is equal to one.
* @{
*/
//! @}
//! @name Activities, Standard States, and Activity Concentrations
//!
//! This section is largely handled by parent classes, since there
//! is only one species. Therefore, the activity is equal to one.
//! @{
//! This method returns an array of generalized concentrations
/*!
@ -378,13 +352,13 @@ public:
* values if necessary.
*
* @param uA Output vector containing the units
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
* @param k species index. Defaults to 0.
* @param sizeUA output int containing the size of the vector.
* Currently, this is equal to 6.
@ -392,14 +366,6 @@ public:
virtual void getUnitsStandardConc(doublereal* uA, int k = 0,
int sizeUA = 6) const;
//@}
/// @name Partial Molar Properties of the Solution
///
/// These properties are handled by the parent class,
/// SingleSpeciesTP
//@{
//@}
/// @name Properties of the Standard State of the Species in the Solution
//@{
@ -465,15 +431,7 @@ public:
* Length: m_kk
*/
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
/*
* ---- Critical State Properties
*/
/*
* ---- Saturation Properties
*/
// @}
/*
* @internal Initialize. This method is provided to allow
@ -484,13 +442,12 @@ public:
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
* from function importPhase.setParameters
*
* @see importCTML.cpp
*/
virtual void initThermo();
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
//! Make the default XML tree
@ -503,7 +460,6 @@ public:
//! Set the equation of state parameters
/*!
* @internal
* The number and meaning of these depends on the subclass.
*
* @param n number of parameters
* @param c array of \a n coefficients
@ -540,21 +496,19 @@ public:
*
* eosdata points to the thermo block, and looks like this:
*
* @verbatim
<phase id="stoichsolid" >
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
</phase> @endverbatim
*
* @code
* <phase id="stoichsolid" >
* <thermo model="StoichSubstance">
* <density units="g/cm3">3.52</density>
* </thermo>
* </phase>
* @endcode
*/
virtual void setParametersFromXML(const XML_Node& eosdata);
protected:
XML_Node* xdef_;
};
}
#endif

View file

@ -48,7 +48,7 @@ namespace Cantera
* The enthalpy function is given by the following relation.
*
* \f[
* \raggedright h^o_k(T,P) =
* h^o_k(T,P) =
* h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right)
* \f]
*
@ -67,13 +67,12 @@ namespace Cantera
* of pressure. The standard state gibbs free energy is obtained
* from the enthalpy and entropy functions.
*
*
* <b> Specification of Solution Thermodynamic Properties </b>
*
* All solution properties are obtained from the standard state
* species functions, since there is only one species in the phase.
*
* <b> Application within %Kinetics Managers </b>
* <b> %Application within %Kinetics Managers </b>
*
* The standard concentration is equal to 1.0. This means that the
* kinetics operator works on an (activities basis). Since this
@ -93,77 +92,11 @@ namespace Cantera
* appear in the rate constant expression, since it's a stoichiometric
* phase and the activity is always equal to 1.0.
*
* <b> Instantiation of the Class </b>
*
* The constructor for this phase is NOT located in the default ThermoFactory
* for %Cantera. However, a new %StoichSubstanceSSTP may be created by
* the following code snippets:
*
* @code
* sprintf(file_ID,"%s#NaCl(S)", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* StoichSubstanceSSTP *solid = new StoichSubstanceSSTP(*xm);
* @endcode
*
* or by the following call to importPhase():
*
* @code
* sprintf(file_ID,"%s#NaCl(S)", iFile);
* XML_Node *xm = get_XML_NameID("phase", file_ID, 0);
* StoichSubstanceSSTP solid;
* importPhase(*xm, &solid);
* @endcode
*
* <b> XML Example </b>
*
* The phase model name for this is called StoichSubstance. It must be supplied
* as the model attribute of the thermo XML element entry.
* Within the phase XML block,
* the density of the phase must be specified. An example of an XML file
* this phase is given below.
*
* @verbatim
<!-- phase NaCl(S) -->
<phase dim="3" id="NaCl(S)">
<elementArray datasrc="elements.xml">
Na Cl
</elementArray>
<speciesArray datasrc="#species_NaCl(S)"> NaCl(S) </speciesArray>
<thermo model="StoichSubstanceSSTP">
<density units="g/cm3">2.165</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<!-- species definitions -->
<speciesData id="species_NaCl(S)">
<!-- species NaCl(S) -->
<species name="NaCl(S)">
<atomArray> Na:1 Cl:1 </atomArray>
<thermo>
<Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
<floatArray size="7">
50.72389, 6.672267, -2.517167,
10.15934, -0.200675, -427.2115,
130.3973
</floatArray>
</Shomate>
</thermo>
<density units="g/cm3">2.165</density>
</species>
</speciesData> @endverbatim
*
* The model attribute, "StoichSubstanceSSTP", on the thermo element identifies the phase as being
* a StoichSubstanceSSTP object.
*
* @ingroup thermoprops
*/
class MineralEQ3 : public StoichSubstanceSSTP
{
public:
//! Default constructor for the StoichSubstanceSSTP class
MineralEQ3();
@ -209,12 +142,6 @@ public:
*/
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Utilities
* @{
*/
/**
* Equation of state flag.
*
@ -222,18 +149,8 @@ public:
*/
virtual int eosType() const;
/**
* @}
* @name Molar Thermodynamic Properties of the Solution
* @{
*/
/**
* @}
* @name Mechanical Equation of State
* @{
*/
//! @name Mechanical Equation of State
//! @{
//! Report the Pressure. Units: Pa.
/*!
@ -354,13 +271,15 @@ public:
* values if necessary.
*
* @param uA Output vector containing the units
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*
* @param k species index. Defaults to 0.
* @param sizeUA output int containing the size of the vector.
* Currently, this is equal to 6.
@ -368,14 +287,6 @@ public:
virtual void getUnitsStandardConc(doublereal* uA, int k = 0,
int sizeUA = 6) const;
//@}
/// @name Partial Molar Properties of the Solution
///
/// These properties are handled by the parent class,
/// SingleSpeciesTP
//@{
//@}
/// @name Properties of the Standard State of the Species in the Solution
//@{
@ -441,15 +352,7 @@ public:
* Length: m_kk
*/
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
/*
* ---- Critical State Properties
*/
/*
* ---- Saturation Properties
*/
//! @}
//! Internal initialization required after all species have
//! been added
@ -492,7 +395,6 @@ public:
//! Set the equation of state parameters
/*!
* @internal
* The number and meaning of these depends on the subclass.
*
* @param n number of parameters
* @param c array of \a n coefficients
@ -526,23 +428,12 @@ public:
*
* @param eosdata An XML_Node object corresponding to
* the "thermo" entry for this phase in the input file.
*
* eosdata points to the thermo block, and looks like this:
*
* @verbatim
<phase id="stoichsolid" >
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
</phase> @endverbatim
*
*/
virtual void setParametersFromXML(const XML_Node& eosdata);
doublereal LookupGe(const std::string& elemName);
void convertDGFormation();
protected:
//! Value of the Absolute Gibbs Free Energy NIST scale at T_r and P_r
/*!
* This is the NIST scale value of Gibbs free energy at T_r = 298.15
@ -552,7 +443,6 @@ protected:
*/
doublereal m_Mu0_pr_tr;
//! Input value of S_j at Tr and Pr (cal gmol-1 K-1)
/*!
* Tr = 298.15 Pr = 1 atm
@ -591,7 +481,6 @@ protected:
//! c coefficient (cal K gmol-1 K) x 10^-5
doublereal m_c;
};
}

View file

@ -22,8 +22,8 @@ namespace Cantera
/**
* @ingroup thermoprops
*
* The %SingleSpeciesTP class is a filter class for %ThermoPhase.
* What it does is to simplify the construction of %ThermoPhase
* The SingleSpeciesTP class is a filter class for ThermoPhase.
* What it does is to simplify the construction of ThermoPhase
* objects by assuming that the phase consists of one and
* only one type of species. In other words, it's a stoichiometric
* phase. However, no assumptions are made concerning the
@ -68,9 +68,7 @@ namespace Cantera
*/
class SingleSpeciesTP : public ThermoPhase
{
public:
//! Base empty constructor.
SingleSpeciesTP();
@ -99,12 +97,6 @@ public:
*/
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Information Methods
* @{
*/
/**
* Returns the equation of state type flag.
* This is a modified base class.
@ -114,8 +106,7 @@ public:
virtual int eosType() const;
/**
* @}
* @name Molar Thermodynamic Properties of the Solution
* @name Molar Thermodynamic Properties of the Solution
*
* These functions are resolved at this level, by reference
* to the partial molar functions and standard state
@ -166,35 +157,6 @@ public:
*/
doublereal cv_mole() const;
/**
* @}
* @name Mechanical Properties
* @{
*/
/**
* @}
* @name Electric Potential
*
* The phase may be at some non-zero electrical
* potential. These methods set or get the value of the
* electric potential.
*/
//@{
/**
* @}
* @name Potential Energy
*
* Species may have an additional potential energy due to the
* presence of external gravitation or electric fields. These
* methods allow specifying a potential energy for individual
* species.
* @{
*/
/**
* @}
* @name Activities, Standard State, and Activity Concentrations
@ -244,11 +206,6 @@ public:
/// to supply entries for these functions.
//@{
/*
* These functions are all resolved here to point to the
* standard state functions for species 0
*/
//! Get the array of non-dimensional species chemical potentials
//! These are partial molar Gibbs free energies.
/*!
@ -290,22 +247,15 @@ public:
/*!
* These are the phase enthalpies. \f$ h_k \f$.
*
* This function is resolved here by calling the standard state
* thermo function.
*
* @param hbar Output vector of species partial molar enthalpies.
* Length: 1. units are J/kmol.
*/
void getPartialMolarEnthalpies(doublereal* hbar) const;
//! Get the species partial molar internal energies. Units: J/kmol.
/*!
* These are the phase internal energies. \f$ u_k \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param ubar On return, Contains the internal energy of the single species
* and the phase. Units are J / kmol . Length = 1
*/
@ -315,9 +265,6 @@ public:
/*!
* This is the phase entropy. \f$ s(T,P) = s_o(T,P) \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param sbar On return, Contains the entropy of the single species
* and the phase. Units are J / kmol / K . Length = 1
*/
@ -327,9 +274,6 @@ public:
/*!
* This is the phase heat capacity. \f$ Cp(T,P) = Cp_o(T,P) \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param cpbar On return, Contains the heat capacity of the single species
* and the phase. Units are J / kmol / K . Length = 1
*/
@ -339,9 +283,6 @@ public:
/*!
* This is the phase molar volume. \f$ V(T,P) = V_o(T,P) \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param vbar On return, Contains the molar volume of the single species
* and the phase. Units are m^3 / kmol. Length = 1
*/
@ -355,13 +296,10 @@ public:
/// are not resolved at the SingleSpeciesTP level.
//@{
/**
* Get the dimensional Gibbs functions for the standard
* state of the species at the current T and P.
*
* This function is resolved here by referencing getGibbs_RT().
*
* @param gpure returns a vector of size 1, containing the Gibbs function
* Units: J/kmol.
*/
@ -380,7 +318,6 @@ public:
*/
void getStandardVolumes(doublereal* vbar) const;
//@}
/// @name Thermodynamic Values for the Species Reference State
///
@ -434,7 +371,6 @@ public:
*/
virtual void getGibbs_RT_ref(doublereal* grt) const;
/*!
* Returns the vector of the
* gibbs function of the reference state at the current temperature
@ -480,8 +416,7 @@ public:
/**
* @name Setting the State
*
* These methods set all or part of the thermodynamic
* state.
* These methods set all or part of the thermodynamic state.
* @{
*/
@ -557,7 +492,6 @@ public:
*/
void setState_TPY(doublereal t, doublereal p, const std::string& y);
//! Set the pressure (Pa) and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
@ -655,16 +589,7 @@ public:
*/
virtual void setParametersFromXML(const XML_Node& eosdata) {}
//---------------------------------------------------------
/// @name Critical state properties.
/// These methods are only implemented by some subclasses.
//@{
//@}
/// @name Saturation properties.
/// These methods are only implemented by subclasses that
/// implement full liquid-vapor equations of state.
@ -694,7 +619,6 @@ public:
//@}
/**
* @internal Initialize.
*
@ -715,7 +639,6 @@ public:
*/
virtual void initThermo();
protected:
//! The current pressure of the solution (Pa)
/*!
@ -750,8 +673,11 @@ protected:
private:
//! Error return for unhandled cases
//! Error return for unhandled cases.
/*!
* It's used when this class doesn't have an answer for the question given
* to it, because the derived class isn't overriding a function.
*
* @param msg String message
*/
doublereal err(const std::string& msg) const;
@ -760,6 +686,3 @@ private:
}
#endif

View file

@ -22,13 +22,10 @@ namespace Cantera
* Class StoichSubstance represents a stoichiometric (fixed composition)
* incompressible substance.
* \nosubgrouping
*
*/
class StoichSubstance : public ThermoPhase
{
public:
//! Default empty constructor
StoichSubstance();
@ -66,12 +63,6 @@ public:
*/
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Utilities
* @{
*/
/**
* Equation of state flag. Returns the value cStoichSubstance,
* defined in mix_defs.h.
@ -80,12 +71,8 @@ public:
return cStoichSubstance;
}
/**
* @}
* @name Molar Thermodynamic Properties of the Solution ---------
* @{
*/
//! @name Molar Thermodynamic Properties of the Solution
//! @{
/**
* Molar enthalpy. Units: J/kmol. For an incompressible,
@ -113,7 +100,6 @@ public:
*/
virtual doublereal entropy_mole() const;
/**
* Molar gibbs Function. Units: J/kmol. This is determined
* from the molar enthalpy and entropy functions.
@ -132,14 +118,9 @@ public:
*/
virtual doublereal cv_mole() const;
//@}
/**
* @name Mechanical Equation of State
* @{
*/
//! @}
//! @name Mechanical Equation of State
//! @{
//! Report the Pressure. Units: Pa.
/*!
@ -149,7 +130,6 @@ public:
*/
virtual doublereal pressure() const;
//! Set the pressure at constant temperature. Units: Pa.
/*!
* For an incompressible substance, the density is
@ -161,12 +141,9 @@ public:
*/
virtual void setPressure(doublereal p);
//@}
/**
* @name Chemical Potentials and Activities
*@{
*/
//! @}
//! @name Chemical Potentials and Activities
//! @{
/**
* This method returns the array of generalized
@ -201,7 +178,7 @@ public:
/**
* Returns the units of the standard and generalized
* concentrations Note they have the same units, as their
* concentrations. Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless.
*
@ -209,22 +186,20 @@ public:
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* uA[0] = kmol units - default = 0
* uA[1] = m units - default = 0
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
* uA[0] = kmol units - default = 0
* uA[1] = m units - default = 0
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
virtual void getUnitsStandardConc(double* uA, int k = 0,
int sizeUA = 6) const;
//@}
/// @name Partial Molar Properties of the Solution ----------------------------
/// @name Partial Molar Properties of the Solution
//@{
/**
* Get the array of non-dimensional chemical potentials
* \f$ \mu_k / \hat R T \f$.
@ -264,9 +239,8 @@ public:
*/
virtual void getPartialMolarVolumes(doublereal* vbar) const;
//@}
/// @name Properties of the Standard State of the Species in the Solution -----
/// @name Properties of the Standard State of the Species in the Solution
//@{
/**
* Get the nondimensional Enthalpy functions for the species
@ -312,7 +286,7 @@ public:
virtual void getStandardVolumes(doublereal* vol) const;
//@}
/// @name Thermodynamic Values for the Species Reference States --------------------
/// @name Thermodynamic Values for the Species Reference States
//@{
/**
@ -379,6 +353,7 @@ public:
* Length: m_kk
*/
virtual void getCp_R_ref(doublereal* cprt) const;
//! @}
virtual void initThermo();
@ -398,15 +373,9 @@ protected:
mutable vector_fp m_s0_R;
private:
void _updateThermo() const;
};
}
#endif

View file

@ -27,7 +27,6 @@ namespace Cantera
* density to pressure. This is necessary because the phase is
* incompressible. It uses a constant volume approximation.
*
*
* <b> Specification of Species Standard %State Properties </b>
*
* This class inherits from SingleSpeciesTP.
@ -47,7 +46,7 @@ namespace Cantera
* The enthalpy function is given by the following relation.
*
* \f[
* \raggedright h^o_k(T,P) =
* h^o_k(T,P) =
* h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right)
* \f]
*
@ -66,7 +65,6 @@ namespace Cantera
* of pressure. The standard state gibbs free energy is obtained
* from the enthalpy and entropy functions.
*
*
* <b> Specification of Solution Thermodynamic Properties </b>
*
* All solution properties are obtained from the standard state
@ -121,37 +119,37 @@ namespace Cantera
* the density of the phase must be specified. An example of an XML file
* this phase is given below.
*
* @verbatim
<!-- phase NaCl(S) -->
<phase dim="3" id="NaCl(S)">
<elementArray datasrc="elements.xml">
Na Cl
</elementArray>
<speciesArray datasrc="#species_NaCl(S)"> NaCl(S) </speciesArray>
<thermo model="StoichSubstanceSSTP">
<density units="g/cm3">2.165</density>
</thermo>
<transport model="None"/>
<kinetics model="none"/>
</phase>
<!-- species definitions -->
<speciesData id="species_NaCl(S)">
<!-- species NaCl(S) -->
<species name="NaCl(S)">
<atomArray> Na:1 Cl:1 </atomArray>
<thermo>
<Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
<floatArray size="7">
50.72389, 6.672267, -2.517167,
10.15934, -0.200675, -427.2115,
130.3973
</floatArray>
</Shomate>
</thermo>
<density units="g/cm3">2.165</density>
</species>
</speciesData> @endverbatim
* @code
* <!-- phase NaCl(S) -->
* <phase dim="3" id="NaCl(S)">
* <elementArray datasrc="elements.xml">
* Na Cl
* </elementArray>
* <speciesArray datasrc="#species_NaCl(S)"> NaCl(S) </speciesArray>
* <thermo model="StoichSubstanceSSTP">
* <density units="g/cm3">2.165</density>
* </thermo>
* <transport model="None"/>
* <kinetics model="none"/>
* </phase>
*
* <!-- species definitions -->
* <speciesData id="species_NaCl(S)">
* <!-- species NaCl(S) -->
* <species name="NaCl(S)">
* <atomArray> Na:1 Cl:1 </atomArray>
* <thermo>
* <Shomate Pref="1 bar" Tmax="1075.0" Tmin="250.0">
* <floatArray size="7">
* 50.72389, 6.672267, -2.517167,
* 10.15934, -0.200675, -427.2115,
* 130.3973
* </floatArray>
* </Shomate>
* </thermo>
* <density units="g/cm3">2.165</density>
* </species>
* </speciesData> @endcode
*
* The model attribute, "StoichSubstanceSSTP", on the thermo element
* identifies the phase as being a StoichSubstanceSSTP object.
@ -160,9 +158,7 @@ namespace Cantera
*/
class StoichSubstanceSSTP : public SingleSpeciesTP
{
public:
//! Default constructor for the StoichSubstanceSSTP class
StoichSubstanceSSTP();
@ -195,7 +191,7 @@ public:
*/
StoichSubstanceSSTP& operator=(const StoichSubstanceSSTP& right);
//! Destructor for the routine (virtual)
//! Destructor
virtual ~StoichSubstanceSSTP();
//! Duplication function
@ -208,12 +204,6 @@ public:
*/
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Utilities
* @{
*/
/**
* Equation of state flag.
*
@ -221,18 +211,8 @@ public:
*/
virtual int eosType() const;
/**
* @}
* @name Molar Thermodynamic Properties of the Solution
* @{
*/
/**
* @}
* @name Mechanical Equation of State
* @{
*/
//! @name Mechanical Equation of State
//! @{
//! Report the Pressure. Units: Pa.
/*!
@ -353,13 +333,15 @@ public:
* values if necessary.
*
* @param uA Output vector containing the units
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*
* @param k species index. Defaults to 0.
* @param sizeUA output int containing the size of the vector.
* Currently, this is equal to 6.
@ -367,14 +349,6 @@ public:
virtual void getUnitsStandardConc(doublereal* uA, int k = 0,
int sizeUA = 6) const;
//@}
/// @name Partial Molar Properties of the Solution
///
/// These properties are handled by the parent class,
/// SingleSpeciesTP
//@{
//@}
/// @name Properties of the Standard State of the Species in the Solution
//@{
@ -440,15 +414,7 @@ public:
* Length: m_kk
*/
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
/*
* ---- Critical State Properties
*/
/*
* ---- Saturation Properties
*/
// @}
/*
* @internal Initialize. This method is provided to allow
@ -465,7 +431,6 @@ public:
*/
virtual void initThermo();
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
//! Set the equation of state parameters
@ -508,32 +473,26 @@ public:
*
* eosdata points to the thermo block, and looks like this:
*
* @verbatim
<phase id="stoichsolid" >
<thermo model="StoichSubstance">
<density units="g/cm3">3.52</density>
</thermo>
</phase> @endverbatim
*
* @code
* <phase id="stoichsolid" >
* <thermo model="StoichSubstance">
* <density units="g/cm3">3.52</density>
* </thermo>
* </phase>
* @endcode
*/
virtual void setParametersFromXML(const XML_Node& eosdata);
protected:
};
//! Class %electrodeElectron represents an electron in a
//! metal using the Standard hydrogen reference electrode
/*!
*
* The class is based on the electron have a chemical potential
* equal to one-half of the entropy of the H2 gas at 1 bar.
*
*/
class electrodeElectron : public StoichSubstanceSSTP
{
public:
//! Default constructor for the electrodeElectron class
electrodeElectron();
@ -566,7 +525,7 @@ public:
*/
electrodeElectron& operator=(const electrodeElectron& right);
//! Destructor for the routine (virtual)
//! Destructor
virtual ~electrodeElectron();
void setParametersFromXML(const XML_Node& eosdata);

View file

@ -52,7 +52,7 @@ class WaterProps;
* - Delta_Hfo_idealgas(298.15) = -241.826 kJ/gmol
* - So_idealgas(298.15, 1bar) = 188.835 J/gmolK
*
* ref -> (http://webbook.nist.gov)
* (From http://webbook.nist.gov)
*
* The "o" here refers to a hypothetical ideal gas state. The way
* we achieve this in practice is to evaluate at a very low pressure
@ -104,30 +104,27 @@ class WaterProps;
* An example of an XML Element named phase setting up a WaterSSTP object with
* id "water" is given below.
*
* @verbatim
<!-- phase water -->
<phase dim="3" id="water">
<elementArray datasrc="elements.xml">O H </elementArray>
<speciesArray datasrc="#species_data">H2O</speciesArray>
<state>
<temperature units="K">300.0</temperature>
<pressure units="Pa">101325.0</pressure>
</state>
<thermo model="PureLiquidWater"/>
<kinetics model="none"/>
</phase>
@endverbatim
* @code
* <!-- phase water -->
* <phase dim="3" id="water">
* <elementArray datasrc="elements.xml">O H </elementArray>
* <speciesArray datasrc="#species_data">H2O</speciesArray>
* <state>
* <temperature units="K">300.0</temperature>
* <pressure units="Pa">101325.0</pressure>
* </state>
* <thermo model="PureLiquidWater"/>
* <kinetics model="none"/>
* </phase>
* @endcode
*
* Note the model "PureLiquidWater" indicates the usage of the WaterSSTP object.
*
* @ingroup thermoprops
*
*/
class WaterSSTP : public SingleSpeciesTP
{
public:
//! Base constructor
WaterSSTP();
@ -157,25 +154,17 @@ public:
//! Duplicator from a ThermoPhase object
ThermoPhase* duplMyselfAsThermoPhase() const;
/**
*
* @name Utilities
* @{
*/
virtual int eosType() const {
return -1;
}
/**
* @}
* @name Molar Thermodynamic Properties of the Solution --------------
* @{
*/
//! @name Molar Thermodynamic Properties of the Solution
//! @{
virtual doublereal cv_mole() const;
//@}
/// @name Mechanical Equation of State Properties ---------------------
/// @name Mechanical Equation of State Properties
//@{
virtual doublereal pressure() const;
@ -212,28 +201,9 @@ public:
*/
virtual doublereal dthermalExpansionCoeffdT() const;
/**
* @}
* @name Potential Energy
* @{
*/
/**
* @}
* @name Activities, Standard States, and Activity Concentrations
* @{
*/
//@}
/// @name Partial Molar Properties of the Solution -----------------
//@{
//@}
/// @name Properties of the Standard State of the Species
// in the Solution --
//@{
//! @}
//! @name Properties of the Standard State of the Species in the Solution
//! @{
//! Get the gibbs function for the species
//! standard states at the current T and P of the solution.
@ -256,14 +226,12 @@ public:
//! Get the array of nondimensional Enthalpy functions for the standard state species
//! at the current <I>T</I> and <I>P</I> of the solution.
/*!
*
* @param hrt Vector of length m_kk, which on return
* will contain the nondimensional
* standard state enthalpy of species <I>k</I>
*/
void getEnthalpy_RT(doublereal* hrt) const;
//! Get the nondimensional Entropies for the species
//! standard states at the current T and P of the solution.
/*!
@ -276,7 +244,6 @@ public:
//! Get the nondimensional heat capacity at constant pressure
//! function for the species standard states at the current T and P of the solution.
/*!
*
* @param cpr Vector of length m_kk, which on return
* will contain the nondimensional
* constant pressure heat capacity for species <I>k</I>
@ -287,7 +254,6 @@ public:
//! internal Energies of the standard state at the current
//! temperature and pressure of the solution for each species.
/*!
*
* @param urt Output vector of standard state nondimensional internal energies.
* Length: m_kk.
*/
@ -299,7 +265,6 @@ public:
* All functions in this group need to be overrided, because
* the m_spthermo SpeciesThermo function is not adequate for
* the real equation of state.
*
*/
//@{
@ -322,12 +287,10 @@ public:
*/
virtual void getGibbs_RT_ref(doublereal* grt) const;
/*!
* Returns the vector of the
* gibbs function of the reference state at the current temperature
* of the solution and the reference pressure for the species.
* units = J/kmol
* Returns the vector of the gibbs function of the reference state at the
* current temperature of the solution and the reference pressure for the
* species. units = J/kmol
*
* @param g Output vector containing the reference state
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
@ -365,6 +328,7 @@ public:
* Length: m_kk.
*/
virtual void getStandardVolumes_ref(doublereal* vol) const;
//! @}
/// critical temperature
virtual doublereal critTemperature() const;
@ -375,11 +339,6 @@ public:
/// critical density
virtual doublereal critDensity() const;
/// saturation temperature
//virtual doublereal satTemperature(doublereal p) const;
/// saturation pressure
/*!
* @param t Temperature (kelvin)
@ -465,7 +424,6 @@ public:
//! Set equation of state parameter values from XML entries.
/*!
*
* This method is called by function importPhase() in
* file importCTML.cpp when processing a phase definition in
* an input file. It should be overloaded in subclasses to set
@ -488,9 +446,7 @@ public:
return m_waterProps;
}
protected:
/**
* @internal
* This internal routine must be overwritten because
@ -545,6 +501,3 @@ private:
}
#endif

View file

@ -9,7 +9,6 @@
* Copyright (2005) Sandia Corporation. Under the terms of
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
* U.S. Government retains certain rights in this software.
*
*/
#include "cantera/base/ct_defs.h"
@ -23,27 +22,16 @@
#include "cantera/thermo/SimpleThermo.h"
namespace Cantera
{
//====================================================================================================================
/*
* ---- Constructors -------
*/
//====================================================================================================================
/*
* Default Constructor for the FixedChemPotSSTP class
*/
FixedChemPotSSTP::FixedChemPotSSTP() :
SingleSpeciesTP(),
chemPot_(0.0)
{
}
//====================================================================================================================
// Create and initialize a FixedChemPotSSTP ThermoPhase object
// from an ASCII input file
/*
* @param infile name of the input file
* @param id name of the phase id in the file.
* If this is blank, the first phase in the file is used.
*/
FixedChemPotSSTP::FixedChemPotSSTP(const std::string& infile, std::string id) :
SingleSpeciesTP(),
chemPot_(0.0)
@ -66,12 +54,7 @@ FixedChemPotSSTP::FixedChemPotSSTP(const std::string& infile, std::string id) :
}
importPhase(*xphase, this);
}
//====================================================================================================================
// Full Constructor.
/*
* @param phaseRef XML node pointing to a FixedChemPotSSTP description
* @param id Id of the phase.
*/
FixedChemPotSSTP::FixedChemPotSSTP(XML_Node& xmlphase, const std::string& id) :
SingleSpeciesTP(),
chemPot_(0.0)
@ -96,7 +79,7 @@ FixedChemPotSSTP::FixedChemPotSSTP(XML_Node& xmlphase, const std::string& id) :
chemPot_ = (m_h0_RT[0] - m_s0_R[0]) * GasConstant * temperature();
}
}
//====================================================================================================================
FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) :
SingleSpeciesTP(),
chemPot_(0.0)
@ -146,21 +129,12 @@ FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) :
s = 0;
}
//====================================================================================================================
// Copy constructor
/*
* @param right Object to be copied
*/
FixedChemPotSSTP::FixedChemPotSSTP(const FixedChemPotSSTP& right) :
SingleSpeciesTP()
{
*this = operator=(right);
}
//====================================================================================================================
// Assignment operator
/*
* @param right Object to be copied
*/
FixedChemPotSSTP&
FixedChemPotSSTP::operator=(const FixedChemPotSSTP& right)
{
@ -171,156 +145,68 @@ FixedChemPotSSTP::operator=(const FixedChemPotSSTP& right)
}
return *this;
}
//====================================================================================================================
/*
* Destructor for the routine (virtual)
*
*/
FixedChemPotSSTP::~FixedChemPotSSTP()
{
}
//====================================================================================================================
// Duplication function
/*
* This virtual function is used to create a duplicate of the
* current phase. It's used to duplicate the phase when given
* a ThermoPhase pointer to the phase.
*
* @return It returns a ThermoPhase pointer.
*/
ThermoPhase* FixedChemPotSSTP::duplMyselfAsThermoPhase() const
{
return new FixedChemPotSSTP(*this);
}
//====================================================================================================================
/*
* ---- Utilities -----
*/
/*
* Equation of state flag. Returns the value cStoichSubstance,
* defined in mix_defs.h.
*/
int FixedChemPotSSTP::eosType() const
{
return cFixedChemPot;
}
/*
* ---- Molar Thermodynamic properties of the solution ----
*/
/*
* ----- Mechanical Equation of State ------
*/
//====================================================================================================================
/*
* Pressure. Units: Pa.
* For an incompressible substance, the density is independent
* of pressure. This method simply returns the stored
* pressure value.
*/
doublereal FixedChemPotSSTP::pressure() const
{
return m_press;
}
//====================================================================================================================
/*
* Set the pressure at constant temperature. Units: Pa.
* For an incompressible substance, the density is
* independent of pressure. Therefore, this method only
* stores the specified pressure value. It does not
* modify the density.
*/
void FixedChemPotSSTP::setPressure(doublereal p)
{
m_press = p;
}
//====================================================================================================================
/*
* The isothermal compressibility. Units: 1/Pa.
* The isothermal compressibility is defined as
* \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal FixedChemPotSSTP::isothermalCompressibility() const
{
return 0.0;
}
//====================================================================================================================
/*
* The thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal FixedChemPotSSTP::thermalExpansionCoeff() const
{
return 0.0;
}
//====================================================================================================================
/*
* ---- Chemical Potentials and Activities ----
*/
//====================================================================================================================
/*
* This method returns the array of generalized
* concentrations. For a stoichiometric substance, there is
* only one species, and the generalized concentration is 1.0.
*/
void FixedChemPotSSTP::
getActivityConcentrations(doublereal* c) const
void FixedChemPotSSTP::getActivityConcentrations(doublereal* c) const
{
c[0] = 1.0;
}
//====================================================================================================================
/*
* The standard concentration. This is defined as the concentration
* by which the generalized concentration is normalized to produce
* the activity.
*/
doublereal FixedChemPotSSTP::standardConcentration(size_t k) const
{
return 1.0;
}
//====================================================================================================================
/*
* Returns the natural logarithm of the standard
* concentration of the kth species
*/
doublereal FixedChemPotSSTP::logStandardConc(size_t k) const
{
return 0.0;
}
//====================================================================================================================
/*
* Returns the units of the standard and generalized
* concentrations Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void FixedChemPotSSTP::
getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
{
@ -328,167 +214,97 @@ getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
uA[i] = 0;
}
}
//====================================================================================================================
/*
* ---- Partial Molar Properties of the Solution ----
*/
void FixedChemPotSSTP::getPartialMolarVolumes(doublereal* vbar) const
{
vbar[0] = 0.0;
}
//====================================================================================================================
/*
* ---- Properties of the Standard State of the Species in the Solution
* ----
* Properties of the Standard State of the Species in the Solution
*/
//====================================================================================================================
/*
* Get the array of chemical potentials at unit activity
* \f$ \mu^0_k \f$.
*
* For a stoichiometric substance, there is no activity term in
* the chemical potential expression, and therefore the
* standard chemical potential and the chemical potential
* are both equal to the molar Gibbs function.
*/
void FixedChemPotSSTP::
getStandardChemPotentials(doublereal* mu0) const
void FixedChemPotSSTP::getStandardChemPotentials(doublereal* mu0) const
{
mu0[0] = chemPot_;
}
//====================================================================================================================
/*
* Get the nondimensional Enthalpy functions for the species
* at their standard states at the current
* <I>T</I> and <I>P</I> of the solution.
* Molar enthalpy. Units: J/kmol. For an incompressible,
* stoichiometric substance, the internal energy is
* independent of pressure, and therefore the molar enthalpy
* is \f[ \hat h(T, P) = \hat u(T) + P \hat v \f], where the
* molar specific volume is constant.
*/
void FixedChemPotSSTP::getEnthalpy_RT(doublereal* hrt) const
{
double rt = _RT();
hrt[0] = chemPot_ / rt;
}
//====================================================================================================================
/*
* Get the array of nondimensional Entropy functions for the
* standard state species
* at the current <I>T</I> and <I>P</I> of the solution.
*/
void FixedChemPotSSTP::getEntropy_R(doublereal* sr) const
{
sr[0] = 0.0;
}
//====================================================================================================================
/*
* Get the nondimensional Gibbs functions for the species
* at their standard states of solution at the current T and P
* of the solution
*/
void FixedChemPotSSTP::getGibbs_RT(doublereal* grt) const
{
double rt = _RT();
grt[0] = chemPot_ / rt;
}
//====================================================================================================================
/*
* Get the nondimensional Gibbs functions for the standard
* state of the species at the current T and P.
*/
void FixedChemPotSSTP::getCp_R(doublereal* cpr) const
{
cpr[0] = 0.0;
}
//====================================================================================================================
/*
* Molar internal energy (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*/
void FixedChemPotSSTP::getIntEnergy_RT(doublereal* urt) const
{
urt[0] = chemPot_;
}
//====================================================================================================================
// Get the molar volumes of each species in their standard
// states at the current <I>T</I> and <I>P</I> of the solution.
/*
* units = m^3 / kmol
*
* We set this to zero
*
* @param vbar On output this contains the standard volume of the species
* and phase (m^3/kmol). Vector of length 1
*/
void FixedChemPotSSTP::getStandardVolumes(doublereal* vbar) const
{
vbar[0] = 0.0;
}
//====================================================================================================================
/*
* ---- Thermodynamic Values for the Species Reference States ----
*/
//====================================================================================================================
void FixedChemPotSSTP::getIntEnergy_RT_ref(doublereal* urt) const
{
urt[0] = chemPot_;
}
//====================================================================================================================
void FixedChemPotSSTP::getEnthalpy_RT_ref(doublereal* hrt) const
{
double rt = _RT();
hrt[0] = chemPot_ / rt;
}
//====================================================================================================================
void FixedChemPotSSTP::getEntropy_R_ref(doublereal* sr) const
{
sr[0] = 0.0;
}
//====================================================================================================================
void FixedChemPotSSTP::getGibbs_RT_ref(doublereal* grt) const
{
double rt = _RT();
grt[0] = chemPot_ / rt;
}
//====================================================================================================================
void FixedChemPotSSTP::getGibbs_ref(doublereal* g) const
{
g[0] = chemPot_;
}
//====================================================================================================================
void FixedChemPotSSTP::getCp_R_ref(doublereal* cpr) const
{
cpr[0] = 0.0;
}
//====================================================================================================================
/*
* ---- Saturation Properties
*/
//====================================================================================================================
/*
* ---- Initialization and Internal functions
*/
//====================================================================================================================
/*
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
* resize internal work arrays that must have an entry for
* each species. The base class implementation does nothing,
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
*
* @see importCTML.cpp
*/
void FixedChemPotSSTP::initThermo()
{
/*
@ -496,7 +312,6 @@ void FixedChemPotSSTP::initThermo()
*/
SingleSpeciesTP::initThermo();
}
//====================================================================================================================
void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
{
@ -517,36 +332,19 @@ void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
chemPot_ = val;
}
SingleSpeciesTP::initThermoXML(phaseNode, id);
}
//====================================================================================================================
/*
* setParameters:
*
* Generic routine that is used to set the parameters used
* by this model.
* C[0] = density of phase [ kg/m3 ]
*/
void FixedChemPotSSTP::setParameters(int n, doublereal* const c)
{
chemPot_ = c[0];
}
//====================================================================================================================
/*
* getParameters:
*
* Generic routine that is used to get the parameters used
* by this model.
* n = 1
* C[0] = density of phase [ kg/m3 ]
*/
void FixedChemPotSSTP::getParameters(int& n, doublereal* const c) const
{
n = 1;
c[0] = chemPot_;
}
//====================================================================================================================
void FixedChemPotSSTP::setParametersFromXML(const XML_Node& eosdata)
{
std::string model = eosdata["model"];
@ -559,14 +357,10 @@ void FixedChemPotSSTP::setParametersFromXML(const XML_Node& eosdata)
chemPot_ = val;
}
}
//====================================================================================================================
// Function to set the chemical potential directly
/*
* @param chemPot Value of the chemical potential (units J/kmol)
*/
void FixedChemPotSSTP::setChemicalPotential(doublereal chemPot)
{
chemPot_ = chemPot;
}
//====================================================================================================================
}

View file

@ -26,23 +26,13 @@ namespace Cantera
/*
* ---- Constructors -------
*/
//====================================================================================================================
/*
* Default Constructor for the MetalSHEelectrons class
*/
MetalSHEelectrons::MetalSHEelectrons():
SingleSpeciesTP(),
xdef_(0)
{
}
//====================================================================================================================
// Create and initialize a MetalSHEelectrons ThermoPhase object
// from an ASCII input file
/*
* @param infile name of the input file
* @param id name of the phase id in the file.
* If this is blank, the first phase in the file is used.
*/
MetalSHEelectrons::MetalSHEelectrons(const std::string& infile, std::string id) :
SingleSpeciesTP(),
xdef_(0)
@ -71,12 +61,7 @@ MetalSHEelectrons::MetalSHEelectrons(const std::string& infile, std::string id)
}
importPhase(*xphase, this);
}
//====================================================================================================================
// Full Constructor.
/*
* @param phaseRef XML node pointing to a MetalSHEelectrons description
* @param id Id of the phase.
*/
MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id) :
SingleSpeciesTP(),
xdef_(0)
@ -96,32 +81,20 @@ MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id)
}
importPhase(xmlphase, this);
}
//====================================================================================================================
// Copy constructor
/*
* @param right Object to be copied
*/
MetalSHEelectrons::MetalSHEelectrons(const MetalSHEelectrons& right) :
SingleSpeciesTP()
{
operator=(right);
}
//====================================================================================================================
/*
* Destructor for the routine (virtual)
*
*/
MetalSHEelectrons::~MetalSHEelectrons()
{
if (xdef_) {
delete xdef_;
}
}
//====================================================================================================================
// Assignment operator
/*
* @param right Object to be copied
*/
MetalSHEelectrons&
MetalSHEelectrons::operator=(const MetalSHEelectrons& right)
{
@ -136,150 +109,65 @@ MetalSHEelectrons::operator=(const MetalSHEelectrons& right)
return *this;
}
//====================================================================================================================
// Duplication function
/*
* This virtual function is used to create a duplicate of the
* current phase. It's used to duplicate the phase when given
* a ThermoPhase pointer to the phase.
*
* @return It returns a ThermoPhase pointer.
*/
ThermoPhase* MetalSHEelectrons::duplMyselfAsThermoPhase() const
{
return new MetalSHEelectrons(*this);
}
//====================================================================================================================
/*
* ---- Utilities -----
*/
/*
* Equation of state flag. Returns the value cStoichSubstance,
* defined in mix_defs.h.
*/
int MetalSHEelectrons::eosType() const
{
return cMetalSHEelectrons;
}
//====================================================================================================================
/*
* ---- Molar Thermodynamic properties of the solution ----
*/
/**
* ----- Mechanical Equation of State ------
*/
//====================================================================================================================
/*
* Pressure. Units: Pa.
* For an incompressible substance, the density is independent
* of pressure. This method simply returns the stored
* pressure value.
*/
doublereal MetalSHEelectrons::pressure() const
{
return m_press;
}
//====================================================================================================================
/*
* Set the pressure at constant temperature. Units: Pa.
* For an incompressible substance, the density is
* independent of pressure. Therefore, this method only
* stores the specified pressure value. It does not
* modify the density.
*/
void MetalSHEelectrons::setPressure(doublereal p)
{
m_press = p;
}
//====================================================================================================================
/*
* The isothermal compressibility. Units: 1/Pa.
* The isothermal compressibility is defined as
* \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal MetalSHEelectrons::isothermalCompressibility() const
{
return 1.0/pressure();
}
//====================================================================================================================
/*
* The thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal MetalSHEelectrons::thermalExpansionCoeff() const
{
return 1.0/temperature();
}
//====================================================================================================================
/*
* ---- Chemical Potentials and Activities ----
*/
//====================================================================================================================
/*
* This method returns the array of generalized
* concentrations. For a stoichiometric substance, there is
* only one species, and the generalized concentration is 1.0.
*/
void MetalSHEelectrons::
getActivityConcentrations(doublereal* c) const
void MetalSHEelectrons::getActivityConcentrations(doublereal* c) const
{
c[0] = 1.0;
}
//====================================================================================================================
/*
* The standard concentration. This is defined as the concentration
* by which the generalized concentration is normalized to produce
* the activity.
*/
doublereal MetalSHEelectrons::standardConcentration(size_t k) const
{
return 1.0;
}
//====================================================================================================================
/*
* Returns the natural logarithm of the standard
* concentration of the kth species
*/
doublereal MetalSHEelectrons::logStandardConc(size_t k) const
{
return 0.0;
}
//====================================================================================================================
/*
* Returns the units of the standard and generalized
* concentrations Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void MetalSHEelectrons::
getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
{
@ -287,114 +175,48 @@ getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
uA[i] = 0;
}
}
//====================================================================================================================
/*
* ---- Partial Molar Properties of the Solution ----
*/
//====================================================================================================================
/*
* ---- Properties of the Standard State of the Species in the Solution
* ----
*/
//====================================================================================================================
/*
* Get the array of chemical potentials at unit activity
* \f$ \mu^0_k \f$.
*
* For a stoichiometric substance, there is no activity term in
* the chemical potential expression, and therefore the
* standard chemical potential and the chemical potential
* are both equal to the molar Gibbs function.
* Properties of the Standard State of the Species in the Solution
*/
void MetalSHEelectrons::
getStandardChemPotentials(doublereal* mu0) const
{
getGibbs_RT(mu0);
mu0[0] *= GasConstant * temperature();
}
//====================================================================================================================
/*
* Get the nondimensional Enthalpy functions for the species
* at their standard states at the current
* <I>T</I> and <I>P</I> of the solution.
* Molar enthalpy. Units: J/kmol. For an incompressible,
* stoichiometric substance, the internal energy is
* independent of pressure, and therefore the molar enthalpy
* is \f[ \hat h(T, P) = \hat u(T) + P \hat v \f], where the
* molar specific volume is constant.
*/
void MetalSHEelectrons::getEnthalpy_RT(doublereal* hrt) const
{
getEnthalpy_RT_ref(hrt);
}
//====================================================================================================================
/*
* Get the array of nondimensional Entropy functions for the
* standard state species
* at the current <I>T</I> and <I>P</I> of the solution.
*/
void MetalSHEelectrons::getEntropy_R(doublereal* sr) const
{
getEntropy_R_ref(sr);
doublereal tmp = log(pressure() / m_p0);
sr[0] -= tmp;
}
//====================================================================================================================
/*
* Get the nondimensional Gibbs functions for the species
* at their standard states of solution at the current T and P
* of the solution
*/
void MetalSHEelectrons::getGibbs_RT(doublereal* grt) const
{
getGibbs_RT_ref(grt);
doublereal tmp = log(pressure() / m_p0);
grt[0] += tmp;
}
//====================================================================================================================
/*
* Get the nondimensional Gibbs functions for the standard
* state of the species at the current T and P.
*/
void MetalSHEelectrons::getCp_R(doublereal* cpr) const
{
_updateThermo();
cpr[0] = m_cp0_R[0];
}
//====================================================================================================================
/*
* Molar internal energy (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*/
void MetalSHEelectrons::getIntEnergy_RT(doublereal* urt) const
{
getEnthalpy_RT(urt);
urt[0] -= 1.0;
}
//====================================================================================================================
/*
* ---- Thermodynamic Values for the Species Reference States ----
*/
/*
* Molar internal energy or the reference state at the current
* temperature, T (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*
* Note, this is equal to the standard state internal energy
* evaluated at the reference pressure.
*/
void MetalSHEelectrons::getIntEnergy_RT_ref(doublereal* urt) const
{
_updateThermo();
@ -403,29 +225,10 @@ void MetalSHEelectrons::getIntEnergy_RT_ref(doublereal* urt) const
urt[0] = m_h0_RT[0] - PV / RT;
}
/*
* ---- Saturation Properties
*/
/*
* ---- Initialization and Internal functions
*/
//====================================================================================================================
/*
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
* resize internal work arrays that must have an entry for
* each species. The base class implementation does nothing,
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
*
* @see importCTML.cpp
*/
void MetalSHEelectrons::initThermo()
{
/*
@ -433,7 +236,6 @@ void MetalSHEelectrons::initThermo()
*/
SingleSpeciesTP::initThermo();
}
//====================================================================================================================
void MetalSHEelectrons::initThermoXML(XML_Node& phaseNode, const std::string& id)
{
@ -452,7 +254,7 @@ void MetalSHEelectrons::initThermoXML(XML_Node& phaseNode, const std::string& id
setDensity(dens);
SingleSpeciesTP::initThermoXML(phaseNode, id);
}
//====================================================================================================================
XML_Node* MetalSHEelectrons::makeDefaultXMLTree()
{
XML_Node* xtop = new XML_Node("ctml", 0);
@ -505,46 +307,20 @@ XML_Node* MetalSHEelectrons::makeDefaultXMLTree()
return xtop;
}
//====================================================================================================================
/*
* setParameters:
*
* Generic routine that is used to set the parameters used
* by this model.
* C[0] = density of phase [ kg/m3 ]
*/
void MetalSHEelectrons::setParameters(int n, doublereal* const c)
{
doublereal rho = c[0];
setDensity(rho);
}
//====================================================================================================================
/*
* getParameters:
*
* Generic routine that is used to get the parameters used
* by this model.
* n = 1
* C[0] = density of phase [ kg/m3 ]
*/
void MetalSHEelectrons::getParameters(int& n, doublereal* const c) const
{
doublereal rho = density();
n = 1;
c[0] = rho;
}
//====================================================================================================================
/*
* Reads an xml data block for the parameters needed by this
* routine. eosdata is a reference to the xml thermo block, and looks
* like this:
*
* <phase id="stoichsolid" >
* <thermo model="StoichSubstance">
* <density units="g/cm3">3.52</density>
* </thermo>
* </phase>
*/
void MetalSHEelectrons::setParametersFromXML(const XML_Node& eosdata)
{
std::string model = eosdata["model"];
@ -558,6 +334,5 @@ void MetalSHEelectrons::setParametersFromXML(const XML_Node& eosdata)
}
setDensity(rho);
}
//====================================================================================================================
}

View file

@ -31,21 +31,11 @@ namespace Cantera
* ---- Constructors -------
*/
/*
* Default Constructor for the MineralEQ3 class
*/
MineralEQ3::MineralEQ3():
StoichSubstanceSSTP()
{
}
// Create and initialize a MineralEQ3 ThermoPhase object
// from an ASCII input file
/*
* @param infile name of the input file
* @param id name of the phase id in the file.
* If this is blank, the first phase in the file is used.
*/
MineralEQ3::MineralEQ3(const std::string& infile, std::string id) :
StoichSubstanceSSTP()
{
@ -68,11 +58,6 @@ MineralEQ3::MineralEQ3(const std::string& infile, std::string id) :
importPhase(*xphase, this);
}
// Full Constructor.
/*
* @param phaseRef XML node pointing to a MineralEQ3 description
* @param id Id of the phase.
*/
MineralEQ3::MineralEQ3(XML_Node& xmlphase, const std::string& id) :
StoichSubstanceSSTP()
{
@ -92,20 +77,12 @@ MineralEQ3::MineralEQ3(XML_Node& xmlphase, const std::string& id) :
importPhase(xmlphase, this);
}
//! Copy constructor
/*!
* @param right Object to be copied
*/
MineralEQ3::MineralEQ3(const MineralEQ3& right) :
StoichSubstanceSSTP()
{
*this = operator=(right);
}
//! Assignment operator
/*!
* @param right Object to be copied
*/
MineralEQ3&
MineralEQ3::operator=(const MineralEQ3& right)
{
@ -125,98 +102,43 @@ MineralEQ3::operator=(const MineralEQ3& right)
return *this;
}
/*
* Destructor for the routine (virtual)
*
*/
MineralEQ3::~MineralEQ3()
{
}
// Duplication function
/*
* This virtual function is used to create a duplicate of the
* current phase. It's used to duplicate the phase when given
* a ThermoPhase pointer to the phase.
*
* @return It returns a ThermoPhase pointer.
*/
ThermoPhase* MineralEQ3::duplMyselfAsThermoPhase() const
{
return new MineralEQ3(*this);
}
/*
* ---- Utilities -----
*/
/*
* Equation of state flag. Returns the value cStoichSubstance,
* defined in mix_defs.h.
*/
int MineralEQ3::eosType() const
{
return cStoichSubstance;
}
/*
* ---- Molar Thermodynamic properties of the solution ----
*/
/**
* ----- Mechanical Equation of State ------
*/
/*
* Pressure. Units: Pa.
* For an incompressible substance, the density is independent
* of pressure. This method simply returns the stored
* pressure value.
*/
doublereal MineralEQ3::pressure() const
{
return m_press;
}
/*
* Set the pressure at constant temperature. Units: Pa.
* For an incompressible substance, the density is
* independent of pressure. Therefore, this method only
* stores the specified pressure value. It does not
* modify the density.
*/
void MineralEQ3::setPressure(doublereal p)
{
m_press = p;
}
/*
* The isothermal compressibility. Units: 1/Pa.
* The isothermal compressibility is defined as
* \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal MineralEQ3::isothermalCompressibility() const
{
return 0.0;
}
/*
* The thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal MineralEQ3::thermalExpansionCoeff() const
{
return 0.0;
@ -226,54 +148,22 @@ doublereal MineralEQ3::thermalExpansionCoeff() const
* ---- Chemical Potentials and Activities ----
*/
/*
* This method returns the array of generalized
* concentrations. For a stoichiometric substance, there is
* only one species, and the generalized concentration is 1.0.
*/
void MineralEQ3::
getActivityConcentrations(doublereal* c) const
{
c[0] = 1.0;
}
/*
* The standard concentration. This is defined as the concentration
* by which the generalized concentration is normalized to produce
* the activity.
*/
doublereal MineralEQ3::standardConcentration(size_t k) const
{
return 1.0;
}
/*
* Returns the natural logarithm of the standard
* concentration of the kth species
*/
doublereal MineralEQ3::logStandardConc(size_t k) const
{
return 0.0;
}
/*
* Returns the units of the standard and generalized
* concentrations Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void MineralEQ3::
getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
{
@ -283,25 +173,9 @@ getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
}
/*
* ---- Partial Molar Properties of the Solution ----
* Properties of the Standard State of the Species in the Solution
*/
/*
* ---- Properties of the Standard State of the Species in the Solution
* ----
*/
/*
* Get the array of chemical potentials at unit activity
* \f$ \mu^0_k \f$.
*
* For a stoichiometric substance, there is no activity term in
* the chemical potential expression, and therefore the
* standard chemical potential and the chemical potential
* are both equal to the molar Gibbs function.
*/
void MineralEQ3::
getStandardChemPotentials(doublereal* mu0) const
{
@ -309,16 +183,6 @@ getStandardChemPotentials(doublereal* mu0) const
mu0[0] *= GasConstant * temperature();
}
/*
* Get the nondimensional Enthalpy functions for the species
* at their standard states at the current
* <I>T</I> and <I>P</I> of the solution.
* Molar enthalpy. Units: J/kmol. For an incompressible,
* stoichiometric substance, the internal energy is
* independent of pressure, and therefore the molar enthalpy
* is \f[ \hat h(T, P) = \hat u(T) + P \hat v \f], where the
* molar specific volume is constant.
*/
void MineralEQ3::getEnthalpy_RT(doublereal* hrt) const
{
getEnthalpy_RT_ref(hrt);
@ -327,46 +191,23 @@ void MineralEQ3::getEnthalpy_RT(doublereal* hrt) const
hrt[0] += presCorrect / RT;
}
/*
* Get the array of nondimensional Entropy functions for the
* standard state species
* at the current <I>T</I> and <I>P</I> of the solution.
*/
void MineralEQ3::getEntropy_R(doublereal* sr) const
{
getEntropy_R_ref(sr);
}
/*
* Get the nondimensional Gibbs functions for the species
* at their standard states of solution at the current T and P
* of the solution
*/
void MineralEQ3::getGibbs_RT(doublereal* grt) const
{
getEnthalpy_RT(grt);
grt[0] -= m_s0_R[0];
}
/*
* Get the nondimensional Gibbs functions for the standard
* state of the species at the current T and P.
*/
void MineralEQ3::getCp_R(doublereal* cpr) const
{
_updateThermo();
cpr[0] = m_cp0_R[0];
}
/*
* Molar internal energy (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*/
void MineralEQ3::getIntEnergy_RT(doublereal* urt) const
{
_updateThermo();
@ -378,19 +219,7 @@ void MineralEQ3::getIntEnergy_RT(doublereal* urt) const
/*
* ---- Thermodynamic Values for the Species Reference States ----
*/
/*
* Molar internal energy or the reference state at the current
* temperature, T (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*
* Note, this is equal to the standard state internal energy
* evaluated at the reference pressure.
*/
void MineralEQ3::getIntEnergy_RT_ref(doublereal* urt) const
{
_updateThermo();
@ -399,59 +228,24 @@ void MineralEQ3::getIntEnergy_RT_ref(doublereal* urt) const
urt[0] = m_h0_RT[0] - PV / RT;
}
/*
* ---- Saturation Properties
*/
/*
* ---- Initialization and Internal functions
*/
/**
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
* resize internal work arrays that must have an entry for
* each species. The base class implementation does nothing,
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
*
* @see importCTML.cpp
*/
void MineralEQ3::initThermo()
{
/*
* Call the base class thermo initializer
*/
StoichSubstanceSSTP::initThermo();
}
/**
* setParameters:
*
* Generic routine that is used to set the parameters used
* by this model.
* C[0] = density of phase [ kg/m3 ]
*/
void MineralEQ3::setParameters(int n, doublereal* const c)
{
doublereal rho = c[0];
setDensity(rho);
}
/**
* getParameters:
*
* Generic routine that is used to get the parameters used
* by this model.
* n = 1
* C[0] = density of phase [ kg/m3 ]
*/
void MineralEQ3::getParameters(int& n, doublereal* const c) const
{
doublereal rho = density();
@ -459,25 +253,6 @@ void MineralEQ3::getParameters(int& n, doublereal* const c) const
c[0] = rho;
}
// Initialize the phase parameters from an XML file.
/*
* initThermoXML() (virtual from ThermoPhase)
*
* This gets called from importPhase(). It processes the XML file
* after the species are set up. This is the main routine for
* reading in activity coefficient parameters.
*
* @param phaseNode This object must be the phase node of a
* complete XML tree
* description of the phase, including all of the
* species data. In other words while "phase" must
* point to an XML phase object, it must have
* sibling nodes "speciesData" that describe
* the species in the phase.
* @param id ID of the phase. If nonnull, a check is done
* to see if phaseNode is pointing to the phase
* with the correct id.
*/
void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id)
{
/*
@ -536,12 +311,9 @@ void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id)
m_b = ctml::getFloatDefaultUnits(MinEQ3node, "b", "cal/gmol/K2");
m_c = ctml::getFloatDefaultUnits(MinEQ3node, "c", "cal-K/gmol");
convertDGFormation();
}
void MineralEQ3::setParametersFromXML(const XML_Node& eosdata)
{
std::string model = eosdata["model"];
@ -597,5 +369,3 @@ void MineralEQ3::convertDGFormation()
}
}

View file

@ -17,17 +17,6 @@ using namespace std;
namespace Cantera
{
/*
* -------------- Constructors ------------------------------------
*
*/
// Base empty constructor.
/*
* Base constructor -> does nothing but called the inherited
* class constructor
*/
SingleSpeciesTP::SingleSpeciesTP() :
ThermoPhase(),
m_press(OneAtm),
@ -36,11 +25,6 @@ SingleSpeciesTP::SingleSpeciesTP() :
{
}
//! Copy constructor
/*!
* @param right Object to be copied
*/
SingleSpeciesTP::SingleSpeciesTP(const SingleSpeciesTP& right):
ThermoPhase(),
m_press(OneAtm),
@ -50,10 +34,6 @@ SingleSpeciesTP::SingleSpeciesTP(const SingleSpeciesTP& right):
*this = operator=(right);
}
//! Assignment operator
/*!
* @param right Object to be copied
*/
SingleSpeciesTP& SingleSpeciesTP::operator=(const SingleSpeciesTP& right)
{
if (&right != this) {
@ -68,59 +48,25 @@ SingleSpeciesTP& SingleSpeciesTP::operator=(const SingleSpeciesTP& right)
return *this;
}
/*
* destructor -> does nothing but implicitly calls the inherited
* class destructors.
*/
SingleSpeciesTP::~SingleSpeciesTP()
{
}
//! Duplication function
/*!
* This virtual function is used to create a duplicate of the
* current phase. It's used to duplicate the phase when given
* a ThermoPhase pointer to the phase.
*
* @return It returns a ThermoPhase pointer.
*/
ThermoPhase* SingleSpeciesTP::duplMyselfAsThermoPhase() const
{
return new SingleSpeciesTP(*this);
}
/**
*
* ------------------- Utilities ----------------------------------
*
*/
/**
* eosType():
* Creates an error because this is not a fully formed
* class
*/
int SingleSpeciesTP::eosType() const
{
err("eosType");
return -1;
}
/**
/*
* ------------ Molar Thermodynamic Properties --------------------
*
*
* For this single species template, the molar properties of
* the mixture are identified with the partial molar properties
* of species number 0. The partial molar property routines
* are called to evaluate these functions.
*/
/**
* enthalpy_mole():
*
* Molar enthalpy. Units: J/kmol.
*/
doublereal SingleSpeciesTP::enthalpy_mole() const
{
double hbar;
@ -128,11 +74,6 @@ doublereal SingleSpeciesTP::enthalpy_mole() const
return hbar;
}
/**
* enthalpy_mole():
*
* Molar internal energy. Units: J/kmol.
*/
doublereal SingleSpeciesTP::intEnergy_mole() const
{
double ubar;
@ -140,11 +81,6 @@ doublereal SingleSpeciesTP::intEnergy_mole() const
return ubar;
}
/**
* entropy_mole():
*
* Molar entropy of the mixture. Units: J/kmol/K.
*/
doublereal SingleSpeciesTP::entropy_mole() const
{
double sbar;
@ -152,11 +88,6 @@ doublereal SingleSpeciesTP::entropy_mole() const
return sbar;
}
/**
* gibbs_mole():
*
* Molar Gibbs free energy of the mixture. Units: J/kmol/K.
*/
doublereal SingleSpeciesTP::gibbs_mole() const
{
double gbar;
@ -169,12 +100,6 @@ doublereal SingleSpeciesTP::gibbs_mole() const
return gbar;
}
/**
* cp_mole():
*
* Molar heat capacity at constant pressure of the mixture.
* Units: J/kmol/K.
*/
doublereal SingleSpeciesTP::cp_mole() const
{
double cpbar;
@ -189,23 +114,17 @@ doublereal SingleSpeciesTP::cp_mole() const
return cpbar;
}
/*
* cv_mole():
*
* Molar heat capacity at constant volume of the mixture.
* Units: J/kmol/K.
*
* For single species, we go directory to the
* general Cp - Cv relation
*
* Cp = Cv + alpha**2 * V * T / beta
*
* where
* alpha = volume thermal expansion coefficient
* beta = isothermal compressibility
*/
doublereal SingleSpeciesTP::cv_mole() const
{
/*
* For single species, we go directory to the general Cp - Cv relation
*
* Cp = Cv + alpha**2 * V * T / beta
*
* where
* alpha = volume thermal expansion coefficient
* beta = isothermal compressibility
*/
doublereal cvbar = cp_mole();
doublereal alpha = thermalExpansionCoeff();
doublereal beta = isothermalCompressibility();
@ -218,42 +137,15 @@ doublereal SingleSpeciesTP::cv_mole() const
return cvbar;
}
/*
* ----------- Chemical Potentials and Activities ----------------------
*/
/*
* ----------- Partial Molar Properties of the Solution -----------------
*
* These are calculated by reference to the standard state properties
* of the zeroeth species.
*/
// Get the array of chemical potentials at unit activity
/*
* These are the standard state chemical potentials. \f$ \mu^0_k \f$.
*
* @param mu On return, Contains the chemical potential of the single species
* and the phase. Units are J / kmol . Length = 1
*/
void SingleSpeciesTP::getChemPotentials(doublereal* mu) const
{
getStandardChemPotentials(mu);
}
// Get the array of non-dimensional species chemical potentials
// These are partial molar Gibbs free energies.
/*
* These are the standard state dimensionless chemical potentials.
* \f$ \mu_k / \hat R T \f$.
*
* Units: unitless
*
* @param murt On return, Contains the chemical potential / RT of the single species
* and the phase. Units are unitless. Length = 1
*/
void SingleSpeciesTP::getChemPotentials_RT(doublereal* murt) const
{
getStandardChemPotentials(murt);
@ -261,29 +153,11 @@ void SingleSpeciesTP::getChemPotentials_RT(doublereal* murt) const
murt[0] /= rt;
}
// Get the species electrochemical potentials. Units: J/kmol.
/*
* This method adds a term \f$ Fz_k \phi_k \f$ to
* each chemical potential.
*
* This is resolved here. A single species phase
* is not allowed to have anything other than a zero charge.
*
* @param murt On return, Contains the chemical potential / RT of the single species
* and the phase. Units are unitless. Length = 1
*/
void SingleSpeciesTP::getElectrochemPotentials(doublereal* mu) const
{
getChemPotentials(mu);
}
// Get the species partial molar enthalpies. Units: J/kmol.
/*
* These are the phase enthalpies. \f$ h_k \f$.
*
* @param hbar On return, Contains the enthalpy of the single species
* and the phase. Units are J / kmol . Length = 1
*/
void SingleSpeciesTP::
getPartialMolarEnthalpies(doublereal* hbar) const
{
@ -292,16 +166,6 @@ getPartialMolarEnthalpies(doublereal* hbar) const
hbar[0] *= _rt;
}
// Get the species partial molar internal energies. Units: J/kmol.
/*
* These are the phase internal energies. \f$ u_k \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param ubar On return, Contains the internal energy of the single species
* and the phase. Units are J / kmol . Length = 1
*/
void SingleSpeciesTP::
getPartialMolarIntEnergies(doublereal* ubar) const
{
@ -310,16 +174,6 @@ getPartialMolarIntEnergies(doublereal* ubar) const
ubar[0] *= _rt;
}
// Get the species partial molar entropy. Units: J/kmol K.
/*
* This is the phase entropy. \f$ s(T,P) = s_o(T,P) \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param sbar On return, Contains the entropy of the single species
* and the phase. Units are J / kmol / K . Length = 1
*/
void SingleSpeciesTP::
getPartialMolarEntropies(doublereal* sbar) const
{
@ -327,32 +181,12 @@ getPartialMolarEntropies(doublereal* sbar) const
sbar[0] *= GasConstant;
}
// Get the species partial molar Heat Capacities. Units: J/ kmol K.
/*
* This is the phase heat capacity. \f$ Cp(T,P) = Cp_o(T,P) \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param cpbar On return, Contains the heat capacity of the single species
* and the phase. Units are J / kmol / K . Length = 1
*/
void SingleSpeciesTP::getPartialMolarCp(doublereal* cpbar) const
{
getCp_R(cpbar);
cpbar[0] *= GasConstant;
}
// Get the species partial molar volumes. Units: m^3/kmol.
/*
* This is the phase molar volume. \f$ V(T,P) = V_o(T,P) \f$.
*
* This member function is resolved here. A single species phase obtains its
* thermo from the standard state function.
*
* @param vbar On return, Contains the molar volume of the single species
* and the phase. Units are m^3 / kmol. Length = 1
*/
void SingleSpeciesTP::getPartialMolarVolumes(doublereal* vbar) const
{
double mw = molecularWeight(0);
@ -361,32 +195,15 @@ void SingleSpeciesTP::getPartialMolarVolumes(doublereal* vbar) const
}
/*
* ----- Properties of the Standard State of the Species in the Solution
* -----
* Properties of the Standard State of the Species in the Solution
*/
/*
* Get the dimensional Gibbs functions for the standard
* state of the species at the current T and P.
*/
void SingleSpeciesTP::getPureGibbs(doublereal* gpure) const
{
getGibbs_RT(gpure);
gpure[0] *= GasConstant * temperature();
}
// Get the molar volumes of each species in their standard
// states at the current <I>T</I> and <I>P</I> of the solution.
/*
* units = m^3 / kmol
*
* We resolve this function at this level, by assigning
* the molecular weight divided by the phase density
*
* @param vbar On output this contains the standard volume of the species
* and phase (m^3/kmol). Vector of length 1
*/
void SingleSpeciesTP::getStandardVolumes(doublereal* vbar) const
{
double mw = molecularWeight(0);
@ -398,60 +215,30 @@ void SingleSpeciesTP::getStandardVolumes(doublereal* vbar) const
* ---- Thermodynamic Values for the Species Reference States -------
*/
/**
* Returns the vector of nondimensional
* enthalpies of the reference state at the current temperature
* of the solution and the reference pressure for the species.
*
*
*/
void SingleSpeciesTP::getEnthalpy_RT_ref(doublereal* hrt) const
{
_updateThermo();
hrt[0] = m_h0_RT[0];
}
/**
* Returns the vector of nondimensional
* enthalpies of the reference state at the current temperature
* of the solution and the reference pressure for the species.
*/
void SingleSpeciesTP::getGibbs_RT_ref(doublereal* grt) const
{
_updateThermo();
grt[0] = m_h0_RT[0] - m_s0_R[0];
}
/**
* Returns the vector of the
* gibbs function of the reference state at the current temperature
* of the solution and the reference pressure for the species.
* units = J/kmol
*/
void SingleSpeciesTP::getGibbs_ref(doublereal* g) const
{
getGibbs_RT_ref(g);
g[0] *= GasConstant * temperature();
}
/**
* Returns the vector of nondimensional
* entropies of the reference state at the current temperature
* of the solution and the reference pressure for the species.
*/
void SingleSpeciesTP::getEntropy_R_ref(doublereal* er) const
{
_updateThermo();
er[0] = m_s0_R[0];
}
/**
* Get the nondimensional Gibbs functions for the standard
* state of the species at the current T and reference pressure
* for the species.
*/
void SingleSpeciesTP::getCp_R_ref(doublereal* cpr) const
{
_updateThermo();
@ -462,7 +249,6 @@ void SingleSpeciesTP::getCp_R_ref(doublereal* cpr) const
* ------------------ Setting the State ------------------------
*/
void SingleSpeciesTP::setState_TPX(doublereal t, doublereal p,
const doublereal* x)
{
@ -611,11 +397,6 @@ void SingleSpeciesTP::setState_SV(doublereal s, doublereal v,
throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt));
}
/*
* This private function throws a cantera exception. It's used when
* this class doesn't have an answer for the question given to it,
* because the derived class isn't overriding a function.
*/
doublereal SingleSpeciesTP::err(const std::string& msg) const
{
throw CanteraError("SingleSpeciesTP","Base class method "
@ -624,24 +405,8 @@ doublereal SingleSpeciesTP::err(const std::string& msg) const
return 0;
}
/*
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
* resize internal work arrays that must have an entry for
* each species. The base class implementation does nothing,
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
*
* Inheriting objects should call this function
*
* @see importCTML.cpp
*/
void SingleSpeciesTP::initThermo()
{
/*
* Make sure there is one and only one species in this phase.
*/
@ -669,13 +434,6 @@ void SingleSpeciesTP::initThermo()
ThermoPhase::initThermo();
}
/*
* _updateThermo():
*
* This crucial internal routine calls the species thermo
* update program to calculate new species Cp0, H0, and
* S0 whenever the temperature has changed.
*/
void SingleSpeciesTP::_updateThermo() const
{
doublereal tnow = temperature();
@ -687,7 +445,3 @@ void SingleSpeciesTP::_updateThermo() const
}
}

View file

@ -13,8 +13,6 @@
namespace Cantera
{
// Default empty constructor
StoichSubstance::StoichSubstance() :
m_press(OneAtm),
m_p0(OneAtm),
@ -22,15 +20,6 @@ StoichSubstance::StoichSubstance() :
{
}
// Copy Constructor
/*
* Copy constructor for the object. Constructed
* object will be a clone of this object, but will
* also own all of its data.
* This is a wrapper around the assignment operator
*
* @param right Object to be copied.
*/
StoichSubstance::StoichSubstance(const StoichSubstance& right) :
m_press(OneAtm),
m_p0(OneAtm),
@ -39,14 +28,6 @@ StoichSubstance::StoichSubstance(const StoichSubstance& right) :
*this = operator=(right);
}
// Assignment operator
/*
* Assignment operator for the object. Constructed
* object will be a clone of this object, but will
* also own all of its data.
*
* @param right Object to be copied.
*/
StoichSubstance& StoichSubstance::
operator=(const StoichSubstance& right)
{
@ -62,20 +43,11 @@ operator=(const StoichSubstance& right)
return *this;
}
// Duplicator from the %ThermoPhase parent class
/*
* Given a pointer to a %ThermoPhase object, this function will
* duplicate the %ThermoPhase object and all underlying structures.
* This is basically a wrapper around the copy constructor.
*
* @return returns a pointer to a %ThermoPhase
*/
ThermoPhase* StoichSubstance::duplMyselfAsThermoPhase() const
{
return new StoichSubstance(*this);
}
// Destructor
StoichSubstance::~StoichSubstance()
{
}
@ -297,7 +269,3 @@ void StoichSubstance::setParametersFromXML(const XML_Node& eosdata)
}
}

View file

@ -27,21 +27,11 @@ namespace Cantera
* ---- Constructors -------
*/
/*
* Default Constructor for the StoichSubstanceSSTP class
*/
StoichSubstanceSSTP::StoichSubstanceSSTP():
SingleSpeciesTP()
{
}
// Create and initialize a StoichSubstanceSSTP ThermoPhase object
// from an ASCII input file
/*
* @param infile name of the input file
* @param id name of the phase id in the file.
* If this is blank, the first phase in the file is used.
*/
StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string id) :
SingleSpeciesTP()
{
@ -64,11 +54,6 @@ StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string
importPhase(*xphase, this);
}
// Full Constructor.
/*
* @param phaseRef XML node pointing to a StoichSubstanceSSTP description
* @param id Id of the phase.
*/
StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, const std::string& id) :
SingleSpeciesTP()
{
@ -88,20 +73,12 @@ StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, const std::string&
importPhase(xmlphase, this);
}
//! Copy constructor
/*!
* @param right Object to be copied
*/
StoichSubstanceSSTP::StoichSubstanceSSTP(const StoichSubstanceSSTP& right) :
SingleSpeciesTP()
{
*this = operator=(right);
}
//! Assignment operator
/*!
* @param right Object to be copied
*/
StoichSubstanceSSTP&
StoichSubstanceSSTP::operator=(const StoichSubstanceSSTP& right)
{
@ -111,98 +88,43 @@ StoichSubstanceSSTP::operator=(const StoichSubstanceSSTP& right)
return *this;
}
/*
* Destructor for the routine (virtual)
*
*/
StoichSubstanceSSTP::~StoichSubstanceSSTP()
{
}
// Duplication function
/*
* This virtual function is used to create a duplicate of the
* current phase. It's used to duplicate the phase when given
* a ThermoPhase pointer to the phase.
*
* @return It returns a ThermoPhase pointer.
*/
ThermoPhase* StoichSubstanceSSTP::duplMyselfAsThermoPhase() const
{
return new StoichSubstanceSSTP(*this);
}
/*
* ---- Utilities -----
*/
/*
* Equation of state flag. Returns the value cStoichSubstance,
* defined in mix_defs.h.
*/
int StoichSubstanceSSTP::eosType() const
{
return cStoichSubstance;
}
/*
* ---- Molar Thermodynamic properties of the solution ----
*/
/**
* ----- Mechanical Equation of State ------
*/
/*
* Pressure. Units: Pa.
* For an incompressible substance, the density is independent
* of pressure. This method simply returns the stored
* pressure value.
*/
doublereal StoichSubstanceSSTP::pressure() const
{
return m_press;
}
/*
* Set the pressure at constant temperature. Units: Pa.
* For an incompressible substance, the density is
* independent of pressure. Therefore, this method only
* stores the specified pressure value. It does not
* modify the density.
*/
void StoichSubstanceSSTP::setPressure(doublereal p)
{
m_press = p;
}
/*
* The isothermal compressibility. Units: 1/Pa.
* The isothermal compressibility is defined as
* \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal StoichSubstanceSSTP::isothermalCompressibility() const
{
return 0.0;
}
/*
* The thermal expansion coefficient. Units: 1/K.
* The thermal expansion coefficient is defined as
*
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*
* It's equal to zero for this model, since the molar volume
* doesn't change with pressure or temperature.
*/
doublereal StoichSubstanceSSTP::thermalExpansionCoeff() const
{
return 0.0;
@ -212,54 +134,22 @@ doublereal StoichSubstanceSSTP::thermalExpansionCoeff() const
* ---- Chemical Potentials and Activities ----
*/
/*
* This method returns the array of generalized
* concentrations. For a stoichiometric substance, there is
* only one species, and the generalized concentration is 1.0.
*/
void StoichSubstanceSSTP::
getActivityConcentrations(doublereal* c) const
{
c[0] = 1.0;
}
/*
* The standard concentration. This is defined as the concentration
* by which the generalized concentration is normalized to produce
* the activity.
*/
doublereal StoichSubstanceSSTP::standardConcentration(size_t k) const
{
return 1.0;
}
/*
* Returns the natural logarithm of the standard
* concentration of the kth species
*/
doublereal StoichSubstanceSSTP::logStandardConc(size_t k) const
{
return 0.0;
}
/*
* Returns the units of the standard and generalized
* concentrations Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless.
*
* This routine is used in print out applications where the
* units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files.
*
* uA[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class.
* uA[2] = kg units - default = 0;
* uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0;
* uA[5] = time units - default = 0
*/
void StoichSubstanceSSTP::
getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
{
@ -269,25 +159,9 @@ getUnitsStandardConc(doublereal* uA, int k, int sizeUA) const
}
/*
* ---- Partial Molar Properties of the Solution ----
* Properties of the Standard State of the Species in the Solution
*/
/*
* ---- Properties of the Standard State of the Species in the Solution
* ----
*/
/*
* Get the array of chemical potentials at unit activity
* \f$ \mu^0_k \f$.
*
* For a stoichiometric substance, there is no activity term in
* the chemical potential expression, and therefore the
* standard chemical potential and the chemical potential
* are both equal to the molar Gibbs function.
*/
void StoichSubstanceSSTP::
getStandardChemPotentials(doublereal* mu0) const
{
@ -295,16 +169,6 @@ getStandardChemPotentials(doublereal* mu0) const
mu0[0] *= GasConstant * temperature();
}
/*
* Get the nondimensional Enthalpy functions for the species
* at their standard states at the current
* <I>T</I> and <I>P</I> of the solution.
* Molar enthalpy. Units: J/kmol. For an incompressible,
* stoichiometric substance, the internal energy is
* independent of pressure, and therefore the molar enthalpy
* is \f[ \hat h(T, P) = \hat u(T) + P \hat v \f], where the
* molar specific volume is constant.
*/
void StoichSubstanceSSTP::getEnthalpy_RT(doublereal* hrt) const
{
getEnthalpy_RT_ref(hrt);
@ -313,46 +177,23 @@ void StoichSubstanceSSTP::getEnthalpy_RT(doublereal* hrt) const
hrt[0] += presCorrect / RT;
}
/*
* Get the array of nondimensional Entropy functions for the
* standard state species
* at the current <I>T</I> and <I>P</I> of the solution.
*/
void StoichSubstanceSSTP::getEntropy_R(doublereal* sr) const
{
getEntropy_R_ref(sr);
}
/*
* Get the nondimensional Gibbs functions for the species
* at their standard states of solution at the current T and P
* of the solution
*/
void StoichSubstanceSSTP::getGibbs_RT(doublereal* grt) const
{
getEnthalpy_RT(grt);
grt[0] -= m_s0_R[0];
}
/*
* Get the nondimensional Gibbs functions for the standard
* state of the species at the current T and P.
*/
void StoichSubstanceSSTP::getCp_R(doublereal* cpr) const
{
_updateThermo();
cpr[0] = m_cp0_R[0];
}
/*
* Molar internal energy (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*/
void StoichSubstanceSSTP::getIntEnergy_RT(doublereal* urt) const
{
_updateThermo();
@ -364,19 +205,7 @@ void StoichSubstanceSSTP::getIntEnergy_RT(doublereal* urt) const
/*
* ---- Thermodynamic Values for the Species Reference States ----
*/
/*
* Molar internal energy or the reference state at the current
* temperature, T (J/kmol).
* For an incompressible,
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*
* Note, this is equal to the standard state internal energy
* evaluated at the reference pressure.
*/
void StoichSubstanceSSTP::getIntEnergy_RT_ref(doublereal* urt) const
{
_updateThermo();
@ -385,29 +214,10 @@ void StoichSubstanceSSTP::getIntEnergy_RT_ref(doublereal* urt) const
urt[0] = m_h0_RT[0] - PV / RT;
}
/*
* ---- Saturation Properties
*/
/*
* ---- Initialization and Internal functions
*/
/**
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
* species have been added. For example, it might be used to
* resize internal work arrays that must have an entry for
* each species. The base class implementation does nothing,
* and subclasses that do not require initialization do not
* need to overload this method. When importing a CTML phase
* description, this method is called just prior to returning
* from function importPhase.
*
* @see importCTML.cpp
*/
void StoichSubstanceSSTP::initThermo()
{
/*
@ -436,7 +246,6 @@ void StoichSubstanceSSTP::initThermo()
SingleSpeciesTP::initThermo();
}
void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
{
/*
@ -452,27 +261,12 @@ void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
SingleSpeciesTP::initThermoXML(phaseNode, id);
}
/**
* setParameters:
*
* Generic routine that is used to set the parameters used
* by this model.
* C[0] = density of phase [ kg/m3 ]
*/
void StoichSubstanceSSTP::setParameters(int n, doublereal* const c)
{
doublereal rho = c[0];
setDensity(rho);
}
/**
* getParameters:
*
* Generic routine that is used to get the parameters used
* by this model.
* n = 1
* C[0] = density of phase [ kg/m3 ]
*/
void StoichSubstanceSSTP::getParameters(int& n, doublereal* const c) const
{
doublereal rho = density();
@ -480,17 +274,6 @@ void StoichSubstanceSSTP::getParameters(int& n, doublereal* const c) const
c[0] = rho;
}
/*
* Reads an xml data block for the parameters needed by this
* routine. eosdata is a reference to the xml thermo block, and looks
* like this:
*
* <phase id="stoichsolid" >
* <thermo model="StoichSubstance">
* <density units="g/cm3">3.52</density>
* </thermo>
* </phase>
*/
void StoichSubstanceSSTP::setParametersFromXML(const XML_Node& eosdata)
{
std::string model = eosdata["model"];
@ -502,25 +285,13 @@ void StoichSubstanceSSTP::setParametersFromXML(const XML_Node& eosdata)
setDensity(rho);
}
// ------ Methods of class electrodeElectron ------
/*
* Default Constructor for the electrodeElectron class
*/
electrodeElectron::electrodeElectron():
StoichSubstanceSSTP()
{
}
// Create and initialize a electrodeElectron ThermoPhase object
// from an ASCII input file
/*
* @param infile name of the input file
* @param id name of the phase id in the file.
* If this is blank, the first phase in the file is used.
*/
electrodeElectron::electrodeElectron(const std::string& infile, std::string id) :
StoichSubstanceSSTP()
{
@ -543,11 +314,6 @@ electrodeElectron::electrodeElectron(const std::string& infile, std::string id)
importPhase(*xphase, this);
}
// Full Constructor.
/*
* @param phaseRef XML node pointing to a electrodeElectron description
* @param id Id of the phase.
*/
electrodeElectron::electrodeElectron(XML_Node& xmlphase, const std::string& id) :
StoichSubstanceSSTP()
{
@ -567,20 +333,12 @@ electrodeElectron::electrodeElectron(XML_Node& xmlphase, const std::string& id)
importPhase(xmlphase, this);
}
//! Copy constructor
/*!
* @param right Object to be copied
*/
electrodeElectron::electrodeElectron(const electrodeElectron& right) :
StoichSubstanceSSTP()
{
*this = operator=(right);
}
//! Assignment operator
/*!
* @param right Object to be copied
*/
electrodeElectron&
electrodeElectron::operator=(const electrodeElectron& right)
{
@ -590,10 +348,6 @@ electrodeElectron::operator=(const electrodeElectron& right)
return *this;
}
/*
* Destructor for the routine (virtual)
*
*/
electrodeElectron::~electrodeElectron()
{
}
@ -621,5 +375,3 @@ void electrodeElectron::setParameters(int n, doublereal* const c)
}
}

View file

@ -23,10 +23,6 @@ using namespace std;
namespace Cantera
{
/**
* Basic list of constructors and duplicators
*/
WaterSSTP::WaterSSTP() :
SingleSpeciesTP(),
m_sub(0),
@ -39,7 +35,6 @@ WaterSSTP::WaterSSTP() :
{
}
WaterSSTP::WaterSSTP(const std::string& inputFile, const std::string& id) :
SingleSpeciesTP(),
m_sub(0),
@ -53,7 +48,6 @@ WaterSSTP::WaterSSTP(const std::string& inputFile, const std::string& id) :
initThermoFile(inputFile, id);
}
WaterSSTP::WaterSSTP(XML_Node& phaseRoot, const std::string& id) :
SingleSpeciesTP(),
m_sub(0),
@ -67,7 +61,6 @@ WaterSSTP::WaterSSTP(XML_Node& phaseRoot, const std::string& id) :
importPhase(*findXMLPhase(&phaseRoot, id), this);
}
WaterSSTP::WaterSSTP(const WaterSSTP& b) :
SingleSpeciesTP(b),
m_sub(0),
@ -88,9 +81,6 @@ WaterSSTP::WaterSSTP(const WaterSSTP& b) :
*this = b;
}
/*
* Assignment operator
*/
WaterSSTP& WaterSSTP::operator=(const WaterSSTP& b)
{
if (&b == this) {
@ -110,7 +100,6 @@ WaterSSTP& WaterSSTP::operator=(const WaterSSTP& b)
return *this;
}
ThermoPhase* WaterSSTP::duplMyselfAsThermoPhase() const
{
return new WaterSSTP(*this);
@ -130,7 +119,6 @@ void WaterSSTP::initThermo()
void WaterSSTP::
initThermoXML(XML_Node& phaseNode, const std::string& id)
{
/*
* Do initializations that don't depend on knowing the XML file
*/
@ -230,9 +218,6 @@ setParametersFromXML(const XML_Node& eosdata)
eosdata._require("model","PureLiquidWater");
}
/*
* Return the molar dimensionless enthalpy
*/
void WaterSSTP::getEnthalpy_RT(doublereal* hrt) const
{
double T = temperature();
@ -240,29 +225,18 @@ void WaterSSTP::getEnthalpy_RT(doublereal* hrt) const
*hrt = (h + EW_Offset)/(GasConstant*T);
}
/*
* Calculate the internal energy in mks units of
* J kmol-1
*/
void WaterSSTP::getIntEnergy_RT(doublereal* ubar) const
{
doublereal u = m_sub->intEnergy();
*ubar = (u + EW_Offset)/GasConstant;
}
/*
* Calculate the dimensionless entropy
*/
void WaterSSTP::getEntropy_R(doublereal* sr) const
{
doublereal s = m_sub->entropy();
sr[0] = (s + SW_Offset) / GasConstant;
}
/*
* Calculate the Gibbs free energy in mks units of
* J kmol-1 K-1.
*/
void WaterSSTP::getGibbs_RT(doublereal* grt) const
{
double T = temperature();
@ -273,10 +247,6 @@ void WaterSSTP::getGibbs_RT(doublereal* grt) const
}
}
/*
* Calculate the Gibbs free energy in mks units of
* J kmol-1 K-1.
*/
void WaterSSTP::getStandardChemPotentials(doublereal* gss) const
{
double T = temperature();
@ -293,19 +263,12 @@ void WaterSSTP::getCp_R(doublereal* cpr) const
cpr[0] = cp / GasConstant;
}
/*
* Calculate the constant volume heat capacity
* in mks units of J kmol-1 K-1
*/
doublereal WaterSSTP::cv_mole() const
{
doublereal cv = m_sub->cv();
return cv;
}
// @name Thermodynamic Values for the Species Reference State
void WaterSSTP::getEnthalpy_RT_ref(doublereal* hrt) const
{
doublereal p = pressure();
@ -416,11 +379,6 @@ void WaterSSTP::getStandardVolumes_ref(doublereal* vol) const
dd = m_sub->density(T, p, waterState, dens);
}
/*
* Calculate the pressure (Pascals), given the temperature and density
* Temperature: kelvin
* rho: density in kg m-3
*/
doublereal WaterSSTP::pressure() const
{
doublereal p = m_sub->pressure();
@ -444,30 +402,12 @@ setPressure(doublereal p)
setDensity(dd);
}
// Returns the isothermal compressibility. Units: 1/Pa.
/*
* The isothermal compressibility is defined as
* \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f]
* or
* \f[
* \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T
* \f]
*/
doublereal WaterSSTP::isothermalCompressibility() const
{
doublereal val = m_sub->isothermalCompressibility();
return val;
}
// Return the volumetric thermal expansion coefficient. Units: 1/K.
/*
* The thermal expansion coefficient is defined as
* \f[
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
* \f]
*/
doublereal WaterSSTP::thermalExpansionCoeff() const
{
doublereal val = m_sub->coeffThermExp();
@ -492,26 +432,21 @@ doublereal WaterSSTP::dthermalExpansionCoeffdT() const
return val;
}
// critical temperature
doublereal WaterSSTP::critTemperature() const
{
return m_sub->Tcrit();
}
// critical pressure
doublereal WaterSSTP::critPressure() const
{
return m_sub->Pcrit();
}
// critical density
doublereal WaterSSTP::critDensity() const
{
return m_sub->Rhocrit();
}
void WaterSSTP::setTemperature(const doublereal temp)
{
Phase::setTemperature(temp);
@ -526,7 +461,6 @@ void WaterSSTP::setDensity(const doublereal dens)
m_sub->setState_TR(temp, dens);
}
// saturation pressure
doublereal WaterSSTP::satPressure(doublereal t) const
{
doublereal tsave = temperature();
@ -536,7 +470,6 @@ doublereal WaterSSTP::satPressure(doublereal t) const
return pp;
}
// Return the fraction of vapor at the current conditions
doublereal WaterSSTP::vaporFraction() const
{
if (temperature() >= m_sub->Tcrit()) {
@ -552,5 +485,4 @@ doublereal WaterSSTP::vaporFraction() const
return 0.0;
}
}