Cantera  3.1.0a1
Loading...
Searching...
No Matches
PDSS.h
Go to the documentation of this file.
1/**
2 * @file PDSS.h
3 * Declarations for the virtual base class PDSS (pressure dependent standard state)
4 * which handles calculations for a single species in a phase
5 * (see @ref pdssthermo and class @link Cantera::PDSS PDSS@endlink).
6 */
7
8// This file is part of Cantera. See License.txt in the top-level directory or
9// at https://cantera.org/license.txt for license and copyright information.
10
11#ifndef CT_PDSS_H
12#define CT_PDSS_H
14#include "cantera/base/AnyMap.h"
15
16namespace Cantera
17{
18/**
19 * @defgroup pdssthermo Species Standard-State Thermodynamic Properties
20 *
21 * In this module we describe %Cantera's treatment of pressure dependent
22 * standard states (PDSS) objects. These are objects that calculate the standard
23 * state of a single species that depends on both temperature and pressure.
24 *
25 * To compute the thermodynamic properties of multicomponent solutions, it is
26 * necessary to know something about the thermodynamic properties of the
27 * individual species present in the solution. Exactly what sort of species
28 * properties are required depends on the thermodynamic model for the solution.
29 * For a gaseous solution (that is, a gas mixture), the species properties required
30 * are usually ideal gas properties at the mixture temperature and at a
31 * reference pressure (almost always at 1 bar). For other types of solutions,
32 * however, it may not be possible to isolate the species in a "pure" state. For
33 * example, the thermodynamic properties of, say, Na+ and Cl- in saltwater are
34 * not easily determined from data on the properties of solid NaCl, or solid Na
35 * metal, or chlorine gas. In this case, the solvation in water is fundamental
36 * to the identity of the species, and some other reference state must be used.
37 * One common convention for liquid solutions is to use thermodynamic data for
38 * the solutes in the limit of infinite dilution within the pure solvent;
39 * another convention is to reference all properties to unit molality.
40 *
41 * In defining these standard states for species in a phase, we make the
42 * following definition. A reference state is a standard state of a species in a
43 * phase limited to one particular pressure, the reference pressure. The
44 * reference state specifies the dependence of all thermodynamic functions as a
45 * function of the temperature, in between a minimum temperature and a maximum
46 * temperature. The reference state also specifies the molar volume of the
47 * species as a function of temperature. The molar volume is a thermodynamic
48 * function. A full standard state does the same thing as a reference state, but
49 * specifies the thermodynamics functions at all pressures.
50 *
51 * Class PDSS is the base class for a family of classes that compute properties
52 * of a single species in a phase at its standard states, for a range of
53 * temperatures and pressures. PDSS objects are used by derivatives of the
54 * VPStandardState class. These classes assume that there exists a standard
55 * state for each species in the phase, where the thermodynamic functions are
56 * specified as a function of temperature and pressure. Standard state objects
57 * for each species in the phase are all derived from the PDSS virtual base
58 * class.
59 *
60 * The following classes inherit from PDSS. Each of these classes handles just
61 * one species.
62 *
63 * - PDSS_ConstVol
64 * - standardState model = "ConstVol" or "constant_incompressible"
65 * - This model assumes that the species in the phase obeys the constant
66 * partial molar volume pressure dependence. The manager uses a
67 * SpeciesThermoInterpType object to handle the calculation of the reference state.
68 * This object adds the pressure dependencies to these thermo functions.
69 *
70 * - PDSS_SSVol
71 * - standardState model = "temperature_polynomial"
72 * - standardState model = "density_temperature_polynomial"
73 * - This model assumes that the species in the phase obey a fairly general
74 * equation of state, but one that separates out the calculation of the
75 * standard state density and/or volume. Models include a cubic polynomial
76 * in temperature for either the standard state volume or the standard state
77 * density. The manager uses a SpeciesThermoInterpType object to handle the
78 * calculation of the reference state. This object then adds the pressure
79 * dependencies and the volume terms to these thermo functions to complete the
80 * representation.
81 *
82 * - PDSS_Water
83 * - standardState model = "Water"
84 * - This model assumes that Species 0 is assumed to be water, and a real
85 * equation of state is used to model the T, P behavior. Note, the model
86 * assumes that the species is liquid water, and not steam.
87 *
88 * - PDSS_HKFT
89 * - standardState model = "HKFT"
90 * - This model assumes that the species follows the HKFT pressure dependent
91 * equation of state
92 *
93 * Normally the PDSS object is not called directly. Instead the
94 * VPStandardStateTP object manages the calls to the PDSS object for the entire
95 * set of species that comprise a phase.
96 *
97 * The PDSS objects may or may not utilize a SpeciesThermoInterpType reference
98 * state manager class to calculate the reference state thermodynamics functions
99 * in their own calculation. There are some classes, such as PDSS_IdealGas and
100 * PDSS_ConstVol, which utilize the SpeciesThermoInterpType object because the
101 * calculation is very similar to the reference state calculation, while there
102 * are other classes, PDSS_Water and PDSS_HKFT, which don't utilize the
103 * reference state calculation at all, because it wouldn't make sense to. For
104 * example, using the PDSS_Water module, there isn't anything special about the
105 * reference pressure of 1 bar, so the reference state calculation would
106 * represent a duplication of work. Additionally, when evaluating thermodynamic
107 * properties at higher pressures and temperatures, near the critical point,
108 * evaluation of the thermodynamics at a pressure of 1 bar may lead to
109 * situations where the liquid is unstable, that is, beyond the spinodal curve
110 * leading to potentially wrong evaluation results.
111 *
112 * @ingroup thermoprops
113 */
114
115class SpeciesThermoInterpType;
116class VPStandardStateTP;
117
118//! Virtual base class for a species with a pressure dependent standard state
119/*!
120 * Virtual base class for calculation of the pressure dependent standard state
121 * for a single species
122 *
123 * Class PDSS is the base class for a family of classes that compute properties
124 * of a set of species in their standard states at a range of temperatures and
125 * pressures. The independent variables for this object are temperature and
126 * pressure. The class may have a reference to a SpeciesThermoInterpType object
127 * which handles the calculation of the reference state temperature behavior of
128 * the species.
129 *
130 * This class is analogous to the SpeciesThermoInterpType class, except that
131 * the standard state inherently incorporates the pressure dependence.
132 *
133 * The class operates on a setState temperature and pressure basis. It only
134 * recalculates the standard state when the setState functions for temperature
135 * and pressure are called.
136 *
137 * @ingroup pdssthermo
138 */
139class PDSS
140{
141public:
142 //! @name Constructors
143 //! @{
144
145 //! Default Constructor
146 PDSS() = default;
147
148 // PDSS objects are not copyable or assignable
149 PDSS(const PDSS& b) = delete;
150 PDSS& operator=(const PDSS& b) = delete;
151 virtual ~PDSS() = default;
152
153 //! @}
154 //! @name Molar Thermodynamic Properties of the Species Standard State
155 //! @{
156
157 //! Return the molar enthalpy in units of J kmol-1
158 /*!
159 * @return the species standard state enthalpy in J kmol-1 at the current
160 * temperature and pressure.
161 */
162 virtual double enthalpy_mole() const;
163
164 //! Return the standard state molar enthalpy divided by RT
165 /*!
166 * @return The dimensionless species standard state enthalpy divided at
167 * the current temperature and pressure.
168 */
169 virtual double enthalpy_RT() const;
170
171 //! Return the molar internal Energy in units of J kmol-1
172 /*!
173 * @return The species standard state internal Energy in J kmol-1 at the
174 * current temperature and pressure.
175 */
176 virtual double intEnergy_mole() const;
177
178 //! Return the molar entropy in units of J kmol-1 K-1
179 /*!
180 * @return The species standard state entropy in J kmol-1 K-1 at the
181 * current temperature and pressure.
182 */
183 virtual double entropy_mole() const;
184
185 //! Return the standard state entropy divided by RT
186 /*!
187 * @return The species standard state entropy divided by RT at the current
188 * temperature and pressure.
189 */
190 virtual double entropy_R() const;
191
192 //! Return the molar Gibbs free energy in units of J kmol-1
193 /*!
194 * @return The species standard state Gibbs free energy in J kmol-1 at the
195 * current temperature and pressure.
196 */
197 virtual double gibbs_mole() const;
198
199 //! Return the molar Gibbs free energy divided by RT
200 /*!
201 * @return The species standard state Gibbs free energy divided by RT at
202 * the current temperature and pressure.
203 */
204 virtual double gibbs_RT() const;
205
206 //! Return the molar const pressure heat capacity in units of J kmol-1 K-1
207 /*!
208 * @return The species standard state Cp in J kmol-1 K-1 at the current
209 * temperature and pressure.
210 */
211 virtual double cp_mole() const;
212
213 //! Return the molar const pressure heat capacity divided by RT
214 /*!
215 * @return The species standard state Cp divided by RT at the current
216 * temperature and pressure.
217 */
218 virtual double cp_R() const;
219
220 //! Return the molar const volume heat capacity in units of J kmol-1 K-1
221 /*!
222 * @return The species standard state Cv in J kmol-1 K-1 at the
223 * current temperature and pressure.
224 */
225 virtual double cv_mole() const;
226
227 //! Return the molar volume at standard state
228 /*!
229 * @return The standard state molar volume at the current temperature and
230 * pressure. Units are m**3 kmol-1.
231 */
232 virtual double molarVolume() const;
233
234 //! Return the standard state density at standard state
235 /*!
236 * @return The standard state density at the current temperature and
237 * pressure. units are kg m-3
238 */
239 virtual double density() const;
240
241 //! @}
242 //! @name Properties of the Reference State of the Species in the Solution
243 //! @{
244
245 //! Return the reference pressure for this phase.
246 double refPressure() const {
247 return m_p0;
248 }
249
250 //! return the minimum temperature
251 double minTemp() const {
252 return m_minTemp;
253 }
254
255 //! return the minimum temperature
256 double maxTemp() const {
257 return m_maxTemp;
258 }
259
260 //! Return the molar Gibbs free energy divided by RT at reference pressure
261 /*!
262 * @return The reference state Gibbs free energy at the current
263 * temperature, divided by RT.
264 */
265 virtual double gibbs_RT_ref() const;
266
267 //! Return the molar enthalpy divided by RT at reference pressure
268 /*!
269 * @return The species reference state enthalpy at the current
270 * temperature, divided by RT.
271 */
272 virtual double enthalpy_RT_ref() const;
273
274 //! Return the molar entropy divided by R at reference pressure
275 /*!
276 * @return The species reference state entropy at the current
277 * temperature, divided by R.
278 */
279 virtual double entropy_R_ref() const;
280
281 //! Return the molar heat capacity divided by R at reference pressure
282 /*!
283 * @return The species reference state heat capacity divided by R at the
284 * current temperature.
285 */
286 virtual double cp_R_ref() const;
287
288 //! Return the molar volume at reference pressure
289 /*!
290 * @return The reference state molar volume. units are m**3 kmol-1.
291 */
292 virtual double molarVolume_ref() const;
293
294 //! @}
295 //! @name Mechanical Equation of State Properties
296 //! @{
297
298 //! Returns the pressure (Pa)
299 virtual double pressure() const;
300
301 //! Sets the pressure in the object
302 /*!
303 * Currently, this sets the pressure in the PDSS object. It is indeterminant
304 * what happens to the owning VPStandardStateTP object.
305 *
306 * @param pres Pressure to be set (Pascal)
307 */
308 virtual void setPressure(double pres);
309
310 //! Return the volumetric thermal expansion coefficient. Units: 1/K.
311 /*!
312 * The thermal expansion coefficient is defined as
313 * @f[
314 * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
315 * @f]
316 */
317 virtual double thermalExpansionCoeff() const;
318 //! @}
319
320 //! Set the internal temperature
321 /*!
322 * @param temp Temperature (Kelvin)
323 */
324 virtual void setTemperature(double temp);
325
326 //! Return the current stored temperature
327 virtual double temperature() const;
328
329 //! Set the internal temperature and pressure
330 /*!
331 * @param temp Temperature (Kelvin)
332 * @param pres pressure (Pascals)
333 */
334 virtual void setState_TP(double temp, double pres);
335
336 //! critical temperature
337 virtual double critTemperature() const;
338
339 //! critical pressure
340 virtual double critPressure() const;
341
342 //! critical density
343 virtual double critDensity() const;
344
345 //! saturation pressure
346 /*!
347 * @param T Temperature (Kelvin)
348 */
349 virtual double satPressure(double T);
350
351 //! Return the molecular weight of the species
352 //! in units of kg kmol-1
353 double molecularWeight() const;
354
355 //! Set the molecular weight of the species
356 /*!
357 * @param mw Molecular Weight in kg kmol-1
358 */
359 void setMolecularWeight(double mw);
360
361 //! @name Initialization of the Object
362 //! @{
363
364 //! Set the SpeciesThermoInterpType object used to calculate reference
365 //! state properties
366 void setReferenceThermo(shared_ptr<SpeciesThermoInterpType> stit) {
367 m_spthermo = stit;
368 }
369
370 //! Set the parent VPStandardStateTP object of this PDSS object
371 /*!
372 * This information is only used by certain PDSS subclasses
373 * @param phase Pointer to the parent phase
374 * @param k Index of this species in the phase
375 */
376 virtual void setParent(VPStandardStateTP* phase, size_t k) {}
377
378 //! Initialization routine
379 /*!
380 * This is a cascading call, where each level should call the the parent
381 * level.
382 */
383 virtual void initThermo() {}
384
385 //! Set model parameters from an AnyMap phase description, for example from the
386 //! `equation-of-state` field of a species definition.
387 void setParameters(const AnyMap& node) {
388 m_input = node;
389 }
390
391 //! Store the parameters needed to reconstruct a copy of this PDSS object
392 virtual void getParameters(AnyMap& eosNode) const {}
393
394 //! @}
395
396protected:
397 //! Current temperature used by the PDSS object
398 mutable double m_temp = -1.0;
399
400 //! State of the system - pressure
401 mutable double m_pres = -1.0;
402
403 //! Reference state pressure of the species.
404 double m_p0 = -1.0;
405
406 //! Minimum temperature
407 double m_minTemp = -1.0;
408
409 //! Maximum temperature
410 double m_maxTemp = 10000.0;
411
412 //! Molecular Weight of the species
413 double m_mw = 0.0;
414
415 //! Input data supplied via setParameters. This may include parameters for
416 //! different phase models, which will be used when initThermo() is called.
418
419 //! Pointer to the species thermodynamic property manager. Not used in all
420 //! PDSS models.
421 shared_ptr<SpeciesThermoInterpType> m_spthermo;
422};
423
424//! Base class for PDSS classes which compute molar properties directly
425class PDSS_Molar : public virtual PDSS
426{
427public:
428 double enthalpy_RT() const override;
429 double entropy_R() const override;
430 double gibbs_RT() const override;
431 double cp_R() const override;
432};
433
434//! Base class for PDSS classes which compute nondimensional properties directly
435class PDSS_Nondimensional : public virtual PDSS
436{
437public:
439
440 double enthalpy_mole() const override;
441 double entropy_mole() const override;
442 double gibbs_mole() const override;
443 double cp_mole() const override;
444
445 double enthalpy_RT_ref() const override;
446 double entropy_R_ref() const override;
447 double gibbs_RT_ref() const override;
448 double cp_R_ref() const override;
449 double molarVolume_ref() const override;
450 double enthalpy_RT() const override;
451 double entropy_R() const override;
452 double gibbs_RT() const override;
453 double cp_R() const override;
454 double molarVolume() const override;
455 double density() const override;
456
457protected:
458 double m_h0_RT; //!< Reference state enthalpy divided by RT
459 double m_cp0_R; //!< Reference state heat capacity divided by R
460 double m_s0_R; //!< Reference state entropy divided by R
461 double m_g0_RT; //!< Reference state Gibbs free energy divided by RT
462 double m_V0; //!< Reference state molar volume (m^3/kmol)
463 double m_hss_RT; //!< Standard state enthalpy divided by RT
464 double m_cpss_R; //!< Standard state heat capacity divided by R
465 double m_sss_R; //!< Standard state entropy divided by R
466 double m_gss_RT; //!< Standard state Gibbs free energy divided by RT
467 double m_Vss; //!< Standard State molar volume (m^3/kmol)
468};
469
470}
471
472#endif
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Base class for PDSS classes which compute molar properties directly.
Definition PDSS.h:426
double cp_R() const override
Return the molar const pressure heat capacity divided by RT.
Definition PDSS.cpp:179
double entropy_R() const override
Return the standard state entropy divided by RT.
Definition PDSS.cpp:169
double enthalpy_RT() const override
Return the standard state molar enthalpy divided by RT.
Definition PDSS.cpp:164
double gibbs_RT() const override
Return the molar Gibbs free energy divided by RT.
Definition PDSS.cpp:174
Base class for PDSS classes which compute nondimensional properties directly.
Definition PDSS.h:436
double molarVolume() const override
Return the molar volume at standard state.
Definition PDSS.cpp:265
double enthalpy_mole() const override
Return the molar enthalpy in units of J kmol-1.
Definition PDSS.cpp:200
double m_sss_R
Standard state entropy divided by R.
Definition PDSS.h:465
double gibbs_RT_ref() const override
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition PDSS.cpp:220
double cp_R() const override
Return the molar const pressure heat capacity divided by RT.
Definition PDSS.cpp:260
double m_cpss_R
Standard state heat capacity divided by R.
Definition PDSS.h:464
double entropy_R_ref() const override
Return the molar entropy divided by R at reference pressure.
Definition PDSS.cpp:230
double enthalpy_RT_ref() const override
Return the molar enthalpy divided by RT at reference pressure.
Definition PDSS.cpp:225
double m_h0_RT
Reference state enthalpy divided by RT.
Definition PDSS.h:458
double m_g0_RT
Reference state Gibbs free energy divided by RT.
Definition PDSS.h:461
double m_s0_R
Reference state entropy divided by R.
Definition PDSS.h:460
double entropy_mole() const override
Return the molar entropy in units of J kmol-1 K-1.
Definition PDSS.cpp:205
double m_gss_RT
Standard state Gibbs free energy divided by RT.
Definition PDSS.h:466
double entropy_R() const override
Return the standard state entropy divided by RT.
Definition PDSS.cpp:250
double m_cp0_R
Reference state heat capacity divided by R.
Definition PDSS.h:459
double cp_mole() const override
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition PDSS.cpp:215
double enthalpy_RT() const override
Return the standard state molar enthalpy divided by RT.
Definition PDSS.cpp:245
double m_Vss
Standard State molar volume (m^3/kmol)
Definition PDSS.h:467
double density() const override
Return the standard state density at standard state.
Definition PDSS.cpp:270
double gibbs_mole() const override
Return the molar Gibbs free energy in units of J kmol-1.
Definition PDSS.cpp:210
double m_hss_RT
Standard state enthalpy divided by RT.
Definition PDSS.h:463
double molarVolume_ref() const override
Return the molar volume at reference pressure.
Definition PDSS.cpp:240
double gibbs_RT() const override
Return the molar Gibbs free energy divided by RT.
Definition PDSS.cpp:255
double m_V0
Reference state molar volume (m^3/kmol)
Definition PDSS.h:462
double cp_R_ref() const override
Return the molar heat capacity divided by R at reference pressure.
Definition PDSS.cpp:235
Virtual base class for a species with a pressure dependent standard state.
Definition PDSS.h:140
virtual double satPressure(double T)
saturation pressure
Definition PDSS.cpp:157
double molecularWeight() const
Return the molecular weight of the species in units of kg kmol-1.
Definition PDSS.cpp:143
virtual double cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition PDSS.cpp:73
virtual void setTemperature(double temp)
Set the internal temperature.
Definition PDSS.cpp:138
virtual double entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition PDSS.cpp:33
virtual void initThermo()
Initialization routine.
Definition PDSS.h:383
virtual double enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition PDSS.cpp:18
virtual double gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition PDSS.cpp:48
double m_p0
Reference state pressure of the species.
Definition PDSS.h:404
virtual double cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition PDSS.cpp:93
double m_temp
Current temperature used by the PDSS object.
Definition PDSS.h:398
virtual double density() const
Return the standard state density at standard state.
Definition PDSS.cpp:68
virtual double pressure() const
Returns the pressure (Pa)
Definition PDSS.cpp:103
void setParameters(const AnyMap &node)
Set model parameters from an AnyMap phase description, for example from the equation-of-state field o...
Definition PDSS.h:387
double minTemp() const
return the minimum temperature
Definition PDSS.h:251
shared_ptr< SpeciesThermoInterpType > m_spthermo
Pointer to the species thermodynamic property manager.
Definition PDSS.h:421
double refPressure() const
Return the reference pressure for this phase.
Definition PDSS.h:246
PDSS()=default
Default Constructor.
void setMolecularWeight(double mw)
Set the molecular weight of the species.
Definition PDSS.cpp:147
virtual double cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition PDSS.cpp:53
virtual double gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition PDSS.cpp:43
virtual double temperature() const
Return the current stored temperature.
Definition PDSS.cpp:133
virtual double entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition PDSS.cpp:88
double m_pres
State of the system - pressure.
Definition PDSS.h:401
virtual double molarVolume_ref() const
Return the molar volume at reference pressure.
Definition PDSS.cpp:98
double m_maxTemp
Maximum temperature.
Definition PDSS.h:410
double m_minTemp
Minimum temperature.
Definition PDSS.h:407
virtual double thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition PDSS.cpp:108
virtual double enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition PDSS.cpp:23
virtual double critDensity() const
critical density
Definition PDSS.cpp:123
virtual double enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition PDSS.cpp:83
virtual double entropy_R() const
Return the standard state entropy divided by RT.
Definition PDSS.cpp:38
virtual double critTemperature() const
critical temperature
Definition PDSS.cpp:113
virtual void setParent(VPStandardStateTP *phase, size_t k)
Set the parent VPStandardStateTP object of this PDSS object.
Definition PDSS.h:376
double m_mw
Molecular Weight of the species.
Definition PDSS.h:413
AnyMap m_input
Input data supplied via setParameters.
Definition PDSS.h:417
virtual double cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition PDSS.cpp:58
void setReferenceThermo(shared_ptr< SpeciesThermoInterpType > stit)
Set the SpeciesThermoInterpType object used to calculate reference state properties.
Definition PDSS.h:366
virtual double molarVolume() const
Return the molar volume at standard state.
Definition PDSS.cpp:63
virtual double intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition PDSS.cpp:28
double maxTemp() const
return the minimum temperature
Definition PDSS.h:256
virtual double critPressure() const
critical pressure
Definition PDSS.cpp:118
virtual void getParameters(AnyMap &eosNode) const
Store the parameters needed to reconstruct a copy of this PDSS object.
Definition PDSS.h:392
virtual void setPressure(double pres)
Sets the pressure in the object.
Definition PDSS.cpp:128
virtual double gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition PDSS.cpp:78
virtual void setState_TP(double temp, double pres)
Set the internal temperature and pressure.
Definition PDSS.cpp:152
This is a filter class for ThermoPhase that implements some preparatory steps for efficiently handlin...
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564