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