29 neutralMoleculePhase_(0),
38 const std::string& inputFile,
const std::string&
id) :
40 neutralMoleculePhase_(0),
50 const XML_Node& phaseRoot,
bool spInstalled) :
52 neutralMoleculePhase_(0),
58 throw CanteraError(
"PDSS_IonsFromNeutral",
"sp installing not done yet");
112 throw CanteraError(
"PDSS_IonsFromNeutral::initAllPts",
"Dynamic cast failed");
119 const XML_Node& phaseNode,
const std::string&
id)
123 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSXML",
124 "no thermo Node for species " + speciesNode.
name());
126 std::string model =
lowercase((*tn)[
"model"]);
127 if (model !=
"ionfromneutral") {
128 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSXML",
129 "thermo model for species isn't IonsFromNeutral: "
130 + speciesNode.
name());
134 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSXML",
135 "no Thermo::neutralSpeciesMultipliers Node for species " + speciesNode.
name());
140 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSXML",
"Dynamic cast failed");
144 std::vector<std::string> key;
145 std::vector<std::string> val;
152 for (
size_t i = 0; i <
numMult_; i++) {
172 const std::string& inputFile,
const std::string&
id)
174 if (inputFile.size() == 0) {
175 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSFile",
176 "input file is null");
179 ifstream fin(path.c_str());
181 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSFile",
"could not open "
182 +path+
" for reading.");
193 throw CanteraError(
"PDSS_IonsFromNeutral::constructPDSSFile",
194 "ERROR: Can not find phase named " +
195 id +
" in file named " + inputFile);
200 &(fxml_phase->
root()));
235 doublereal val = 0.0;
236 for (
size_t i = 0; i <
numMult_; i++) {
262 doublereal val = 0.0;
263 for (
size_t i = 0; i <
numMult_; i++) {
268 val -= 2.0 * log(2.0);
285 doublereal val = 0.0;
286 for (
size_t i = 0; i <
numMult_; i++) {
291 val += 2.0 * log(2.0);
299 doublereal val =
cp_R();
307 doublereal val = 0.0;
308 for (
size_t i = 0; i <
numMult_; i++) {
319 doublereal val = 0.0;
320 for (
size_t i = 0; i <
numMult_; i++) {
336 throw CanteraError(
"PDSS_IonsFromNeutral::cv_mole()",
"unimplemented");
344 doublereal val = 0.0;
345 for (
size_t i = 0; i <
numMult_; i++) {
350 val += 2.0 * log(2.0);
358 doublereal val = 0.0;
359 for (
size_t i = 0; i <
numMult_; i++) {
369 doublereal val = 0.0;
370 for (
size_t i = 0; i <
numMult_; i++) {
375 val -= 2.0 * log(2.0);
383 doublereal val = 0.0;
384 for (
size_t i = 0; i <
numMult_; i++) {
394 doublereal val = 0.0;
395 for (
size_t i = 0; i <
numMult_; i++) {
414 throw CanteraError(
"PDSS_IonsFromNeutral::critTemperature()",
"unimplemented");
420 throw CanteraError(
"PDSS_IonsFromNeutral::critPressure()",
"unimplemented");
426 throw CanteraError(
"PDSS_IonsFromNeutral::critDensity()",
"unimplemented");
430 doublereal PDSS_IonsFromNeutral::temperature()
const
456 throw CanteraError(
"PDSS_IonsFromNeutral::satPressure()",
"unimplemented");
doublereal temperature() const
Return the temperature stored in the object.
XML_Node * findByAttr(const std::string &attr, const std::string &val, int depth=100000) const
This routine carries out a recursive search for an XML node based on an attribute of each XML node...
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
std::vector< size_t > idNeutralMoleculeVec
Vector of species indices in the neutral molecule ThermoPhase.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
size_t numMult_
Number of neutral molecule species that make up the stoichiometric vector for this species...
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
Derived class for pressure dependent standard states of an ideal gas species.
SpeciesThermo * m_spthermo
Pointer to the species thermodynamic property manager.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Virtual base class for the classes that manage the calculation of standard state properties for all t...
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Header for intermediate ThermoPhase object for phases which consist of ions whose thermodynamics is c...
virtual void initThermoXML(const XML_Node &phaseNode, const std::string &id)
Initialization routine for the PDSS object based on the phaseNode.
doublereal * m_h0_RT_ptr
Reference state enthalpy divided by RT.
virtual doublereal maxTemp(size_t k=npos) const =0
Maximum temperature.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
doublereal m_pres
State of the system - pressure.
virtual doublereal critPressure() const
critical pressure
Class XML_Node is a tree-based representation of the contents of an XML file.
virtual void setTemperature(doublereal temp)
Set the internal temperature.
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
virtual doublereal molarVolume() const
Return the molar volume at standard state.
VPSSMgr * m_vpssmgr_ptr
Pointer to the VPSS manager for this object.
virtual void initAllPtrs(VPStandardStateTP *vptp_ptr, VPSSMgr *vpssmgr_ptr, SpeciesThermo *spthermo_ptr)
Initialize or Reinitialize all shallow pointers in the object.
virtual void initThermoXML(const XML_Node &phaseNode, const std::string &id)
Initialization routine for the PDSS object based on the phaseNode.
virtual doublereal satPressure(doublereal t)
saturation pressure
size_t m_spindex
Species index in the ThermoPhase corresponding to this species.
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
virtual doublereal density() const
Return the standard state density at standard state.
PDSS_enumType m_pdssType
Enumerated type describing the type of the PDSS object.
virtual void initAllPtrs(VPStandardStateTP *vptp_ptr, VPSSMgr *vpssmgr_ptr, SpeciesThermo *spthermo_ptr)
Initialize or Reinitialize all shallow pointers in the object.
Pure Virtual base class for the species thermo manager classes.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
std::vector< double > factorVec
Stoichiometric coefficient for this species using the Neutral Molecule Species in the vector idNeutra...
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node...
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
virtual void initThermo()
Initialization routine for all of the shallow pointers.
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
void constructPDSSFile(VPStandardStateTP *vptp_ptr, size_t spindex, const std::string &inputFile, const std::string &id)
Initialization of a PDSS object using an input XML file.
void constructPDSSXML(VPStandardStateTP *vptp_ptr, size_t spindex, const XML_Node &speciesNode, const XML_Node &phaseNode, const std::string &id)
Initialization of a PDSS object using an xml tree.
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
std::string name() const
Returns the name of the XML node.
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Classes providing support for XML data files.
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
virtual doublereal refPressure(size_t k=npos) const =0
The reference-state pressure for species k.
Base class for exceptions thrown by Cantera classes.
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
int getPairs(const Cantera::XML_Node &node, std::vector< std::string > &key, std::vector< std::string > &val)
This function interprets the value portion of an XML element as a series of "Pairs" separated by whit...
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
virtual doublereal critDensity() const
critical density
PDSS_IonsFromNeutral(VPStandardStateTP *tp, size_t spindex)
Constructor.
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
const ThermoPhase * neutralMoleculePhase_
Pointer to the Neutral Molecule ThermoPhase object.
doublereal m_maxTemp
Maximum temperature.
virtual doublereal gibbs_RT_ref() const
Return the molar gibbs free energy divided by RT at reference pressure.
doublereal m_minTemp
Minimum temperature.
virtual void getStandardVolumes_ref(doublereal *vol) const
Get the molar volumes of the species reference states at the current T and P_ref of the solution...
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
PDSS_IonsFromNeutral & operator=(const PDSS_IonsFromNeutral &b)
Assignment operator.
size_t nSpecies() const
Returns the number of species in the phase.
virtual doublereal minTemp(size_t k=npos) const =0
Minimum temperature.
virtual void initThermo()
Initialization routine for all of the shallow pointers.
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual doublereal critTemperature() const
critical temperature
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Virtual base class for a species with a pressure dependent standard state.
std::vector< double > tmpNM
Vector of length equal to the number of species in the neutral molecule phase.
VPStandardStateTP * m_tp
ThermoPhase which this species belongs to.
virtual PDSS * duplMyselfAsPDSS() const
Duplication routine for objects which inherit from PDSS.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
doublereal m_temp
Current temperature used by the PDSS object.
PDSS & operator=(const PDSS &b)
Assignment operator.
Contains declarations for string manipulation functions within Cantera.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
virtual SpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
bool add2RTln2_
Add 2RTln2 to the entropy and Gibbs free energies for this species.
virtual doublereal pressure() const
Returns the pressure (Pa)
XML_Node & root() const
Return the root of the current XML_Node tree.
Declarations for the class PDSS_IonsFromNeutral ( which handles calculations for a single ion in a fl...
ThermoPhase * neutralMoleculePhase_
This is a pointer to the neutral Molecule Phase.
doublereal fpValueCheck(const std::string &val)
Translate a string into one doublereal value, with error checking.
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
void build(std::istream &f)
Main routine to create an tree-like representation of an XML file.
XML_Node * get_XML_NameID(const std::string &nameTarget, const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
int specialSpecies_
True if this species is the special species.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
doublereal m_p0
Reference state pressure of the species.
doublereal m_mw
Molecular Weight of the species.