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