Cantera  2.0
PDSS_SSVol.h
Go to the documentation of this file.
1 /**
2  * @file PDSS_SSVol.h
3  * Declarations for the class PDSS_SSVol (pressure dependent standard state)
4  * which handles calculations for a single species with an expression for the standard state molar volume in a phase
5  * given by an enumerated data type
6  * (see class \ref pdssthermo and \link Cantera::PDSS_SSVol PDSS_SSVol\endlink).
7  */
8 /*
9  * Copyright (2009) 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_SSVOL_H
14 #define CT_PDSS_SSVOL_H
15 
16 #include "PDSS.h"
17 
18 namespace Cantera
19 {
20 class XML_Node;
21 class VPStandardStateTP;
22 
23 //! Class for pressure dependent standard states that uses a standard state volume
24 //! model of some sort.
25 /*!
26  * Class PDSS_SSVol is an implementation class that compute the properties of a single
27  * species in a phase at its standard states, for a range of temperatures
28  * and pressures. This particular class assumes that the calculation of the
29  * thermodynamics functions can be separated into a temperature polynomial representation
30  * for thermo functions that can be handled bey a SimpleThermo object and
31  * a separate calculation for the standard state volume.
32  * The Models include a cubic polynomial in temperature for either
33  * the standard state volume or the standard state density.
34  * The manager uses a SimpleThermo object to handle the
35  * calculation of the reference state. This object then adds the
36  * pressure dependencies and the volume terms to these thermo functions
37  * to complete the representation.
38  *
39  * The class includes the following models for the representation of the
40  * standard state volume:
41  *
42  * - Constant Volume
43  * - This standard state model is invoked with the keyword "constant_incompressible"
44  * or "constant". The standard state volume is considered constant.
45  * \f[
46  * V^o_k(T,P) = a_0
47  * \f]
48  * .
49  *
50  * - Temperature polynomial for the standard state volume
51  * - This standard state model is invoked with the keyword "temperature_polynomial".
52  * The standard state volume is considered a function of temperature only.
53  * \f[
54  * V^o_k(T,P) = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
55  * \f]
56  * .
57  *
58  * - Temperature polynomial for the standard state density
59  * - This standard state model is invoked with the keyword "density_temperature_polynomial".
60  * The standard state density, which is the inverse of the volume,
61  * is considered a function of temperature only.
62  * \f[
63  * {\rho}^o_k(T,P) = \frac{M_k}{V^o_k(T,P)} = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
64  * \f]
65  * .
66  * .
67  *
68  * <b> Specification of Species Standard %State Properties </b>
69  *
70  * The standard molar Gibbs free energy for species <I>k</I> is determined from the enthalpy
71  * and entropy expressions
72  *
73  * \f[
74  * G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P)
75  * \f]
76  *
77  * The enthalpy is calculated mostly from the %SpeciesThermo object's enthalpy evalulator. The
78  * dependence on pressure originates from the Maxwell relation
79  *
80  * \f[
81  * {\left(\frac{dH^o_k}{dP}\right)}_T = T {\left(\frac{dS^o_k}{dP}\right)}_T + V^o_k
82  * \f]
83  * which is equal to
84  *
85  * \f[
86  * {\left(\frac{dH^o_k}{dP}\right)}_T = V^o_k - T {\left(\frac{dV^o_k}{dT}\right)}_P
87  * \f]
88  *
89  * The entropy is calculated mostly from the %SpeciesThermo objects entropy evalulator. The
90  * dependence on pressure originates from the Maxwell relation:
91  *
92  * \f[
93  * {\left(\frac{dS^o_k}{dP}\right)}_T = - {\left(\frac{dV^o_k}{dT}\right)}_P
94  * \f]
95  *
96  * The standard state constant-pressure heat capacity expression is obtained from taking the
97  * temperature derivative of the Maxwell relation involving the enthalpy given above
98  * to yield an expression for the pressure dependence of the heat capacity.
99  *
100  * \f[
101  * {\left(\frac{d{C}^o_{p,k}}{dP}\right)}_T = - T {\left(\frac{{d}^2{V}^o_k}{{dT}^2}\right)}_T
102  * \f]
103  *
104  * The standard molar Internal Energy for species <I>k</I> is determined from the following
105  * relation.
106  *
107  * \f[
108  * U^o_k(T,P) = H^o_k(T,P) - p V^o_k
109  * \f]
110  *
111  * <b> XML Example </b>
112  *
113  * An example of the specification of a standard state for the LiCl molten salt
114  * which employs a constant molar volume expression.
115  *
116  @verbatim
117  <speciesData id="species_MoltenSalt">
118  <species name="LiCl(L)">
119  <atomArray> Li:1 Cl:1 </atomArray>
120  <standardState model="constant_incompressible">
121  <molarVolume> 0.02048004 </molarVolume>
122  </standardState>
123  <thermo>
124  <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
125  <floatArray size="7">
126  73.18025, -9.047232, -0.316390,
127  0.079587, 0.013594, -417.1314,
128  157.6711
129  </floatArray>
130  </Shomate>
131  </thermo>
132  </species>
133  </speciesData>
134  @endverbatim
135  *
136  * An example of the specification of a standard state for the LiCl molten salt
137  * which has a temperature dependent standard state volume.
138  *
139  @verbatim
140  <speciesData id="species_MoltenSalt">
141  <species name="LiCl(L)">
142  <atomArray> Li:1 Cl:1 </atomArray>
143  <standardState model="density_temperature_polynomial">
144  <densityTemperaturePolynomial units="gm/cm3" >
145  1.98715, -5.890906E-4, 0.0, 0.0
146  </densityTemperaturePolynomial>
147  </standardState>
148  <thermo>
149  <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
150  <floatArray size="7">
151  73.18025, -9.047232, -0.316390,
152  0.079587, 0.013594, -417.1314,
153  157.6711
154  </floatArray>
155  </Shomate>
156  </thermo>
157  </species>
158  </speciesData>
159  @endverbatim
160  *
161  *
162  * @ingroup pdssthermo
163  */
164 class PDSS_SSVol : public PDSS
165 {
166 
167 public:
168 
169  /**
170  * @name Constructors
171  * @{
172  */
173 
174  //! Constructor
175  /*!
176  * @param tp Pointer to the ThermoPhase object pertaining to the phase
177  * @param spindex Species index of the species in the phase
178  */
179  PDSS_SSVol(VPStandardStateTP* tp, size_t spindex);
180 
181 
182  //! Constructor that initializes the object by examining the input file
183  //! of the ThermoPhase object
184  /*!
185  * This function calls the constructPDSSFile member function.
186  *
187  * @param tp Pointer to the ThermoPhase object pertaining to the phase
188  * @param spindex Species index of the species in the phase
189  * @param inputFile String name of the input file
190  * @param id String name of the phase in the input file. The default
191  * is the empty string, in which case the first phase in the
192  * file is used.
193  */
194  PDSS_SSVol(VPStandardStateTP* tp, size_t spindex,
195  std::string inputFile, std::string id = "");
196 
197  //! Constructor that initializes the object by examining the input file
198  //! of the ThermoPhase object
199  /*!
200  * This function calls the constructPDSSXML member function.
201  *
202  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
203  * @param spindex Species index of the species in the phase
204  * @param speciesNode Reference to the species XML tree.
205  * @param phaseRef Reference to the XML tree containing the phase information.
206  * @param spInstalled Boolean indicating whether the species is installed yet
207  * or not.
208  */
209  PDSS_SSVol(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
210  const XML_Node& phaseRef, bool spInstalled);
211 
212  //! Copy Constructur
213  /*!
214  * @param b Object to be copied
215  */
216  PDSS_SSVol(const PDSS_SSVol& b);
217 
218  //! Assignment operator
219  /*!
220  * @param b Object to be copeid
221  */
222  PDSS_SSVol& operator=(const PDSS_SSVol& b);
223 
224  //! Destructor
225  virtual ~PDSS_SSVol();
226 
227  //! Duplicator
228  virtual PDSS* duplMyselfAsPDSS() const;
229 
230  /**
231  * @}
232  * @name Utilities
233  * @{
234  */
235 
236  /**
237  * @}
238  * @name Molar Thermodynamic Properties of the Species Standard State
239  * in the Solution
240  * @{
241  */
242 
243  //! Return the molar enthalpy in units of J kmol-1
244  /*!
245  * Returns the species standard state enthalpy in J kmol-1 at the
246  * current temperature and pressure.
247  *
248  * @return returns the species standard state enthalpy in J kmol-1
249  */
250  virtual doublereal enthalpy_mole() const;
251 
252  //! Return the standard state molar enthalpy divided by RT
253  /*!
254  * Returns the species standard state enthalpy divided by RT at the
255  * current temperature and pressure.
256  *
257  * @return returns the species standard state enthalpy in unitless form
258  */
259  virtual doublereal enthalpy_RT() const;
260 
261  //! Return the molar internal Energy in units of J kmol-1
262  /*!
263  * Returns the species standard state internal Energy in J kmol-1 at the
264  * current temperature and pressure.
265  *
266  * @return returns the species standard state internal Energy in J kmol-1
267  */
268  virtual doublereal intEnergy_mole() const;
269 
270  //! Return the molar entropy in units of J kmol-1 K-1
271  /*!
272  * Returns the species standard state entropy in J kmol-1 K-1 at the
273  * current temperature and pressure.
274  *
275  * @return returns the species standard state entropy in J kmol-1 K-1
276  */
277  virtual doublereal entropy_mole() const;
278 
279  //! Return the standard state entropy divided by RT
280  /*!
281  * Returns the species standard state entropy divided by RT at the
282  * current temperature and pressure.
283  *
284  * @return returns the species standard state entropy divided by RT
285  */
286  virtual doublereal entropy_R() const;
287 
288  //! Return the molar gibbs free energy in units of J kmol-1
289  /*!
290  * Returns the species standard state gibbs free energy in J kmol-1 at the
291  * current temperature and pressure.
292  *
293  * @return returns the species standard state gibbs free energy in J kmol-1
294  */
295  virtual doublereal gibbs_mole() const;
296 
297  //! Return the molar gibbs free energy divided by RT
298  /*!
299  * Returns the species standard state gibbs free energy divided by RT at the
300  * current temperature and pressure.
301  *
302  * @return returns the species standard state gibbs free energy divided by RT
303  */
304  virtual doublereal gibbs_RT() const;
305 
306  //! Return the molar const pressure heat capacity in units of J kmol-1 K-1
307  /*!
308  * Returns the species standard state Cp in J kmol-1 K-1 at the
309  * current temperature and pressure.
310  *
311  * @return returns the species standard state Cp in J kmol-1 K-1
312  */
313  virtual doublereal cp_mole() const;
314 
315  //! Return the molar const pressure heat capacity divided by RT
316  /*!
317  * Returns the species standard state Cp divided by RT at the
318  * current temperature and pressure.
319  *
320  * @return returns the species standard state Cp divided by RT
321  */
322  virtual doublereal cp_R() const;
323 
324  //! Return the molar const volume heat capacity in units of J kmol-1 K-1
325  /*!
326  * Returns the species standard state Cv in J kmol-1 K-1 at the
327  * current temperature and pressure.
328  *
329  * @return returns the species standard state Cv in J kmol-1 K-1
330  */
331  virtual doublereal cv_mole() const;
332 
333  //! Return the molar volume at standard state
334  /*!
335  * Returns the species standard state molar volume at the
336  * current temperature and pressure
337  *
338  * @return returns the standard state molar volume divided by R
339  * units are m**3 kmol-1.
340  */
341  virtual doublereal molarVolume() const;
342 
343  //! Return the standard state density at standard state
344  /*!
345  * Returns the species standard state density at the
346  * current temperature and pressure
347  *
348  * @return returns the standard state density
349  * units are kg m-3
350  */
351  virtual doublereal density() const;
352 
353  /**
354  * @}
355  * @name Properties of the Reference State of the Species
356  * in the Solution
357  * @{
358  */
359 
360  //! Return the molar gibbs free energy divided by RT at reference pressure
361  /*!
362  * Returns the species reference state gibbs free energy divided by RT at the
363  * current temperature.
364  *
365  * @return returns the reference state gibbs free energy divided by RT
366  */
367  virtual doublereal gibbs_RT_ref() const;
368 
369  //! Return the molar enthalpy divided by RT at reference pressure
370  /*!
371  * Returns the species reference state enthalpy divided by RT at the
372  * current temperature.
373  *
374  * @return returns the reference state enthalpy divided by RT
375  */
376  virtual doublereal enthalpy_RT_ref() const;
377 
378  //! Return the molar entropy divided by R at reference pressure
379  /*!
380  * Returns the species reference state entropy divided by R at the
381  * current temperature.
382  *
383  * @return returns the reference state entropy divided by R
384  */
385  virtual doublereal entropy_R_ref() const;
386 
387  //! Return the molar heat capacity divided by R at reference pressure
388  /*!
389  * Returns the species reference state heat capacity divided by R at the
390  * current temperature.
391  *
392  * @return returns the reference state heat capacity divided by R
393  */
394  virtual doublereal cp_R_ref() const;
395 
396  //! Return the molar volume at reference pressure
397  /*!
398  * Returns the species reference state molar volume at the
399  * current temperature.
400  *
401  * @return returns the reference state molar volume divided by R
402  * units are m**3 kmol-1.
403  */
404  virtual doublereal molarVolume_ref() const;
405 
406 private:
407 
408  //! Does the internal calculation of the volume
409  /*!
410  *
411  */
412  void calcMolarVolume() const;
413 
414  /**
415  * @}
416  * @name Mechanical Equation of State Properties
417  * @{
418  */
419 
420  //! Sets the pressure in the object
421  /*!
422  * Currently, this sets the pressure in the PDSS object.
423  * It is indeterminant what happens to the owning VPStandardStateTP
424  * object and to the VPSSMgr object.
425  *
426  * @param pres Pressure to be set (Pascal)
427  */
428  virtual void setPressure(doublereal pres);
429 
430  //! Set the internal temperature
431  /*!
432  * @param temp Temperature (Kelvin)
433  */
434  virtual void setTemperature(doublereal temp);
435 
436  //! Set the internal temperature and pressure
437  /*!
438  * @param temp Temperature (Kelvin)
439  * @param pres pressure (Pascals)
440  */
441  virtual void setState_TP(doublereal temp, doublereal pres);
442 
443 
444  //! Set the internal temperature and density
445  /*!
446  * @param temp Temperature (Kelvin)
447  * @param rho Density (kg m-3)
448  */
449  virtual void setState_TR(doublereal temp, doublereal rho);
450 
451  /**
452  * @}
453  * @name Miscellaneous properties of the standard state
454  * @{
455  */
456 
457  /// critical temperature
458  virtual doublereal critTemperature() const;
459 
460  /// critical pressure
461  virtual doublereal critPressure() const;
462 
463  /// critical density
464  virtual doublereal critDensity() const;
465 
466  /// saturation pressure
467  /*!
468  * @param t Temperature (kelvin)
469  */
470  virtual doublereal satPressure(doublereal t);
471 
472  /**
473  * @}
474  * @name Initialization of the Object
475  * @{
476  */
477 
478  //! Initialization routine for all of the shallow pointers
479  /*!
480  * This is a cascading call, where each level should call the
481  * the parent level.
482  *
483  * The initThermo() routines get called before the initThermoXML() routines
484  * from the constructPDSSXML() routine.
485  *
486  *
487  * Calls initPtrs();
488  */
489  virtual void initThermo();
490 
491  //! Initialization of a PDSS object using an
492  //! input XML file.
493  /*!
494  *
495  * This routine is a precursor to constructPDSSXML(XML_Node*)
496  * routine, which does most of the work.
497  *
498  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
499  * This object must have already been malloced.
500  *
501  * @param spindex Species index within the phase
502  *
503  * @param inputFile XML file containing the description of the
504  * phase
505  *
506  * @param id Optional parameter identifying the name of the
507  * phase. If none is given, the first XML
508  * phase element will be used.
509  */
510  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
511  std::string inputFile, std::string id);
512 
513  //! Initialization of a PDSS object using an xml tree
514  /*!
515  * This routine is a driver for the initialization of the
516  * object.
517  *
518  * basic logic:
519  * initThermo() (cascade)
520  * getStuff from species Part of XML file
521  * initThermoXML(phaseNode) (cascade)
522  *
523  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
524  * This object must have already been malloced.
525  *
526  * @param spindex Species index within the phase
527  *
528  * @param speciesNode XML Node containing the species information
529  *
530  * @param phaseNode Reference to the phase Information for the phase
531  * that owns this species.
532  *
533  * @param spInstalled Boolean indicating whether the species is
534  * already installed.
535  */
536  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
537  const XML_Node& speciesNode,
538  const XML_Node& phaseNode, bool spInstalled);
539 
540  //! Initialization routine for the PDSS object based on the phaseNode
541  /*!
542  * This is a cascading call, where each level should call the
543  * the parent level.
544  *
545  * @param phaseNode Reference to the phase Information for the phase
546  * that owns this species.
547  *
548  * @param id Optional parameter identifying the name of the
549  * phase. If none is given, the first XML
550  * phase element will be used.
551  */
552  virtual void initThermoXML(const XML_Node& phaseNode, std::string& id);
553 
554  //@}
555 
556 private:
557 
558  //! Enumerated data type describing the type of volume model
559  //! used to calculate the standard state volume of the species
561 
562  //! Value of the constant molar volume for the species
563  /*!
564  * m3 / kmol
565  */
566  doublereal m_constMolarVolume;
567 
568  //! coefficients for the temperature representation
570 
571  //! Derivative of the volume wrt temperature
572  mutable doublereal dVdT_;
573 
574  //! 2nd derivative of the volume wrt temperature
575  mutable doublereal d2VdT2_;
576 
577 };
578 
579 }
580 
581 #endif
582 
583 
584