Cantera  2.1.2
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 XML_Node;
21 class VPStandardStateTP;
22 class ThermoPhase;
23 
24 //! Derived class for pressure dependent standard states of an ideal gas species
25 /*!
26  * This class is for a single Ideal Gas species.
27  *
28  * @ingroup pdssthermo
29  */
30 class PDSS_IonsFromNeutral : public PDSS
31 {
32 public:
33  //! @name Constructors
34  //! @{
35 
36  //! Constructor
37  /*!
38  * @param tp Pointer to the ThermoPhase object pertaining to the phase
39  * @param spindex Species index of the species in the phase
40  */
41  PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex);
42 
43  //! Constructor that initializes the object by examining the input file
44  //! of the ThermoPhase object
45  /*!
46  * This function calls the constructPDSSFile member function.
47  *
48  * @param tp Pointer to the ThermoPhase object pertaining to the phase
49  * @param spindex Species index of the species in the phase
50  * @param inputFile String name of the input file
51  * @param id String name of the phase in the input file. The default
52  * is the empty string, in which case the first phase in the
53  * file is used.
54  */
55  PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex,
56  const std::string& inputFile, const std::string& id = "");
57 
58  //! Constructor that initializes the object by examining the input file
59  //! of the ThermoPhase object
60  /*!
61  * This function calls the constructPDSSXML member function.
62  *
63  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
64  * @param spindex Species index of the species in the phase
65  * @param speciesNode Reference to the species XML tree.
66  * @param phaseRef Reference to the XML tree containing the phase information.
67  * @param spInstalled Boolean indicating whether the species is installed yet
68  * or not.
69  */
70  PDSS_IonsFromNeutral(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
71  const XML_Node& phaseRef, bool spInstalled);
72 
73  //! Copy Constructor
74  /*!
75  * @param b Object to be copied
76  */
78 
79  //! Assignment operator
80  /*!
81  * @param b Object to be copeid
82  */
84 
85  virtual PDSS* duplMyselfAsPDSS() const;
86  virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr,
87  SpeciesThermo* spthermo_ptr);
88 
89  //! @}
90  //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
91  //! @{
92 
93  // See PDSS.h for documentation of functions overridden from Class PDSS
94 
95  virtual doublereal enthalpy_mole() const;
96  virtual doublereal enthalpy_RT() const;
97  virtual doublereal intEnergy_mole() const;
98  virtual doublereal entropy_mole() const;
99  virtual doublereal entropy_R() const;
100  virtual doublereal gibbs_mole() const;
101 
102  /*!
103  * @copydoc PDSS::gibbs_RT()
104  *
105  * \f[
106  * \frac{\mu^o_k}{RT} = \sum_{m}{ \alpha_{m , k} \frac{\mu^o_{m}}{RT}} + ( 1 - \delta_{k,sp}) 2.0 \ln{2.0}
107  * \f]
108  *
109  * <I>m</I> is the neutral molecule species index. \f$ \alpha_{m , k} \f$ is the stoiciometric
110  * coefficient for the neutral molecule, <I>m</I>, that creates the thermodynamics for the ionic species <I>k</I>.
111  * A factor \f$ 2.0 \ln{2.0} \f$ is added to all ions except for the species ionic species, which in this
112  * case is the single anion species, with species index <I>sp</I>.
113  */
114  virtual doublereal gibbs_RT() const;
115 
116  virtual doublereal cp_mole() const;
117  virtual doublereal cp_R() const;
118  virtual doublereal cv_mole() const;
119  virtual doublereal molarVolume() const;
120  virtual doublereal density() const;
121 
122  //! @}
123  //! @name Properties of the Reference State of the Species in the Solution
124  //! @{
125 
126  virtual doublereal gibbs_RT_ref() const;
127  virtual doublereal enthalpy_RT_ref() const;
128  virtual doublereal entropy_R_ref() const;
129  virtual doublereal cp_R_ref() const;
130  virtual doublereal molarVolume_ref() const;
131 
132  //! @}
133  //! @name Mechanical Equation of State Properties
134  //! @{
135 
136  virtual doublereal pressure() const;
137  virtual void setPressure(doublereal pres);
138  virtual void setTemperature(doublereal temp);
139  doublereal temperature() const;
140  virtual void setState_TP(doublereal temp, doublereal pres);
141  virtual void setState_TR(doublereal temp, doublereal rho);
142 
143  //! @}
144  //! @name Miscellaneous properties of the standard state
145  //! @{
146 
147  virtual doublereal critTemperature() const;
148  virtual doublereal critPressure() const;
149  virtual doublereal critDensity() const;
150  virtual doublereal satPressure(doublereal t);
151 
152  //! @}
153  //! @name Initialization of the Object
154  //! @{
155 
156  //! Initialization of a PDSS object using an input XML file.
157  /*!
158  * This routine is a precursor to constructPDSSXML(XML_Node*)
159  * routine, which does most of the work.
160  *
161  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
162  * This object must have already been malloced.
163  *
164  * @param spindex Species index within the phase
165  *
166  * @param inputFile XML file containing the description of the phase
167  *
168  * @param id Optional parameter identifying the name of the
169  * phase. If none is given, the first XML
170  * phase element will be used.
171  */
172  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
173  const std::string& inputFile, const std::string& id);
174 
175  //! Initialization of a PDSS object using an xml tree
176  /*!
177  * This routine is a driver for the initialization of the object.
178  *
179  * basic logic:
180  * - initThermo() (cascade)
181  * - getStuff from species Part of XML file
182  * - initThermoXML(phaseNode) (cascade)
183  *
184  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
185  * This object must have already been malloced.
186  *
187  * @param spindex Species index within the phase
188  *
189  * @param speciesNode Reference to the phase Information for the species
190  * that this standard state refers to
191  *
192  * @param phaseNode Reference to the phase Information for the phase
193  * that owns this species.
194  *
195  * @param id Optional parameter identifying the name of the
196  * phase. If none is given, the first XML
197  * phase element will be used.
198  */
199  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
200  const XML_Node& speciesNode,
201  const XML_Node& phaseNode, const std::string& id);
202 
203  virtual void initThermoXML(const XML_Node& phaseNode, const std::string& id);
204  virtual void initThermo();
205  //@}
206 
207 protected:
208  //! Pointer to the Neutral Molecule ThermoPhase object
209  /*!
210  * This is a shallow pointer.
211  */
213 
214 public:
215  //! Number of neutral molecule species that make up the stoichiometric vector for
216  //! this species, in terms of calculating thermodynamic functions
217  size_t numMult_;
218 
219  //! Vector of species indices in the neutral molecule ThermoPhase
220  std::vector<size_t> idNeutralMoleculeVec;
221 
222  //! Stoichiometric coefficient for this species using the Neutral Molecule Species
223  //! in the vector idNeutralMoleculeVec
224  std::vector<double> factorVec;
225 
226  //! Add 2RTln2 to the entropy and Gibbs free energies for this species
227  /*!
228  * This is true if this species is not the special species
229  */
231 
232  //! Vector of length equal to the number of species in the neutral molecule phase
233  mutable std::vector<double> tmpNM;
234 
235  //! True if this species is the special species
237 };
238 }
239 
240 #endif
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.
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:238
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
virtual doublereal critPressure() const
critical 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 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
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:101
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
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...
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 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 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 enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
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.
virtual doublereal gibbs_RT_ref() const
Return the molar gibbs free energy divided by RT at reference pressure.
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.
virtual void initThermo()
Initialization routine for all of the shallow pointers.
virtual doublereal critTemperature() const
critical temperature
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:195
std::vector< double > tmpNM
Vector of length equal to the number of species in the neutral molecule phase.
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 pressure() const
Returns the pressure (Pa)
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
int specialSpecies_
True if this species is the special species.