Cantera 2.6.0
SingleSpeciesTP.h
Go to the documentation of this file.
1/**
2 * @file SingleSpeciesTP.h
3 * Header for the SingleSpeciesTP class, which is a filter class for ThermoPhase,
4 * that eases the construction of single species phases
5 * ( see \ref thermoprops and class \link Cantera::SingleSpeciesTP SingleSpeciesTP\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_SINGLESPECIESTP_H
12#define CT_SINGLESPECIESTP_H
13
14#include "ThermoPhase.h"
15
16namespace Cantera
17{
18
19/**
20 * @ingroup thermoprops
21 *
22 * The SingleSpeciesTP class is a filter class for ThermoPhase. What it does is
23 * to simplify the construction of ThermoPhase objects by assuming that the
24 * phase consists of one and only one type of species. In other words, it's a
25 * stoichiometric phase. However, no assumptions are made concerning the
26 * thermodynamic functions or the equation of state of the phase. Therefore it's
27 * an incomplete description of the thermodynamics. The complete description
28 * must be made in a derived class of SingleSpeciesTP.
29 *
30 * Several different groups of thermodynamic functions are resolved at this
31 * level by this class. For example, All partial molar property routines call
32 * their single species standard state equivalents. All molar solution
33 * thermodynamic routines call the single species standard state equivalents.
34 * Activities routines are resolved at this level, as there is only one species.
35 *
36 * It is assumed that the reference state thermodynamics may be obtained by a
37 * pointer to a populated species thermodynamic property manager class (see
38 * ThermoPhase::m_spthermo). How to relate pressure changes to the reference
39 * state thermodynamics is again left open to implementation.
40 *
41 * Mole fraction and Mass fraction vectors are assumed to be equal to x[0] = 1
42 * y[0] = 1, respectively. Simplifications to the interface of setState_TPY()
43 * and setState_TPX() functions result and are made within the class.
44 *
45 * Note, this class can handle the thermodynamic description of one phase of one
46 * species. It can not handle the description of phase equilibrium between two
47 * phases of a stoichiometric compound (such as water liquid and water vapor, below
48 * the critical point). However, it may be used to describe the thermodynamics
49 * of one phase of such a compound even past the phase equilibrium point, up to
50 * the point where the phase itself ceases to be a stable phase.
51 *
52 * This class doesn't do much at the initialization level. Its
53 * SingleSpeciesTP::initThermo() member does check that one and only one species
54 * has been defined to occupy the phase.
55 */
57{
58public:
59 //! Base empty constructor.
61
62 virtual std::string type() const {
63 return "SingleSpecies";
64 }
65
66 virtual bool isPure() const {
67 return true;
68 }
69
70 /**
71 * @name Molar Thermodynamic Properties of the Solution
72 *
73 * These functions are resolved at this level, by reference to the partial
74 * molar functions and standard state functions for species 0. Derived
75 * classes don't need to supply entries for these functions.
76 * @{
77 */
78
79 virtual doublereal enthalpy_mole() const;
80 virtual doublereal intEnergy_mole() const;
81 virtual doublereal entropy_mole() const;
82 virtual doublereal gibbs_mole() const;
83 virtual doublereal cp_mole() const;
84 virtual doublereal cv_mole() const;
85
86 /**
87 * @}
88 * @name Activities, Standard State, and Activity Concentrations
89 *
90 * The activity \f$a_k\f$ of a species in solution is related to the
91 * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f]
92 * The quantity \f$\mu_k^0(T)\f$ is the chemical potential at unit activity,
93 * which depends only on temperature.
94 * @{
95 */
96
97 /**
98 * Get the array of non-dimensional activities at the current solution
99 * temperature, pressure, and solution concentration.
100 *
101 * We redefine this function to just return 1.0 here.
102 *
103 * @param a Output vector of activities. Length: 1.
104 */
105 virtual void getActivities(doublereal* a) const {
106 a[0] = 1.0;
107 }
108
109 virtual void getActivityCoefficients(doublereal* ac) const {
110 ac[0] = 1.0;
111 }
112
113 //! @}
114 /// @name Partial Molar Properties of the Solution
115 ///
116 /// These functions are resolved at this level, by reference to the partial
117 /// molar functions and standard state functions for species 0. Derived
118 /// classes don't need to supply entries for these functions.
119 //! @{
120
121 //! Get the array of non-dimensional species chemical potentials. These are
122 //! partial molar Gibbs free energies.
123 /*!
124 * These are the phase, partial molar, and the standard state dimensionless
125 * chemical potentials.
126 * \f$ \mu_k / \hat R T \f$.
127 *
128 * Units: unitless
129 *
130 * @param murt On return, Contains the chemical potential / RT of the
131 * single species and the phase. Units are unitless. Length = 1
132 */
133 virtual void getChemPotentials_RT(doublereal* murt) const;
134
135 //! Get the array of chemical potentials
136 /*!
137 * These are the phase, partial molar, and the standard state chemical
138 * potentials.
139 * \f$ \mu(T,P) = \mu^0_k(T,P) \f$.
140 *
141 * @param mu On return, Contains the chemical potential of the single
142 * species and the phase. Units are J / kmol . Length = 1
143 */
144 virtual void getChemPotentials(doublereal* mu) const;
145
146 //! Get the species partial molar enthalpies. Units: J/kmol.
147 /*!
148 * These are the phase enthalpies. \f$ h_k \f$.
149 *
150 * @param hbar Output vector of species partial molar enthalpies.
151 * Length: 1. units are J/kmol.
152 */
153 virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
154
155 //! Get the species partial molar internal energies. Units: J/kmol.
156 /*!
157 * These are the phase internal energies. \f$ u_k \f$.
158 *
159 * @param ubar On return, Contains the internal energy of the single species
160 * and the phase. Units are J / kmol . Length = 1
161 */
162 virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
163
164 //! Get the species partial molar entropy. Units: J/kmol K.
165 /*!
166 * This is the phase entropy. \f$ s(T,P) = s_o(T,P) \f$.
167 *
168 * @param sbar On return, Contains the entropy of the single species and the
169 * phase. Units are J / kmol / K . Length = 1
170 */
171 virtual void getPartialMolarEntropies(doublereal* sbar) const;
172
173 //! Get the species partial molar Heat Capacities. Units: J/ kmol /K.
174 /*!
175 * This is the phase heat capacity. \f$ Cp(T,P) = Cp_o(T,P) \f$.
176 *
177 * @param cpbar On return, Contains the heat capacity of the single species
178 * and the phase. Units are J / kmol / K . Length = 1
179 */
180 virtual void getPartialMolarCp(doublereal* cpbar) const;
181
182 //! Get the species partial molar volumes. Units: m^3/kmol.
183 /*!
184 * This is the phase molar volume. \f$ V(T,P) = V_o(T,P) \f$.
185 *
186 * @param vbar On return, Contains the molar volume of the single species
187 * and the phase. Units are m^3 / kmol. Length = 1
188 */
189 virtual void getPartialMolarVolumes(doublereal* vbar) const;
190
191 //! @}
192 /// @name Properties of the Standard State of the Species in the Solution
193 /// These functions are the primary way real properties are
194 /// supplied to derived thermodynamics classes of SingleSpeciesTP.
195 /// These functions must be supplied in derived classes. They
196 /// are not resolved at the SingleSpeciesTP level.
197 //! @{
198
199 virtual void getPureGibbs(doublereal* gpure) const;
200
201 //! Get the molar volumes of each species in their standard states at the
202 //! current *T* and *P* of the solution.
203 /*!
204 * units = m^3 / kmol
205 *
206 * We resolve this function at this level, by assigning the molecular weight
207 * divided by the phase density
208 *
209 * @param vbar On output this contains the standard volume of the species
210 * and phase (m^3/kmol). Vector of length 1
211 */
212 virtual void getStandardVolumes(doublereal* vbar) const;
213
214 //! @}
215 /// @name Thermodynamic Values for the Species Reference State
216 ///
217 /// Almost all functions in this group are resolved by this class. The
218 /// internal energy function is not given by this class, since it would
219 /// involve a specification of the equation of state.
220 //! @{
221
222 virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
223 virtual void getGibbs_RT_ref(doublereal* grt) const;
224 virtual void getGibbs_ref(doublereal* g) const;
225 virtual void getEntropy_R_ref(doublereal* er) const;
226 virtual void getCp_R_ref(doublereal* cprt) const;
227
228 //! @}
229 /**
230 * @name Setting the State
231 *
232 * These methods set all or part of the thermodynamic state.
233 * @{
234 */
235
236 //! Mass fractions are fixed, with Y[0] = 1.0.
237 virtual void setMassFractions(const doublereal* const y) {};
238
239 //! Mole fractions are fixed, with x[0] = 1.0.
240 virtual void setMoleFractions(const doublereal* const x) {};
241
242 virtual void setState_HP(double h, double p, double tol=1e-9);
243 virtual void setState_UV(double u, double v, double tol=1e-9);
244 virtual void setState_SP(double s, double p, double tol=1e-9);
245 virtual void setState_SV(double s, double v, double tol=1e-9);
246 //! @}
247
248 virtual bool addSpecies(shared_ptr<Species> spec);
249
250protected:
251 //! The current pressure of the solution (Pa). It gets initialized to 1 atm.
252 doublereal m_press;
253
254 // Reference pressure (Pa). Must be the same for all species. Defaults to
255 // 1 atm.
256 doublereal m_p0;
257
258 //! Dimensionless enthalpy at the (mtlast, m_p0)
259 mutable double m_h0_RT;
260 //! Dimensionless heat capacity at the (mtlast, m_p0)
261 mutable double m_cp0_R;
262 //! Dimensionless entropy at the (mtlast, m_p0)
263 mutable double m_s0_R;
264
265 /**
266 * @internal This crucial internal routine calls the species thermo update
267 * program to calculate new species Cp0, H0, and S0 whenever the
268 * temperature has changed.
269 */
270 void _updateThermo() const;
271};
272
273}
274
275#endif
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
The SingleSpeciesTP class is a filter class for ThermoPhase.
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
virtual void setState_HP(double h, double p, double tol=1e-9)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
doublereal m_press
The current pressure of the solution (Pa). It gets initialized to 1 atm.
virtual void setState_UV(double u, double v, double tol=1e-9)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
virtual bool addSpecies(shared_ptr< Species > spec)
virtual void setMassFractions(const doublereal *const y)
Mass fractions are fixed, with Y[0] = 1.0.
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Get the species partial molar internal energies. Units: J/kmol.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Get the species partial molar enthalpies. Units: J/kmol.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Get the species partial molar entropy. Units: J/kmol K.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Get the species partial molar volumes. Units: m^3/kmol.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void getPartialMolarCp(doublereal *cpbar) const
Get the species partial molar Heat Capacities. Units: J/ kmol /K.
double m_h0_RT
Dimensionless enthalpy at the (mtlast, m_p0)
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
double m_s0_R
Dimensionless entropy at the (mtlast, m_p0)
virtual void getChemPotentials_RT(doublereal *murt) const
Get the array of non-dimensional species chemical potentials.
virtual void setState_SP(double s, double p, double tol=1e-9)
Set the specific entropy (J/kg/K) and pressure (Pa).
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
virtual bool isPure() const
Return whether phase represents a pure (single species) substance.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
double m_cp0_R
Dimensionless heat capacity at the (mtlast, m_p0)
virtual void getStandardVolumes(doublereal *vbar) const
Get the molar volumes of each species in their standard states at the current T and P of the solution...
SingleSpeciesTP()
Base empty constructor.
virtual void getChemPotentials(doublereal *mu) const
Get the array of chemical potentials.
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
virtual void setMoleFractions(const doublereal *const x)
Mole fractions are fixed, with x[0] = 1.0.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
virtual void setState_SV(double s, double v, double tol=1e-9)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
Namespace for the Cantera kernel.
Definition: AnyMap.h:29