Cantera  2.1.2
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
27  * single species in a phase at its standard states, for a range of
28  * temperatures and pressures. This particular class assumes that the
29  * calculation of the thermodynamics functions can be separated into a
30  * temperature polynomial representation for thermo functions that can be
31  * handled bey a SimpleThermo object and a separate calculation for the
32  * standard state volume. The Models include a cubic polynomial in temperature
33  * for either the standard state volume or the standard state density. The
34  * manager uses a SimpleThermo object to handle the calculation of the
35  * reference state. This object then adds the pressure dependencies and the
36  * volume terms to these thermo functions to complete the representation.
37  *
38  * The class includes the following models for the representation of the
39  * standard state volume:
40  *
41  * - Constant Volume
42  * - This standard state model is invoked with the keyword "constant_incompressible"
43  * or "constant". The standard state volume is considered constant.
44  * \f[
45  * V^o_k(T,P) = a_0
46  * \f]
47  *
48  * - Temperature polynomial for the standard state volume
49  * - This standard state model is invoked with the keyword "temperature_polynomial".
50  * The standard state volume is considered a function of temperature only.
51  * \f[
52  * V^o_k(T,P) = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
53  * \f]
54  *
55  * - Temperature polynomial for the standard state density
56  * - This standard state model is invoked with the keyword "density_temperature_polynomial".
57  * The standard state density, which is the inverse of the volume,
58  * is considered a function of temperature only.
59  * \f[
60  * {\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
61  * \f]
62  *
63  * <b> Specification of Species Standard %State Properties </b>
64  *
65  * The standard molar Gibbs free energy for species <I>k</I> is determined from
66  * the enthalpy and entropy expressions
67  *
68  * \f[
69  * G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P)
70  * \f]
71  *
72  * The enthalpy is calculated mostly from the %SpeciesThermo object's enthalpy
73  * evalulator. The dependence on pressure originates from the Maxwell relation
74  *
75  * \f[
76  * {\left(\frac{dH^o_k}{dP}\right)}_T = T {\left(\frac{dS^o_k}{dP}\right)}_T + V^o_k
77  * \f]
78  * which is equal to
79  *
80  * \f[
81  * {\left(\frac{dH^o_k}{dP}\right)}_T = V^o_k - T {\left(\frac{dV^o_k}{dT}\right)}_P
82  * \f]
83  *
84  * The entropy is calculated mostly from the %SpeciesThermo objects entropy
85  * evalulator. The dependence on pressure originates from the Maxwell relation:
86  *
87  * \f[
88  * {\left(\frac{dS^o_k}{dP}\right)}_T = - {\left(\frac{dV^o_k}{dT}\right)}_P
89  * \f]
90  *
91  * The standard state constant-pressure heat capacity expression is obtained
92  * from taking the temperature derivative of the Maxwell relation involving the
93  * enthalpy given above to yield an expression for the pressure dependence of
94  * the heat capacity.
95  *
96  * \f[
97  * {\left(\frac{d{C}^o_{p,k}}{dP}\right)}_T = - T {\left(\frac{{d}^2{V}^o_k}{{dT}^2}\right)}_T
98  * \f]
99  *
100  * The standard molar Internal Energy for species <I>k</I> is determined from the following
101  * relation.
102  *
103  * \f[
104  * U^o_k(T,P) = H^o_k(T,P) - p V^o_k
105  * \f]
106  *
107  * <b> XML Example </b>
108  *
109  * An example of the specification of a standard state for the LiCl molten salt
110  * which employs a constant molar volume expression.
111  *
112  * @code
113  * <speciesData id="species_MoltenSalt">
114  * <species name="LiCl(L)">
115  * <atomArray> Li:1 Cl:1 </atomArray>
116  * <standardState model="constant_incompressible">
117  * <molarVolume> 0.02048004 </molarVolume>
118  * </standardState>
119  * <thermo>
120  * <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
121  * <floatArray size="7">
122  * 73.18025, -9.047232, -0.316390,
123  * 0.079587, 0.013594, -417.1314,
124  * 157.6711
125  * </floatArray>
126  * </Shomate>
127  * </thermo>
128  * </species>
129  * </speciesData>
130  * @endcode
131  *
132  * An example of the specification of a standard state for the LiCl molten salt
133  * which has a temperature dependent standard state volume.
134  *
135  * @code
136  * <speciesData id="species_MoltenSalt">
137  * <species name="LiCl(L)">
138  * <atomArray> Li:1 Cl:1 </atomArray>
139  * <standardState model="density_temperature_polynomial">
140  * <densityTemperaturePolynomial units="gm/cm3" >
141  * 1.98715, -5.890906E-4, 0.0, 0.0
142  * </densityTemperaturePolynomial>
143  * </standardState>
144  * <thermo>
145  * <Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
146  * <floatArray size="7">
147  * 73.18025, -9.047232, -0.316390,
148  * 0.079587, 0.013594, -417.1314,
149  * 157.6711
150  * </floatArray>
151  * </Shomate>
152  * </thermo>
153  * </species>
154  * </speciesData>
155  * @endcode
156  *
157  * @ingroup pdssthermo
158  */
159 class PDSS_SSVol : public PDSS
160 {
161 public:
162  //! @name Constructors
163  //! @{
164 
165  //! Constructor
166  /*!
167  * @param tp Pointer to the ThermoPhase object pertaining to the phase
168  * @param spindex Species index of the species in the phase
169  */
170  PDSS_SSVol(VPStandardStateTP* tp, size_t spindex);
171 
172  //! Constructor that initializes the object by examining the input file
173  //! of the ThermoPhase object
174  /*!
175  * This function calls the constructPDSSFile member function.
176  *
177  * @param tp Pointer to the ThermoPhase object pertaining to the phase
178  * @param spindex Species index of the species in the phase
179  * @param inputFile String name of the input file
180  * @param id String name of the phase in the input file. The default
181  * is the empty string, in which case the first phase in the
182  * file is used.
183  */
184  PDSS_SSVol(VPStandardStateTP* tp, size_t spindex,
185  const std::string& inputFile, const std::string& id = "");
186 
187  //! Constructor that initializes the object by examining the input file
188  //! of the ThermoPhase object
189  /*!
190  * This function calls the constructPDSSXML member function.
191  *
192  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
193  * @param spindex Species index of the species in the phase
194  * @param speciesNode Reference to the species XML tree.
195  * @param phaseRef Reference to the XML tree containing the phase information.
196  * @param spInstalled Boolean indicating whether the species is installed yet
197  * or not.
198  */
199  PDSS_SSVol(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
200  const XML_Node& phaseRef, bool spInstalled);
201 
202  //! Copy Constructur
203  /*!
204  * @param b Object to be copied
205  */
206  PDSS_SSVol(const PDSS_SSVol& b);
207 
208  //! Assignment operator
209  /*!
210  * @param b Object to be copeid
211  */
212  PDSS_SSVol& operator=(const PDSS_SSVol& b);
213 
214  virtual PDSS* duplMyselfAsPDSS() const;
215 
216  //! @}
217  //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
218  //! @{
219 
220  // See PDSS.h for documentation of functions overridden from Class PDSS
221 
222  virtual doublereal enthalpy_mole() const;
223  virtual doublereal enthalpy_RT() const;
224  virtual doublereal intEnergy_mole() const;
225  virtual doublereal entropy_mole() const;
226  virtual doublereal entropy_R() const;
227  virtual doublereal gibbs_mole() const;
228  virtual doublereal gibbs_RT() const;
229  virtual doublereal cp_mole() const;
230  virtual doublereal cp_R() const;
231  virtual doublereal cv_mole() const;
232  virtual doublereal molarVolume() const;
233  virtual doublereal density() const;
234 
235  //! @}
236  //! @name Properties of the Reference State of the Species in the Solution
237  //! @{
238 
239  virtual doublereal gibbs_RT_ref() const;
240  virtual doublereal enthalpy_RT_ref() const;
241  virtual doublereal entropy_R_ref() const;
242  virtual doublereal cp_R_ref() const;
243  virtual doublereal molarVolume_ref() const;
244 
245 private:
246  //! Does the internal calculation of the volume
247  void calcMolarVolume() const;
248 
249  //! @}
250  //! @name Mechanical Equation of State Properties
251  //! @{
252 
253  virtual void setPressure(doublereal pres);
254  virtual void setTemperature(doublereal temp);
255  virtual void setState_TP(doublereal temp, doublereal pres);
256  virtual void setState_TR(doublereal temp, doublereal rho);
257 
258  //! @}
259  //! @name Miscellaneous properties of the standard state
260  //! @{
261 
262  virtual doublereal critTemperature() const;
263  virtual doublereal critPressure() const;
264  virtual doublereal critDensity() const;
265  virtual doublereal satPressure(doublereal t);
266 
267  //! @}
268  //! @name Initialization of the Object
269  //! @{
270 
271  virtual void initThermo();
272 
273  //! Initialization of a PDSS object using an input XML file.
274  /*!
275  * This routine is a precursor to constructPDSSXML(XML_Node*)
276  * routine, which does most of the work.
277  *
278  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
279  * This object must have already been malloced.
280  *
281  * @param spindex Species index within the phase
282  *
283  * @param inputFile XML file containing the description of the phase
284  *
285  * @param id Optional parameter identifying the name of the
286  * phase. If none is given, the first XML
287  * phase element will be used.
288  */
289  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
290  const std::string& inputFile, const std::string& id);
291 
292  //! Initialization of a PDSS object using an xml tree
293  /*!
294  * This routine is a driver for the initialization of the object.
295  *
296  * basic logic:
297  * - initThermo() (cascade)
298  * - getStuff from species Part of XML file
299  * - initThermoXML(phaseNode) (cascade)
300  *
301  * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
302  * This object must have already been malloced.
303  *
304  * @param spindex Species index within the phase
305  *
306  * @param speciesNode XML Node containing the species information
307  *
308  * @param phaseNode Reference to the phase Information for the phase
309  * that owns this species.
310  *
311  * @param spInstalled Boolean indicating whether the species is
312  * already installed.
313  */
314  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
315  const XML_Node& speciesNode,
316  const XML_Node& phaseNode, bool spInstalled);
317 
318  virtual void initThermoXML(const XML_Node& phaseNode, const std::string& id);
319  //@}
320 
321 private:
322  //! Enumerated data type describing the type of volume model
323  //! used to calculate the standard state volume of the species
325 
326  //! Value of the constant molar volume for the species
327  /*!
328  * m3 / kmol
329  */
330  doublereal m_constMolarVolume;
331 
332  //! coefficients for the temperature representation
334 
335  //! Derivative of the volume wrt temperature
336  mutable doublereal dVdT_;
337 
338  //! 2nd derivative of the volume wrt temperature
339  mutable doublereal d2VdT2_;
340 };
341 
342 }
343 
344 #endif
PDSS_SSVol & operator=(const PDSS_SSVol &b)
Assignment operator.
Definition: PDSS_SSVol.cpp:71
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS_SSVol.cpp:255
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS_SSVol.cpp:194
virtual doublereal satPressure(doublereal t)
saturation pressure
Definition: PDSS_SSVol.cpp:389
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition: PDSS_SSVol.cpp:249
void constructPDSSXML(VPStandardStateTP *vptp_ptr, size_t spindex, const XML_Node &speciesNode, const XML_Node &phaseNode, bool spInstalled)
Initialization of a PDSS object using an xml tree.
Definition: PDSS_SSVol.cpp:88
void calcMolarVolume() const
Does the internal calculation of the volume.
Definition: PDSS_SSVol.cpp:293
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS_SSVol.cpp:230
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS_SSVol.cpp:351
virtual void initThermoXML(const XML_Node &phaseNode, const std::string &id)
Initialization routine for the PDSS object based on the phaseNode.
Definition: PDSS_SSVol.cpp:167
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual doublereal critPressure() const
critical pressure
Definition: PDSS_SSVol.cpp:320
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS_SSVol.cpp:200
virtual doublereal critTemperature() const
critical temperature
Definition: PDSS_SSVol.cpp:314
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS_SSVol.cpp:332
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS_SSVol.cpp:283
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS_SSVol.cpp:273
SSVolume_Model_enumType
Types of general formulations for the specification of the standard state volume. ...
Definition: mix_defs.h:102
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
virtual doublereal gibbs_RT_ref() const
Return the molar gibbs free energy divided by RT at reference pressure.
Definition: PDSS_SSVol.cpp:268
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS_SSVol.cpp:222
doublereal d2VdT2_
2nd derivative of the volume wrt temperature
Definition: PDSS_SSVol.h:339
SSVolume_Model_enumType volumeModel_
Enumerated data type describing the type of volume model used to calculate the standard state volume ...
Definition: PDSS_SSVol.h:324
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS_SSVol.cpp:236
doublereal m_constMolarVolume
Value of the constant molar volume for the species.
Definition: PDSS_SSVol.h:330
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS_SSVol.cpp:288
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS_SSVol.cpp:373
virtual doublereal critDensity() const
critical density
Definition: PDSS_SSVol.cpp:326
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
vector_fp TCoeff_
coefficients for the temperature representation
Definition: PDSS_SSVol.h:333
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS_SSVol.cpp:186
doublereal dVdT_
Derivative of the volume wrt temperature.
Definition: PDSS_SSVol.h:336
Class for pressure dependent standard states that uses a standard state volume model of some sort...
Definition: PDSS_SSVol.h:159
virtual void initThermo()
Initialization routine for all of the shallow pointers.
Definition: PDSS_SSVol.cpp:176
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS_SSVol.cpp:261
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS_SSVol.cpp:243
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS_SSVol.cpp:278
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:165
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:195
virtual PDSS * duplMyselfAsPDSS() const
Duplication routine for objects which inherit from PDSS.
Definition: PDSS_SSVol.cpp:83
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS_SSVol.cpp:216
PDSS_SSVol(VPStandardStateTP *tp, size_t spindex)
Constructor.
Definition: PDSS_SSVol.cpp:25
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
Definition: PDSS_SSVol.cpp:379
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS_SSVol.cpp:209
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.
Definition: PDSS_SSVol.cpp:130