Doxygen work for PDSS

added phaseNode XML pointer to installSpecies routines.
This commit is contained in:
Harry Moffat 2008-01-30 17:54:12 +00:00
parent d344208d26
commit b72ca7f04a
9 changed files with 218 additions and 135 deletions

View file

@ -642,7 +642,7 @@ namespace Cantera {
doublereal HMWSoln::isothermalCompressibility() const {
throw CanteraError("HMWSoln::isothermalCompressibility",
"unimplemented");
return 0.0;
//return 0.0;
}
/**

View file

@ -224,43 +224,49 @@ namespace Cantera {
setParametersFromXML(const XML_Node& eosdata) {
}
/**
* Return the molar enthalpy in units of J kmol-1
*
// Return the molar enthalpy in units of J kmol-1
/*
* Returns the species standard state enthalpy in J kmol-1 at the
* current temperature and pressure.
* (NOTE: assumes that ThermoPhase Ref Polynomials are up-to-date)
*/
doublereal PDSS::
enthalpy_mole() const {
doublereal PDSS::enthalpy_mole() const {
//m_tp->_updateThermo();
m_temp = m_tp->temperature();
double RT = GasConstant * m_temp;
return m_h0_RT_ptr[m_spindex] * RT;
}
/**
* Calculate the internal energy in mks units of
* J kmol-1
// Return the molar internal Energy in units of J kmol-1
/*
* Returns the species standard state internal Energy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state internal Energy in J kmol-1
*/
doublereal PDSS::
intEnergy_mole() const {
throw CanteraError("PDSS::enthalpy_mole()", "unimplemented");
doublereal PDSS::intEnergy_mole() const {
throw CanteraError("PDSS::intEnergy_mole()", "unimplemented");
return (0.0);
}
/**
* Calculate the entropy in mks units of
* J kmol-1 K-1
// Return the molar entropy in units of J kmol-1 K-1
/*
* Returns the species standard state entropy in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state entropy in J kmol-1 K-1
*/
doublereal PDSS::
entropy_mole() const {
doublereal PDSS::entropy_mole() const {
throw CanteraError("PDSS::entropy_mole()", "unimplemented");
return (0.0);
}
/**
* Calculate the Gibbs free energy in mks units of
* J kmol-1 K-1.
// Return the molar gibbs free energy in units of J kmol-1
/*
* Returns the species standard state gibbs free energy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state gibbs free energy in J kmol-1
*/
doublereal PDSS::
gibbs_mole() const {
@ -268,26 +274,29 @@ namespace Cantera {
return (0.0);
}
/**
* Calculate the constant pressure heat capacity
* in mks units of J kmol-1 K-1
// Return the molar const pressure heat capacity in units of J kmol-1 K-1
/*
* Returns the species standard state Cp in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cp in J kmol-1 K-1
*/
doublereal PDSS::
cp_mole() const {
doublereal PDSS::cp_mole() const {
throw CanteraError("PDSS::cp_mole()", "unimplemented");
return (0.0);
}
/**
* Calculate the constant volume heat capacity
* in mks units of J kmol-1 K-1
// Return the molar const volume heat capacity in units of J kmol-1 K-1
/*
* Returns the species standard state Cv in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cv in J kmol-1 K-1
*/
doublereal PDSS::
cv_mole() const {
doublereal PDSS::cv_mole() const {
throw CanteraError("PDSS::cv_mole()", "unimplemented");
return (0.0);
}
/**
* Return the difference in enthalpy between current p
@ -334,17 +343,19 @@ namespace Cantera {
return (0.0);
}
/**
* Calculate the difference in the constant pressure heat capacity
* between the current p and the ref p0,
* in mks units of J kmol-1 K-1
// Return the molar const volume heat capacity in units of J kmol-1 K-1
/*
* Returns the species standard state Cv in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cv in J kmol-1 K-1
*/
doublereal PDSS::
cpDelp_mole() const {
throw CanteraError("PDSS::cpDelp_mole()", "unimplemented");
return (0.0);
}
/**
* Calculate the difference in constant volume heat capacity
* between the current p and the ref p0

View file

@ -27,9 +27,28 @@ namespace Cantera {
class SpeciesThermo;
/**
* Class for pressure dependent standard states.
//! Virtual base class for a species with a pressure dependent
//! standard state
/*!
* Virtual base class for calculation of the
* pressure dependent standard state for a single species
*
* Class %PDSS is the base class
* for a family of classes that compute properties of a set of
* species in their standard states at a range of temperatures
* and pressures. The independent variables for this object
* are temperature and pressure.
* The class may mave a reference to a SpeciesThermo object
* which handles the calculation of the reference state temperature
* behavior of a subset of species.
*
* This class is analagous to the SpeciesThermoInterpType
* class, except that the standard state inherently incorporates
* the pressure dependence.
*
* The class operates on a setState temperature and pressure basis.
* It only recalculates the standard state when the setState functions
* for temperature and pressure are called.
*
*/
class PDSS {
@ -37,9 +56,18 @@ namespace Cantera {
public:
/**
* Basic list of constructors and duplicators
* Empty Constructor
*/
PDSS();
//! Constructor that initializes the object by examining the XML entries
//! from the ThermoPhase object
/*!
* This function calls the constructPDSS member function.
*
* @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
*/
PDSS(ThermoPhase *tp, int spindex);
//! Copy Constructor
@ -54,8 +82,35 @@ namespace Cantera {
*/
PDSS& operator=(const PDSS&b);
//! Constructor that initializes the object by examining the input file
//! of the ThermoPhase object
/*!
* This function calls the constructPDSSFile member function.
*
* @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
* @param inputFile String name of the input file
* @param id String name of the phase in the input file. The default
* is the empty string, in which case the first phase in the
* file is used.
*/
PDSS(ThermoPhase *tp, int spindex, std::string inputFile, std::string id = "");
//! Constructor that initializes the object by examining the input file
//! of the ThermoPhase object
/*!
* This function calls the constructPDSSXML member function.
*
* @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
* @param phaseRef Reference to the XML tree containing the phase information.
* @param id String name of the phase in the input file. The default
* is the empty string, in which case the first phase in the
* file is used.
*/
PDSS(ThermoPhase *tp, int spindex, XML_Node& phaseRef, std::string id = "");
//! Destructor for the phase
virtual ~PDSS();
/**
@ -63,24 +118,78 @@ namespace Cantera {
* @name Utilities
* @{
*/
//! Returns the type of the standard state parameterization
/*!
* @return Returns the integer # of the parameterization
*/
virtual int pdssType() const { return -1; }
/**
* @}
* @name Molar Thermodynamic Properties of the Solution --------------
* @name Molar Thermodynamic Properties of the Species Standard State
* @{
*/
//! Return the molar enthalpy in units of J kmol-1
/*!
* Returns the species standard state enthalpy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state enthalpy in J kmol-1
*/
virtual doublereal enthalpy_mole() const;
//! Return the molar internal Energy in units of J kmol-1
/*!
* Returns the species standard state internal Energy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state internal Energy in J kmol-1
*/
virtual doublereal intEnergy_mole() const;
//! Return the molar entropy in units of J kmol-1 K-1
/*!
* Returns the species standard state entropy in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state entropy in J kmol-1 K-1
*/
virtual doublereal entropy_mole() const;
//! Return the molar gibbs free energy in units of J kmol-1
/*!
* Returns the species standard state gibbs free energy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state gibbs free energy in J kmol-1
*/
virtual doublereal gibbs_mole() const;
//! Return the molar const pressure heat capacity in units of J kmol-1 K-1
/*!
* Returns the species standard state Cp in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cp in J kmol-1 K-1
*/
virtual doublereal cp_mole() const;
//! Return the molar const volume heat capacity in units of J kmol-1 K-1
/*!
* Returns the species standard state Cv in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cv in J kmol-1 K-1
*/
virtual doublereal cv_mole() const;
/*
* Get the difference in the standard state thermodynamic properties
* between the reference pressure, po, and the current pressure.
* between the current pressure. and the reference pressure, p0
*/
virtual doublereal enthalpyDelp_mole() const;
virtual doublereal intEnergyDelp_mole() const;
virtual doublereal entropyDelp_mole() const;

View file

@ -160,7 +160,6 @@ namespace Cantera {
//! Destructor
virtual ~SpeciesThermo() {}
//! Copy Constructor for the %SpeciesThermo object.
/*!
* @param right Reference to %SpeciesThermo object to be copied into the
@ -178,7 +177,6 @@ namespace Cantera {
SpeciesThermo& operator=(const SpeciesThermo &right) {
return *this;
}
//! Duplication routine for objects which inherit from
//! %SpeciesThermo

View file

@ -492,7 +492,7 @@ namespace Cantera {
/**
* Install an Adsorbatge thermodynamic property
* Install an Adsorbate thermodynamic property
* parameterization for species k into a SpeciesThermo instance.
* This is called by method installThermoForSpecies if a NASA9
* block is found in the XML input.
@ -532,10 +532,14 @@ namespace Cantera {
* @param k species number
* @param s XML node specifying species
* @param spthermo species thermo manager
* @param phaseNode_ptr Optional Pointer to the XML phase
* information for the phase in which the species
* resides
*/
void SpeciesThermoFactory::
installThermoForSpecies(int k, const XML_Node& s,
SpeciesThermo& spthermo) {
SpeciesThermo& spthermo,
const XML_Node *phaseNode_ptr) {
/*
* Check to see that the species block has a thermo block
* before processing. Throw an error if not there.

View file

@ -88,7 +88,7 @@ namespace Cantera {
* the process terminates (for example, when checking for
* memory leaks) then this method can be called to delete it.
*/
virtual void deleteFactory() {
void deleteFactory() {
#if defined(THREAD_SAFE_CANTERA)
boost::mutex::scoped_lock lock(species_thermo_mutex);
#endif
@ -112,7 +112,7 @@ namespace Cantera {
/*!
* @param type the integer type to be created.
*/
virtual SpeciesThermo* newSpeciesThermo(int type);
SpeciesThermo* newSpeciesThermo(int type);
//! Create a new species property manager.
/*!
@ -124,7 +124,7 @@ namespace Cantera {
* Each speciesData node contains a list of XML species elements
* e.g., \<speciesData id="Species_Data"\>
*/
virtual SpeciesThermo* newSpeciesThermo(XML_Node* spData_node);
SpeciesThermo* newSpeciesThermo(XML_Node* spData_node);
//! Create a new species property manager for a group of species
/*!
@ -136,7 +136,7 @@ namespace Cantera {
* Each speciesData node contains a list of XML species elements
* e.g., \<speciesData id="Species_Data"\>
*/
virtual SpeciesThermo* newSpeciesThermo(std::vector<XML_Node*> spData_nodes);
SpeciesThermo* newSpeciesThermo(std::vector<XML_Node*> spData_nodes);
//! Create a new species property manager.
/*!
@ -151,11 +151,22 @@ namespace Cantera {
*
* @todo is this used?
*/
virtual SpeciesThermo* newSpeciesThermoOpt(std::vector<XML_Node*> spData_nodes);
SpeciesThermo* newSpeciesThermoOpt(std::vector<XML_Node*> spData_nodes);
virtual void installThermoForSpecies(int k, const XML_Node& s,
SpeciesThermo& spthermo);
//! Install a species thermodynamic property parameterization
//! for one species into a species thermo manager.
/*!
* @param k species number
* @param s Reference to the XML node specifying the species standard
* state information
* @param spthermo Species reference state thermo manager
* @param phaseNode_ptr Optional Pointer to the XML phase
* information for the phase in which the species
* resides
*/
void installThermoForSpecies(int k, const XML_Node& s,
SpeciesThermo& spthermo,
const XML_Node *phaseNode_ptr = 0);
private:

View file

@ -18,10 +18,10 @@
namespace Cantera {
//! Pure Virtual Base class for individual species reference state
//! themodynamic managers.
//! Pure Virtual Base class for the thermoydnamic manager for
//! an individual species' reference state
/*!
* This differs from the SpeciesThermo virtual
* This differs from the SpeciesThermo virtual
* base class in the sense that this class is meant to handle only
* one species. The speciesThermo class is meant to handle the
* calculation of all the species (or a large subset) in a phase.

View file

@ -420,7 +420,7 @@ namespace Cantera {
XML_Node* s = db->findByAttr("name",spnames[i]);
if (s) {
if (installSpecies(k, *s, *th, spthermo, sprule[jsp],
spfactory))
&phase, spfactory))
++k;
}
else {
@ -441,82 +441,7 @@ namespace Cantera {
th->initThermoXML(phase, id);
return true;
}
// void setEOSParameters(const XML_Node& xmlphase, ThermoPhase* th) {
// // if no thermo model is specified for the phase, simply
// // return
// if (!phase.hasChild("thermo")) return;
// const XML_Node& eos = phase.child("thermo");
// // set the parameters for the particular equation of state type,
// // and
// if (eos["model"] == "Incompressible") {
// if (th->eosType() == cIncompressible) {
// doublereal rho = getFloat(eos, "density", "-");
// th->setParameters(1, &rho);
// }
// else {
// eoserror = true;
// }
// }
// else if (eos["model"] == "StoichSubstance") {
// if (th->eosType() == cStoichSubstance) {
// doublereal rho = getFloat(eos, "density", "-");
// th->setDensity(rho);
// }
// else {
// eoserror = true;
// }
// }
// else if (eos["model"] == "Surface") {
// if (th->eosType() == cSurf) {
// doublereal n = getFloat(eos, "site_density", "-");
// if (n <= 0.0)
// throw CanteraError("importCTML",
// "missing or negative site density");
// th->setParameters(1, &n);
// }
// else {
// eoserror = true;
// }
// }
// else if (eos["model"] == "Edge") {
// if (th->eosType() == cEdge) {
// doublereal n = getFloat(eos, "site_density", "-");
// if (n <= 0.0)
// throw CanteraError("importCTML",
// "missing or negative site density");
// th->setParameters(1, &n);
// }
// else {
// eoserror = true;
// }
// }
// #ifdef INCL_PURE_FLUIDS
// else if (eos["model"] == "PureFluid") {
// if (th->eosType() == cPureFluid) {
// subflag = atoi(eos["fluid_type"].c_str());
// if (subflag < 0)
// throw CanteraError("importCTML",
// "missing fluid type flag");
// }
// else {
// eoserror = true;
// }
// }
// #endif
// if (eoserror) {
// string msg = "Wrong equation of state type for phase "+phase["id"]+"\n";
// msg += eos["model"]+" is not consistent with eos type "+int2str(th->eosType());
// throw CanteraError("importCTML",msg);
// }
}
/*
* Install a species into a ThermoPhase object, which defines
@ -537,9 +462,30 @@ namespace Cantera {
* containing the thermodynamic information for the reference
* state of the species. Failures or lack of information trigger
* an "UnknownSpeciesThermoModel" exception being thrown.
* *
* @param k Species Index in the phase
* @param s XML_Node containing the species data for this species.
* @param p Reference to the ThermoPhase object.
* @param spthermo Reference to the SpeciesThermo object, where
* the standard state thermo properties for this
* species will be installed.
* @param rule Parameter that handles what to do with species
* who have elements that aren't declared.
* Check that all elements in the species
* exist in 'p'. If rule != 0, quietly skip
* this species if some elements are undeclared;
* otherwise, throw an exception
* @param phaseNode_ptr Pointer to the XML_Node for this phase
* (defaults to 0)
* @param factory Pointer to the SpeciesThermoFactory .
* (defaults to 0)
*
* @return
* Returns true if everything is ok, false otherwise.
*/
bool installSpecies(int k, const XML_Node& s, thermo_t& p,
SpeciesThermo& spthermo, int rule,
XML_Node *phaseNode_ptr,
SpeciesThermoFactory* factory) {
std::string xname = s.name();
@ -596,7 +542,7 @@ namespace Cantera {
// install the thermo parameterization for this species into
// the species thermo manager for phase p.
factory->installThermoForSpecies(k, s, spthermo);
factory->installThermoForSpecies(k, s, spthermo, phaseNode_ptr);
return true;
}

View file

@ -278,13 +278,17 @@ namespace Cantera {
* exist in 'p'. If rule != 0, quietly skip
* this species if some elements are undeclared;
* otherwise, throw an exception
* @param phaseNode_ptr Pointer to the XML_Node for this phase
* (defaults to 0)
* @param factory Pointer to the SpeciesThermoFactory .
* (defaults to 0)
*
* @return
* Returns true if everything is ok, false otherwise.
*/
bool installSpecies(int k, const XML_Node& s, thermo_t& p,
SpeciesThermo& spthermo, int rule,
XML_Node *phaseNode_ptr = 0,
SpeciesThermoFactory* factory = 0);
//!Search an XML tree for species data.