Cantera  2.3.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 // This file is part of Cantera. See License.txt in the top-level directory or
10 // at http://www.cantera.org/license.txt for license and copyright information.
11 
12 #ifndef CT_PDSS_SSVOL_H
13 #define CT_PDSS_SSVOL_H
14 
15 #include "PDSS.h"
16 
17 namespace Cantera
18 {
19 //! Class for pressure dependent standard states that uses a standard state
20 //! volume model of some sort.
21 /*!
22  * @attention This class currently does not have any test cases or examples. Its
23  * implementation may be incomplete, and future changes to Cantera may
24  * unexpectedly cause this class to stop working. If you use this class,
25  * please consider contributing examples or test cases. In the absence of
26  * new tests or examples, this class may be deprecated and removed in a
27  * future version of Cantera. See
28  * https://github.com/Cantera/cantera/issues/267 for additional information.
29  *
30  * Class PDSS_SSVol is an implementation class that compute the properties of a
31  * single species in a phase at its standard states, for a range of temperatures
32  * and pressures. This particular class assumes that the calculation of the
33  * thermodynamics functions can be separated into a temperature polynomial
34  * representation for thermo functions that can be handled bey a SimpleThermo
35  * object and a separate calculation for the standard state volume. The Models
36  * include a cubic polynomial in temperature for either the standard state
37  * volume or the standard state density. The manager uses a SimpleThermo object
38  * to handle the calculation of the reference state. This object then adds the
39  * pressure dependencies and the volume terms to these thermo functions to
40  * complete the representation.
41  *
42  * The class includes the following models for the representation of the
43  * standard state volume:
44  *
45  * - Constant Volume
46  * - This standard state model is invoked with the keyword "constant_incompressible"
47  * or "constant". The standard state volume is considered constant.
48  * \f[
49  * V^o_k(T,P) = a_0
50  * \f]
51  *
52  * - Temperature polynomial for the standard state volume
53  * - This standard state model is invoked with the keyword "temperature_polynomial".
54  * The standard state volume is considered a function of temperature only.
55  * \f[
56  * V^o_k(T,P) = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
57  * \f]
58  *
59  * - Temperature polynomial for the standard state density
60  * - This standard state model is invoked with the keyword "density_temperature_polynomial".
61  * The standard state density, which is the inverse of the volume,
62  * is considered a function of temperature only.
63  * \f[
64  * {\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
65  * \f]
66  *
67  * ## Specification of Species Standard State Properties
68  *
69  * The standard molar Gibbs free energy for species *k* is determined from
70  * the enthalpy and entropy expressions
71  *
72  * \f[
73  * G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P)
74  * \f]
75  *
76  * The enthalpy is calculated mostly from the MultiSpeciesThermo object's enthalpy
77  * evaluator. The dependence on pressure originates from the Maxwell relation
78  *
79  * \f[
80  * {\left(\frac{dH^o_k}{dP}\right)}_T = T {\left(\frac{dS^o_k}{dP}\right)}_T + V^o_k
81  * \f]
82  * which is equal to
83  *
84  * \f[
85  * {\left(\frac{dH^o_k}{dP}\right)}_T = V^o_k - T {\left(\frac{dV^o_k}{dT}\right)}_P
86  * \f]
87  *
88  * The entropy is calculated mostly from the MultiSpeciesThermo objects entropy
89  * evaluator. The dependence on pressure originates from the Maxwell relation:
90  *
91  * \f[
92  * {\left(\frac{dS^o_k}{dP}\right)}_T = - {\left(\frac{dV^o_k}{dT}\right)}_P
93  * \f]
94  *
95  * The standard state constant-pressure heat capacity expression is obtained
96  * from taking the temperature derivative of the Maxwell relation involving the
97  * enthalpy given above to yield an expression for the pressure dependence of
98  * 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 *k* is determined from the
105  * following relation.
106  *
107  * \f[
108  * U^o_k(T,P) = H^o_k(T,P) - p V^o_k
109  * \f]
110  *
111  * ## XML Example
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  * @code
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  * @endcode
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  * @code
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  * @endcode
160  *
161  * @ingroup pdssthermo
162  */
164 {
165 public:
166  //! @name Constructors
167  //! @{
168 
169  //! Constructor
170  /*!
171  * @param tp Pointer to the ThermoPhase object pertaining to the phase
172  * @param spindex Species index of the species in the phase
173  */
174  PDSS_SSVol(VPStandardStateTP* tp, size_t spindex);
175 
176  //! Constructor that initializes the object by examining the input file
177  //! of the ThermoPhase object
178  /*!
179  * This function calls the constructPDSSFile member function.
180  *
181  * @param tp Pointer to the ThermoPhase object pertaining to the phase
182  * @param spindex Species index of the species in the phase
183  * @param inputFile String name of the input file
184  * @param id String name of the phase in the input file. The default
185  * is the empty string, in which case the first phase in the
186  * file is used.
187  * @deprecated To be removed after Cantera 2.3.
188  */
189  PDSS_SSVol(VPStandardStateTP* tp, size_t spindex,
190  const std::string& inputFile, const std::string& id = "");
191 
192  //! Constructor that initializes the object by examining the input file
193  //! of the ThermoPhase object
194  /*!
195  * This function calls the constructPDSSXML member function.
196  *
197  * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
198  * @param spindex Species index of the species in the phase
199  * @param speciesNode Reference to the species XML tree.
200  * @param phaseRef Reference to the XML tree containing the phase information.
201  * @param spInstalled Boolean indicating whether the species is installed yet
202  * or not.
203  */
204  PDSS_SSVol(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode,
205  const XML_Node& phaseRef, bool spInstalled);
206 
207  PDSS_SSVol(const PDSS_SSVol& b);
208  PDSS_SSVol& operator=(const PDSS_SSVol& b);
209  virtual PDSS* duplMyselfAsPDSS() const;
210 
211  //! @}
212  //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
213  //! @{
214 
215  // See PDSS.h for documentation of functions overridden from Class PDSS
216 
217  virtual doublereal enthalpy_RT() const;
218  virtual doublereal intEnergy_mole() const;
219  virtual doublereal entropy_R() const;
220  virtual doublereal gibbs_RT() const;
221  virtual doublereal cp_R() const;
222  virtual doublereal cv_mole() const;
223  virtual doublereal molarVolume() const;
224  virtual doublereal density() const;
225 
226  //! @}
227  //! @name Properties of the Reference State of the Species in the Solution
228  //! @{
229 
230  virtual doublereal gibbs_RT_ref() const;
231  virtual doublereal enthalpy_RT_ref() const;
232  virtual doublereal entropy_R_ref() const;
233  virtual doublereal cp_R_ref() const;
234  virtual doublereal molarVolume_ref() const;
235  //! @}
236 
237 private:
238  //! Does the internal calculation of the volume
239  void calcMolarVolume() const;
240 
241  //! @name Mechanical Equation of State Properties
242  //! @{
243 
244  virtual void setPressure(doublereal pres);
245  virtual void setTemperature(doublereal temp);
246  virtual void setState_TP(doublereal temp, doublereal pres);
247  virtual void setState_TR(doublereal temp, doublereal rho);
248 
249  //! @}
250  //! @name Miscellaneous properties of the standard state
251  //! @{
252 
253  virtual doublereal satPressure(doublereal t);
254 
255  //! @}
256  //! @name Initialization of the Object
257  //! @{
258 
259  virtual void initThermo();
260 
261  //! Initialization of a PDSS object using an input XML file.
262  /*!
263  * This routine is a precursor to constructPDSSXML(XML_Node*)
264  * routine, which does most of the work.
265  *
266  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
267  * @param spindex Species index within the phase
268  * @param inputFile XML file containing the description of the phase
269  * @param id Optional parameter identifying the name of the
270  * phase. If none is given, the first XML
271  * phase element will be used.
272  * @deprecated To be removed after Cantera 2.3.
273  */
274  void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex,
275  const std::string& inputFile, const std::string& id);
276 
277  //! Initialization of a PDSS object using an XML tree
278  /*!
279  * This routine is a driver for the initialization of the object.
280  *
281  * basic logic:
282  * - initThermo() (cascade)
283  * - getStuff from species Part of XML file
284  * - initThermoXML(phaseNode) (cascade)
285  *
286  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
287  * @param spindex Species index within the phase
288  * @param speciesNode XML Node containing the species information
289  * @param phaseNode Reference to the phase Information for the phase
290  * that owns this species.
291  * @param spInstalled Boolean indicating whether the species is
292  * already installed.
293  */
294  void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex,
295  const XML_Node& speciesNode,
296  const XML_Node& phaseNode, bool spInstalled);
297 
298  virtual void initThermoXML(const XML_Node& phaseNode, const std::string& id);
299  //@}
300 
301 private:
302  //! Types of general formulations for the specification of the standard
303  //! state volume
304  enum class SSVolume_Model {
305  //! This approximation is for a constant volume
306  constant = 0,
307  //! This approximation is for a species with a quadratic polynomial in
308  //! temperature
309  /*!
310  * V^ss_i = ai + bi T + ci T2
311  */
312  tpoly,
313  //! This approximation is for a species where the density is expressed
314  //! as a quadratic polynomial in temperature
315  /*!
316  * V^ss_i = M_i / (ai + bi T + ci T2)
317  */
319  };
320 
321  //! Enumerated data type describing the type of volume model
322  //! used to calculate the standard state volume of the species
324 
325  //! Value of the constant molar volume for the species
326  /*!
327  * m3 / kmol
328  */
329  doublereal m_constMolarVolume;
330 
331  //! coefficients for the temperature representation
333 
334  //! Derivative of the volume wrt temperature
335  mutable doublereal dVdT_;
336 
337  //! 2nd derivative of the volume wrt temperature
338  mutable doublereal d2VdT2_;
339 };
340 
341 }
342 
343 #endif
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS_SSVol.cpp:196
SSVolume_Model volumeModel_
Enumerated data type describing the type of volume model used to calculate the standard state volume ...
Definition: PDSS_SSVol.h:323
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS_SSVol.cpp:170
virtual PDSS * duplMyselfAsPDSS() const
Duplication routine for objects which inherit from PDSS.
Definition: PDSS_SSVol.cpp:75
void calcMolarVolume() const
Does the internal calculation of the volume.
Definition: PDSS_SSVol.cpp:231
virtual doublereal satPressure(doublereal t)
saturation pressure
Definition: PDSS_SSVol.cpp:309
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:80
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS_SSVol.cpp:176
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS_SSVol.cpp:271
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:148
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS_SSVol.cpp:211
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS_SSVol.cpp:181
This approximation is for a constant volume.
This approximation is for a species with a quadratic polynomial in temperature.
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS_SSVol.cpp:252
This approximation is for a species where the density is expressed as a quadratic polynomial in tempe...
SSVolume_Model
Types of general formulations for the specification of the standard state volume. ...
Definition: PDSS_SSVol.h:304
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS_SSVol.cpp:206
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
Base class for PDSS classes which compute nondimensional properties directly.
Definition: PDSS.h:662
doublereal d2VdT2_
2nd derivative of the volume wrt temperature
Definition: PDSS_SSVol.h:338
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS_SSVol.cpp:186
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS_SSVol.cpp:221
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS_SSVol.cpp:165
doublereal m_constMolarVolume
Value of the constant molar volume for the species.
Definition: PDSS_SSVol.h:329
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS_SSVol.cpp:293
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:332
doublereal dVdT_
Derivative of the volume wrt temperature.
Definition: PDSS_SSVol.h:335
Class for pressure dependent standard states that uses a standard state volume model of some sort...
Definition: PDSS_SSVol.h:163
virtual void initThermo()
Initialization routine for all of the shallow pointers.
Definition: PDSS_SSVol.cpp:157
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS_SSVol.cpp:216
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition: PDSS_SSVol.cpp:191
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS_SSVol.cpp:201
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:176
PDSS_SSVol(VPStandardStateTP *tp, size_t spindex)
Constructor.
Definition: PDSS_SSVol.cpp:18
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
Definition: PDSS_SSVol.cpp:299
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:120
Namespace for the Cantera kernel.
Definition: application.cpp:29
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS_SSVol.cpp:226