Cantera  2.0
PDSS_IdealGas.h
Go to the documentation of this file.
1 /**
2  * @file PDSS_IdealGas.h
3  * Declarations for the class PDSS_IdealGas (pressure dependent standard state)
4  * which handles calculations for a single ideal gas species in a phase
5  * (see \ref pdssthermo and class \link Cantera::PDSS_IdealGas PDSS_IdealGas\endlink).
6  */
7 /*
8  * Copyright (2006) Sandia Corporation. Under the terms of
9  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
10  * U.S. Government retains certain rights in this software.
11  */
12 #ifndef CT_PDSS_IDEALGAS_H
13 #define CT_PDSS_IDEALGAS_H
14 
15 #include "PDSS.h"
16 
17 
18 namespace Cantera
19 {
20 class XML_Node;
21 class VPStandardStateTP;
22 
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_IdealGas : public PDSS
31 {
32 
33 public:
34 
35  /**
36  * @name Constructors
37  * @{
38  */
39 
40  //! Constructor
41  /*!
42  * @param tp Pointer to the ThermoPhase object pertaining to the phase
43  * @param spindex Species index of the species in the phase
44  */
45  PDSS_IdealGas(VPStandardStateTP* tp, int spindex);
46 
47  //! Copy Constructur
48  /*!
49  * @param b Object to be copied
50  */
51  PDSS_IdealGas(const PDSS_IdealGas& b);
52 
53  //! Assignment operator
54  /*!
55  * @param b Object to be copeid
56  */
58 
59  //! Constructor that initializes the object by examining the input file
60  //! of the ThermoPhase object
61  /*!
62  * This function calls the constructPDSSFile member function.
63  *
64  * @param tp Pointer to the ThermoPhase object pertaining to the phase
65  * @param spindex Species index of the species in the phase
66  * @param inputFile String name of the input file
67  * @param id String name of the phase in the input file. The default
68  * is the empty string, in which case the first phase in the
69  * file is used.
70  */
71  PDSS_IdealGas(VPStandardStateTP* tp, int spindex,
72  std::string inputFile, std::string id = "");
73 
74 
75  //! Constructor that initializes the object by examining the input file
76  //! of the ThermoPhase object
77  /*!
78  * This function calls the constructPDSSXML member function.
79  *
80  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
81  * @param spindex Species index of the species in the phase
82  * @param speciesNode Reference to the species XML tree.
83  * @param phaseRef Reference to the XML tree containing the phase information.
84  * @param spInstalled Boolean indicating whether the species is installed yet
85  * or not.
86  */
87  PDSS_IdealGas(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
88  const XML_Node& phaseRef, bool spInstalled);
89 
90 
91  //! Destructor
92  virtual ~PDSS_IdealGas();
93 
94  //! Duplicator
95  virtual PDSS* duplMyselfAsPDSS() const;
96 
97  /**
98  * @}
99  * @name Utilities
100  * @{
101  */
102 
103  /**
104  * @}
105  * @name Molar Thermodynamic Properties of the Species Standard State
106  * in the Solution
107  * @{
108  */
109 
110  //! Return the molar enthalpy in units of J kmol-1
111  /*!
112  * Returns the species standard state enthalpy in J kmol-1 at the
113  * current temperature and pressure.
114  *
115  * @return returns the species standard state enthalpy in J kmol-1
116  */
117  virtual doublereal enthalpy_mole() const;
118 
119  //! Return the standard state molar enthalpy divided by RT
120  /*!
121  * Returns the species standard state enthalpy divided by RT at the
122  * current temperature and pressure.
123  *
124  * @return returns the species standard state enthalpy in unitless form
125  */
126  virtual doublereal enthalpy_RT() const;
127 
128  //! Return the molar internal Energy in units of J kmol-1
129  /*!
130  * Returns the species standard state internal Energy in J kmol-1 at the
131  * current temperature and pressure.
132  *
133  * @return returns the species standard state internal Energy in J kmol-1
134  */
135  virtual doublereal intEnergy_mole() const;
136 
137  //! Return the molar entropy in units of J kmol-1 K-1
138  /*!
139  * Returns the species standard state entropy in J kmol-1 K-1 at the
140  * current temperature and pressure.
141  *
142  * @return returns the species standard state entropy in J kmol-1 K-1
143  */
144  virtual doublereal entropy_mole() const;
145 
146  //! Return the standard state entropy divided by RT
147  /*!
148  * Returns the species standard state entropy divided by RT at the
149  * current temperature and pressure.
150  *
151  * @return returns the species standard state entropy divided by RT
152  */
153  virtual doublereal entropy_R() const;
154 
155  //! Return the molar gibbs free energy in units of J kmol-1
156  /*!
157  * Returns the species standard state gibbs free energy in J kmol-1 at the
158  * current temperature and pressure.
159  *
160  * @return returns the species standard state gibbs free energy in J kmol-1
161  */
162  virtual doublereal gibbs_mole() const;
163 
164  //! Return the molar gibbs free energy divided by RT
165  /*!
166  * Returns the species standard state gibbs free energy divided by RT at the
167  * current temperature and pressure.
168  *
169  * @return returns the species standard state gibbs free energy divided by RT
170  */
171  virtual doublereal gibbs_RT() const;
172 
173  //! Return the molar const pressure heat capacity in units of J kmol-1 K-1
174  /*!
175  * Returns the species standard state Cp in J kmol-1 K-1 at the
176  * current temperature and pressure.
177  *
178  * @return returns the species standard state Cp in J kmol-1 K-1
179  */
180  virtual doublereal cp_mole() const;
181 
182  //! Return the molar const pressure heat capacity divided by RT
183  /*!
184  * Returns the species standard state Cp divided by RT at the
185  * current temperature and pressure.
186  *
187  * @return returns the species standard state Cp divided by RT
188  */
189  virtual doublereal cp_R() const;
190 
191  //! Return the molar const volume heat capacity in units of J kmol-1 K-1
192  /*!
193  * Returns the species standard state Cv in J kmol-1 K-1 at the
194  * current temperature and pressure.
195  *
196  * @return returns the species standard state Cv in J kmol-1 K-1
197  */
198  virtual doublereal cv_mole() const;
199 
200  //! Return the molar volume at standard state
201  /*!
202  * Returns the species standard state molar volume at the
203  * current temperature and pressure
204  *
205  * @return returns the standard state molar volume divided by R
206  * units are m**3 kmol-1.
207  */
208  virtual doublereal molarVolume() const;
209 
210  //! Return the standard state density at standard state
211  /*!
212  * Returns the species standard state density at the
213  * current temperature and pressure
214  *
215  * @return returns the standard state density
216  * units are kg m-3
217  */
218  virtual doublereal density() const;
219 
220  /**
221  * @}
222  * @name Properties of the Reference State of the Species
223  * in the Solution
224  * @{
225  */
226 
227  //! Return the molar gibbs free energy divided by RT at reference pressure
228  /*!
229  * Returns the species reference state gibbs free energy divided by RT at the
230  * current temperature.
231  *
232  * @return returns the reference state gibbs free energy divided by RT
233  */
234  virtual doublereal gibbs_RT_ref() const;
235 
236  //! Return the molar enthalpy divided by RT at reference pressure
237  /*!
238  * Returns the species reference state enthalpy divided by RT at the
239  * current temperature.
240  *
241  * @return returns the reference state enthalpy divided by RT
242  */
243  virtual doublereal enthalpy_RT_ref() const;
244 
245  //! Return the molar entropy divided by R at reference pressure
246  /*!
247  * Returns the species reference state entropy divided by R at the
248  * current temperature.
249  *
250  * @return returns the reference state entropy divided by R
251  */
252  virtual doublereal entropy_R_ref() const;
253 
254  //! Return the molar heat capacity divided by R at reference pressure
255  /*!
256  * Returns the species reference state heat capacity divided by R at the
257  * current temperature.
258  *
259  * @return returns the reference state heat capacity divided by R
260  */
261  virtual doublereal cp_R_ref() const;
262 
263  //! Return the molar volume at reference pressure
264  /*!
265  * Returns the species reference state molar volume at the
266  * current temperature.
267  *
268  * @return returns the reference state molar volume divided by R
269  * units are m**3 kmol-1.
270  */
271  virtual doublereal molarVolume_ref() const;
272 
273  /*
274  * Get the difference in the standard state thermodynamic properties
275  * between the reference pressure, po, and the current pressure.
276  */
277 
278  /**
279  * @}
280  * @name Mechanical Equation of State Properties
281  * @{
282  */
283 
284  //! Returns the pressure (Pa)
285  virtual doublereal pressure() const;
286 
287  //! Sets the pressure in the object
288  /*!
289  * Currently, this sets the pressure in the PDSS object.
290  * It is indeterminant what happens to the owning VPStandardStateTP
291  * object and to the VPSSMgr object.
292  *
293  * @param pres Pressure to be set (Pascal)
294  */
295  virtual void setPressure(doublereal pres);
296 
297  //! Set the internal temperature
298  /*!
299  * @param temp Temperature (Kelvin)
300  */
301  virtual void setTemperature(doublereal temp);
302 
303  //! Return the current stored temperature
304  doublereal temperature() const;
305 
306  //! Set the internal temperature and pressure
307  /*!
308  * @param temp Temperature (Kelvin)
309  * @param pres pressure (Pascals)
310  */
311  virtual void setState_TP(doublereal temp, doublereal pres);
312 
313  //! Set the internal temperature and density
314  /*!
315  * @param temp Temperature (Kelvin)
316  * @param rho Density (Pascals)
317  */
318  virtual void setState_TR(doublereal temp, doublereal rho);
319 
320  /**
321  * @}
322  * @name Miscellaneous properties of the standard state
323  * @{
324  */
325 
326  /// critical temperature
327  virtual doublereal critTemperature() const;
328 
329  /// critical pressure
330  virtual doublereal critPressure() const;
331 
332  /// critical density
333  virtual doublereal critDensity() const;
334 
335  /// saturation pressure
336  /*!
337  * @param t Temperature (Kelvin)
338  */
339  virtual doublereal satPressure(doublereal t);
340 
341  /**
342  * @}
343  * @name Initialization of the Object
344  * @{
345  */
346 
347  //! Initialization of a PDSS object using an
348  //! input XML file.
349  /*!
350  *
351  * This routine is a precursor to constructPDSSXML(XML_Node*)
352  * routine, which does most of the work.
353  *
354  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
355  * This object must have already been malloced.
356  *
357  * @param spindex Species index within the phase
358  *
359  * @param inputFile XML file containing the description of the
360  * phase
361  *
362  * @param id Optional parameter identifying the name of the
363  * phase. If none is given, the first XML
364  * phase element will be used.
365  */
366  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
367  std::string inputFile, std::string id);
368 
369  //!Initialization of a PDSS object using an xml tree
370  /*!
371  * This routine is a driver for the initialization of the
372  * object.
373  *
374  * basic logic:
375  * initThermo() (cascade)
376  * getStuff from species Part of XML file
377  * initThermoXML(phaseNode) (cascade)
378  *
379  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
380  * This object must have already been malloced.
381  *
382  * @param spindex Species index within the phase
383  *
384  * @param phaseNode Reference to the phase Information for the phase
385  * that owns this species.
386  *
387  * @param id Optional parameter identifying the name of the
388  * phase. If none is given, the first XML
389  * phase element will be used.
390  */
391  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
392  const XML_Node& phaseNode, std::string id);
393 
394  //! Initialization routine for the PDSS object based on the phaseNode
395  /*!
396  * This is a cascading call, where each level should call the
397  * the parent level.
398  *
399  * @param phaseNode Reference to the phase Information for the phase
400  * that owns this species.
401  *
402  * @param id Optional parameter identifying the name of the
403  * phase. If none is given, the first XML
404  * phase element will be used.
405  */
406  virtual void initThermoXML(const XML_Node& phaseNode, std::string& id);
407 
408  //! Initialization routine for all of the shallow pointers
409  /*!
410  * This is a cascading call, where each level should call the
411  * the parent level.
412  *
413  * The initThermo() routines get called before the initThermoXML() routines
414  * from the constructPDSSXML() routine.
415  *
416  *
417  * Calls initPtrs();
418  */
419  virtual void initThermo();
420 
421  //@}
422 
423 
424 
425 protected:
426 
427  //! Maximum temperature the standard states are good for
428  doublereal m_tmin;
429 
430  //! Minimum temperature the standard states are good for
431  doublereal m_tmax;
432 
433 };
434 }
435 
436 #endif
437 
438 
439