Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDSS_IonsFromNeutral.h
Go to the documentation of this file.
1 /**
2  * @file PDSS_IonsFromNeutral.h
3  * Declarations for the class PDSS_IonsFromNeutral (
4  * which handles calculations for a single ion in a fluid, whose properties
5  * are calculated from another neutral molecule.
6  * (see \ref pdssthermo and class \link Cantera::PDSS_IonsFromNeutral PDSS_IonsFromNeutral\endlink).
7  */
8 /*
9  * Copyright (2006) Sandia Corporation. Under the terms of
10  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
11  * U.S. Government retains certain rights in this software.
12  */
13 #ifndef CT_PDSS_IONSFROMNEUTRAL_H
14 #define CT_PDSS_IONSFROMNEUTRAL_H
15 
16 #include "PDSS.h"
17 
18 namespace Cantera
19 {
20 class ThermoPhase;
21 
22 //! Derived class for pressure dependent standard states of an ideal gas species
23 /*!
24  * This class is for a single Ideal Gas species.
25  *
26  * @ingroup pdssthermo
27  */
29 {
30 public:
31  //! @name Constructors
32  //! @{
33 
34  //! Constructor
35  /*!
36  * @param tp Pointer to the ThermoPhase object pertaining to the phase
37  * @param spindex Species index of the species in the phase
38  */
39  PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex);
40 
41  //! Constructor that initializes the object by examining the input file
42  //! of the ThermoPhase object
43  /*!
44  * This function calls the constructPDSSFile member function.
45  *
46  * @param tp Pointer to the ThermoPhase object pertaining to the phase
47  * @param spindex Species index of the species in the phase
48  * @param inputFile String name of the input file
49  * @param id String name of the phase in the input file. The default
50  * is the empty string, in which case the first phase in the
51  * file is used.
52  */
53  PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex,
54  const std::string& inputFile, const std::string& id = "");
55 
56  //! Constructor that initializes the object by examining the input file
57  //! of the ThermoPhase object
58  /*!
59  * This function calls the constructPDSSXML member function.
60  *
61  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
62  * @param spindex Species index of the species in the phase
63  * @param speciesNode Reference to the species XML tree.
64  * @param phaseRef Reference to the XML tree containing the phase information.
65  * @param spInstalled Boolean indicating whether the species is installed yet
66  * or not.
67  */
68  PDSS_IonsFromNeutral(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
69  const XML_Node& phaseRef, bool spInstalled);
70 
71  //! Copy Constructor
72  /*!
73  * @param b Object to be copied
74  */
76 
77  //! Assignment operator
78  /*!
79  * @param b Object to be copied
80  */
82 
83  virtual PDSS* duplMyselfAsPDSS() const;
84  virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr,
85  SpeciesThermo* spthermo_ptr);
86 
87  //! @}
88  //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
89  //! @{
90 
91  // See PDSS.h for documentation of functions overridden from Class PDSS
92 
93  virtual doublereal enthalpy_RT() const;
94  virtual doublereal intEnergy_mole() const;
95  virtual doublereal entropy_R() const;
96 
97  /*!
98  * @copydoc PDSS::gibbs_RT()
99  *
100  * \f[
101  * \frac{\mu^o_k}{RT} = \sum_{m}{ \alpha_{m , k} \frac{\mu^o_{m}}{RT}} + ( 1 - \delta_{k,sp}) 2.0 \ln{2.0}
102  * \f]
103  *
104  * <I>m</I> is the neutral molecule species index. \f$ \alpha_{m , k} \f$ is the stoiciometric
105  * coefficient for the neutral molecule, <I>m</I>, that creates the thermodynamics for the ionic species <I>k</I>.
106  * A factor \f$ 2.0 \ln{2.0} \f$ is added to all ions except for the species ionic species, which in this
107  * case is the single anion species, with species index <I>sp</I>.
108  */
109  virtual doublereal gibbs_RT() const;
110  virtual doublereal cp_R() const;
111  virtual doublereal molarVolume() const;
112  virtual doublereal density() const;
113 
114  //! @}
115  //! @name Properties of the Reference State of the Species in the Solution
116  //! @{
117 
118  virtual doublereal gibbs_RT_ref() const;
119  virtual doublereal enthalpy_RT_ref() const;
120  virtual doublereal entropy_R_ref() const;
121  virtual doublereal cp_R_ref() const;
122  virtual doublereal molarVolume_ref() const;
123 
124  //! @}
125  //! @name Mechanical Equation of State Properties
126  //! @{
127 
128  virtual void setTemperature(doublereal temp);
129  virtual doublereal temperature() const;
130  virtual void setState_TP(doublereal temp, doublereal pres);
131  virtual void setState_TR(doublereal temp, doublereal rho);
132 
133  //! @}
134  //! @name Initialization of the Object
135  //! @{
136 
137  //! Initialization of a PDSS object using an input XML file.
138  /*!
139  * This routine is a precursor to constructPDSSXML(XML_Node*)
140  * routine, which does most of the work.
141  *
142  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
143  * This object must have already been malloced.
144  *
145  * @param spindex Species index within the phase
146  *
147  * @param inputFile XML file containing the description of the phase
148  *
149  * @param id Optional parameter identifying the name of the
150  * phase. If none is given, the first XML
151  * phase element will be used.
152  */
153  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
154  const std::string& inputFile, const std::string& id);
155 
156  //! Initialization of a PDSS object using an XML tree
157  /*!
158  * This routine is a driver for the initialization of the object.
159  *
160  * basic logic:
161  * - initThermo() (cascade)
162  * - getStuff from species Part of XML file
163  * - initThermoXML(phaseNode) (cascade)
164  *
165  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
166  * This object must have already been malloced.
167  *
168  * @param spindex Species index within the phase
169  *
170  * @param speciesNode Reference to the phase Information for the species
171  * that this standard state refers to
172  *
173  * @param phaseNode Reference to the phase Information for the phase
174  * that owns this species.
175  *
176  * @param id Optional parameter identifying the name of the
177  * phase. If none is given, the first XML
178  * phase element will be used.
179  */
180  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
181  const XML_Node& speciesNode,
182  const XML_Node& phaseNode, const std::string& id);
183 
184  virtual void initThermo();
185  //@}
186 
187 protected:
188  //! Pointer to the Neutral Molecule ThermoPhase object
189  /*!
190  * This is a shallow pointer.
191  */
193 
194 public:
195  //! Number of neutral molecule species that make up the stoichiometric vector for
196  //! this species, in terms of calculating thermodynamic functions
197  size_t numMult_;
198 
199  //! Vector of species indices in the neutral molecule ThermoPhase
200  std::vector<size_t> idNeutralMoleculeVec;
201 
202  //! Stoichiometric coefficient for this species using the Neutral Molecule Species
203  //! in the vector idNeutralMoleculeVec
204  std::vector<double> factorVec;
205 
206  //! Add 2RTln2 to the entropy and Gibbs free energies for this species
207  /*!
208  * This is true if this species is not the special species
209  */
211 
212  //! Vector of length equal to the number of species in the neutral molecule phase
213  mutable std::vector<double> tmpNM;
214 
215  //! True if this species is the special species
217 };
218 }
219 
220 #endif
std::vector< size_t > idNeutralMoleculeVec
Vector of species indices in the neutral molecule ThermoPhase.
size_t numMult_
Number of neutral molecule species that make up the stoichiometric vector for this species...
Derived class for pressure dependent standard states of an ideal gas species.
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:235
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual void setTemperature(doublereal temp)
Set the internal temperature.
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
virtual doublereal molarVolume() const
Return the molar volume at standard state.
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
virtual doublereal density() const
Return the standard state density at standard state.
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.
std::vector< double > factorVec
Stoichiometric coefficient for this species using the Neutral Molecule Species in the vector idNeutra...
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
Base class for PDSS classes which compute nondimensional properties directly.
Definition: PDSS.h:687
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 doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
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 entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
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.
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
PDSS_IonsFromNeutral & operator=(const PDSS_IonsFromNeutral &b)
Assignment operator.
virtual void initThermo()
Initialization routine for all of the shallow pointers.
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:193
std::vector< double > tmpNM
Vector of length equal to the number of species in the neutral molecule phase.
virtual doublereal temperature() const
Return the current stored temperature.
virtual PDSS * duplMyselfAsPDSS() const
Duplication routine for objects which inherit from PDSS.
bool add2RTln2_
Add 2RTln2 to the entropy and Gibbs free energies for this species.
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
int specialSpecies_
True if this species is the special species.