Cantera 2.6.0

PDSS.cpp
Go to the documentation of this file.
1/**
2 * @file PDSS.cpp
3 * Implementation of a pressure dependent standard state
4 * virtual function
5 * (see 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#include "cantera/base/ctml.h"
12#include "cantera/thermo/PDSS.h"
13#include "cantera/thermo/VPStandardStateTP.h"
14
15 namespace Cantera
16{
17 PDSS::PDSS() :
18 m_temp(-1.0),
19 m_pres(-1.0),
20 m_p0(-1.0),
21 m_minTemp(-1.0),
22 m_maxTemp(10000.0),
23 m_mw(0.0)
24{
25}
26
27doublereal PDSS::enthalpy_mole() const
28{
29 throw NotImplementedError("PDSS::enthalpy_mole");
30}
31
32doublereal PDSS::enthalpy_RT() const
33{
34 throw NotImplementedError("PDSS::enthalpy_RT");
35}
36
37doublereal PDSS::intEnergy_mole() const
38{
39 throw NotImplementedError("PDSS::intEnergy_mole");
40}
41
42doublereal PDSS::entropy_mole() const
43{
44 throw NotImplementedError("PDSS::entropy_mole");
45}
46
47doublereal PDSS::entropy_R() const
48{
49 throw NotImplementedError("PDSS::entropy_R");
50}
51
52doublereal PDSS::gibbs_mole() const
53{
54 throw NotImplementedError("PDSS::gibbs_mole");
55}
56
57doublereal PDSS::gibbs_RT() const
58{
59 throw NotImplementedError("PDSS::gibbs_RT");
60}
61
62doublereal PDSS::cp_mole() const
63{
64 throw NotImplementedError("PDSS::cp_mole");
65}
66
67doublereal PDSS::cp_R() const
68{
69 throw NotImplementedError("PDSS::cp_R");
70}
71
72doublereal PDSS::molarVolume() const
73{
74 throw NotImplementedError("PDSS::molarVolume");
75}
76
77doublereal PDSS::density() const
78{
79 throw NotImplementedError("PDSS::density");
80}
81
82doublereal PDSS::cv_mole() const
83{
84 throw NotImplementedError("PDSS::cv_mole");
85}
86
87doublereal PDSS::gibbs_RT_ref() const
88{
89 throw NotImplementedError("PDSS::gibbs_RT_ref");
90}
91
92doublereal PDSS::enthalpy_RT_ref() const
93{
94 throw NotImplementedError("PDSS::enthalpy_RT_ref");
95}
96
97doublereal PDSS::entropy_R_ref() const
98{
99 throw NotImplementedError("PDSS::entropy_RT_ref");
100}
101
102doublereal PDSS::cp_R_ref() const
103{
104 throw NotImplementedError("PDSS::entropy_RT_ref");
105}
106
107doublereal PDSS::molarVolume_ref() const
108{
109 throw NotImplementedError("PDSS::molarVolume_ref");
110}
111
112doublereal PDSS::enthalpyDelp_mole() const
113{
114 return enthalpy_mole() - m_temp * GasConstant * enthalpy_RT_ref();
115}
116
117doublereal PDSS::entropyDelp_mole() const
118{
119 return entropy_mole() - GasConstant * entropy_R_ref();
120}
121
122doublereal PDSS::gibbsDelp_mole() const
123{
124 return gibbs_mole() - m_temp * GasConstant * gibbs_RT_ref();
125}
126
127doublereal PDSS::cpDelp_mole() const
128{
129 return cp_mole() - GasConstant * cp_R_ref();
130}
131
132doublereal PDSS::pressure() const
133{
134 return m_pres;
135}
136
137doublereal PDSS::thermalExpansionCoeff() const
138{
139 throw NotImplementedError("PDSS::thermalExpansionCoeff");
140}
141
142doublereal PDSS::critTemperature() const
143{
144 throw NotImplementedError("PDSS::critTemperature");
145}
146
147doublereal PDSS::critPressure() const
148{
149 throw NotImplementedError("PDSS::critPressure");
150}
151
152doublereal PDSS::critDensity() const
153{
154 throw NotImplementedError("PDSS::critDensity");
155}
156
157 void PDSS::setPressure(doublereal pres)
158{
159 m_pres = pres;
160}
161
162doublereal PDSS::temperature() const
163{
164 return m_temp;
165}
166
167 void PDSS::setTemperature(doublereal temp)
168{
169 m_temp = temp;
170}
171
172doublereal PDSS::molecularWeight() const
173{
174 return m_mw;
175}
176 void PDSS::setMolecularWeight(doublereal mw)
177{
178 m_mw = mw;
179}
180
181 void PDSS::setState_TP(doublereal temp, doublereal pres)
182{
183 throw NotImplementedError("PDSS::setState_TP");
184}
185
186 void PDSS::setState_TR(doublereal temp, doublereal rho)
187{
188 throw NotImplementedError("PDSS::setState_TR");
189}
190
191doublereal PDSS::satPressure(doublereal t)
192{
193 throw NotImplementedError("PDSS::satPressure");
194}
195
196 void PDSS::reportParams(size_t& kindex, int& type,
197 doublereal* const c,
198 doublereal& minTemp_,
199 doublereal& maxTemp_,
200 doublereal& refPressure_) const
201{
202 kindex = npos;
203 type = 0;
204 minTemp_ = m_minTemp;
205 maxTemp_ = m_maxTemp;
206 refPressure_ = m_p0;
207}
208
209// PDSS_Molar methods
210
211doublereal PDSS_Molar::enthalpy_RT() const
212{
213 return enthalpy_mole() / (GasConstant * temperature());
214}
215
216doublereal PDSS_Molar::entropy_R() const
217{
218 return entropy_mole() / GasConstant;
219}
220
221doublereal PDSS_Molar::gibbs_RT() const
222{
223 return gibbs_mole() / (GasConstant * temperature());
224}
225
226doublereal PDSS_Molar::cp_R() const
227{
228 return cp_mole() / GasConstant;
229}
230
231// PDSS_Nondimensional methods
232
233PDSS_Nondimensional::PDSS_Nondimensional()
234 : m_h0_RT(0.0)
235 , m_cp0_R(0.0)
236 , m_s0_R(0.0)
237 , m_g0_RT(0.0)
238 , m_V0(0.0)
239 , m_hss_RT(0.0)
240 , m_cpss_R(0.0)
241 , m_sss_R(0.0)
242 , m_gss_RT(0.0)
243 , m_Vss(0.0)
244{
245}
246
247doublereal PDSS_Nondimensional::enthalpy_mole() const
248{
249 return enthalpy_RT() * GasConstant * temperature();
250}
251
252doublereal PDSS_Nondimensional::entropy_mole() const
253{
254 return entropy_R() * GasConstant;
255}
256
257doublereal PDSS_Nondimensional::gibbs_mole() const
258{
259 return gibbs_RT() * GasConstant * temperature();
260}
261
262doublereal PDSS_Nondimensional::cp_mole() const
263{
264 return cp_R() * GasConstant;
265}
266
267 double PDSS_Nondimensional::gibbs_RT_ref() const
268{
269 return m_g0_RT;
270}
271
272 double PDSS_Nondimensional::enthalpy_RT_ref() const
273{
274 return m_h0_RT;
275}
276
277 double PDSS_Nondimensional::entropy_R_ref() const
278{
279 return m_s0_R;
280}
281
282 double PDSS_Nondimensional::cp_R_ref() const
283{
284 return m_cp0_R;
285}
286
287 double PDSS_Nondimensional::molarVolume_ref() const
288{
289 return m_V0;
290}
291
292 double PDSS_Nondimensional::enthalpy_RT() const
293{
294 return m_hss_RT;
295}
296
297 double PDSS_Nondimensional::entropy_R() const
298{
299 return m_sss_R;
300}
301
302 double PDSS_Nondimensional::gibbs_RT() const
303{
304 return m_gss_RT;
305}
306
307 double PDSS_Nondimensional::cp_R() const
308{
309 return m_cpss_R;
310}
311
312 double PDSS_Nondimensional::molarVolume() const
313{
314 return m_Vss;
315}
316
317 double PDSS_Nondimensional::density() const
318{
319 return m_mw / m_Vss;
320}
321
322}
PDSS.h
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
VPStandardStateTP.h
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
Cantera::PDSS_Molar::entropy_R
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:216
Cantera::PDSS_Molar::enthalpy_RT
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:211
Cantera::PDSS_Molar::gibbs_RT
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:221
Cantera::PDSS_Molar::cp_R
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:226
Cantera::PDSS_Nondimensional::m_sss_R
double m_sss_R
Standard state entropy divided by R.
Definition: PDSS.h:522
Cantera::PDSS_Nondimensional::gibbs_RT
virtual double gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:302
Cantera::PDSS_Nondimensional::cp_R_ref
virtual double cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS.cpp:282
Cantera::PDSS_Nondimensional::density
virtual double density() const
Return the standard state density at standard state.
Definition: PDSS.cpp:317
Cantera::PDSS_Nondimensional::cp_mole
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:262
Cantera::PDSS_Nondimensional::enthalpy_mole
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS.cpp:247
Cantera::PDSS_Nondimensional::m_cpss_R
double m_cpss_R
Standard state heat capacity divided by R.
Definition: PDSS.h:521
Cantera::PDSS_Nondimensional::entropy_R_ref
virtual double entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS.cpp:277
Cantera::PDSS_Nondimensional::m_h0_RT
double m_h0_RT
Reference state enthalpy divided by RT.
Definition: PDSS.h:515
Cantera::PDSS_Nondimensional::entropy_mole
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS.cpp:252
Cantera::PDSS_Nondimensional::m_g0_RT
double m_g0_RT
Reference state Gibbs free energy divided by RT.
Definition: PDSS.h:518
Cantera::PDSS_Nondimensional::molarVolume_ref
virtual double molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS.cpp:287
Cantera::PDSS_Nondimensional::m_s0_R
double m_s0_R
Reference state entropy divided by R.
Definition: PDSS.h:517
Cantera::PDSS_Nondimensional::enthalpy_RT
virtual double enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:292
Cantera::PDSS_Nondimensional::m_gss_RT
double m_gss_RT
Standard state Gibbs free energy divided by RT.
Definition: PDSS.h:523
Cantera::PDSS_Nondimensional::enthalpy_RT_ref
virtual double enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS.cpp:272
Cantera::PDSS_Nondimensional::gibbs_mole
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS.cpp:257
Cantera::PDSS_Nondimensional::entropy_R
virtual double entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:297
Cantera::PDSS_Nondimensional::m_cp0_R
double m_cp0_R
Reference state heat capacity divided by R.
Definition: PDSS.h:516
Cantera::PDSS_Nondimensional::m_Vss
double m_Vss
Standard State molar volume (m^3/kmol)
Definition: PDSS.h:524
Cantera::PDSS_Nondimensional::m_hss_RT
double m_hss_RT
Standard state enthalpy divided by RT.
Definition: PDSS.h:520
Cantera::PDSS_Nondimensional::cp_R
virtual double cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:307
Cantera::PDSS_Nondimensional::molarVolume
virtual double molarVolume() const
Return the molar volume at standard state.
Definition: PDSS.cpp:312
Cantera::PDSS_Nondimensional::m_V0
double m_V0
Reference state molar volume (m^3/kmol)
Definition: PDSS.h:519
Cantera::PDSS_Nondimensional::gibbs_RT_ref
virtual double gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS.cpp:267
Cantera::PDSS::setMolecularWeight
void setMolecularWeight(doublereal mw)
Set the molecular weight of the species.
Definition: PDSS.cpp:176
Cantera::PDSS::molecularWeight
doublereal molecularWeight() const
Return the molecular weight of the species in units of kg kmol-1.
Definition: PDSS.cpp:172
Cantera::PDSS::cp_R_ref
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS.cpp:102
Cantera::PDSS::entropy_R
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:47
Cantera::PDSS::reportParams
virtual void reportParams(size_t &kindex, int &type, doublereal *const c, doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
Definition: PDSS.cpp:196
Cantera::PDSS::pressure
virtual doublereal pressure() const
Returns the pressure (Pa)
Definition: PDSS.cpp:132
Cantera::PDSS::m_pres
doublereal m_pres
State of the system - pressure.
Definition: PDSS.h:458
Cantera::PDSS::cp_mole
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:62
Cantera::PDSS::critPressure
virtual doublereal critPressure() const
critical pressure
Definition: PDSS.cpp:147
Cantera::PDSS::enthalpy_mole
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS.cpp:27
Cantera::PDSS::setPressure
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS.cpp:157
Cantera::PDSS::setState_TP
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS.cpp:181
Cantera::PDSS::m_temp
doublereal m_temp
Current temperature used by the PDSS object.
Definition: PDSS.h:455
Cantera::PDSS::enthalpy_RT
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:32
Cantera::PDSS::cv_mole
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:82
Cantera::PDSS::gibbs_RT
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:57
Cantera::PDSS::m_maxTemp
doublereal m_maxTemp
Maximum temperature.
Definition: PDSS.h:467
Cantera::PDSS::thermalExpansionCoeff
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: PDSS.cpp:137
Cantera::PDSS::enthalpyDelp_mole
virtual doublereal enthalpyDelp_mole() const
Get the difference in the standard state enthalpy between the current pressure and the reference pres...
Definition: PDSS.cpp:112
Cantera::PDSS::setTemperature
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS.cpp:167
Cantera::PDSS::entropy_mole
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS.cpp:42
Cantera::PDSS::cp_R
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:67
Cantera::PDSS::molarVolume_ref
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS.cpp:107
Cantera::PDSS::critTemperature
virtual doublereal critTemperature() const
critical temperature
Definition: PDSS.cpp:142
Cantera::PDSS::molarVolume
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS.cpp:72
Cantera::PDSS::gibbs_mole
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS.cpp:52
Cantera::PDSS::enthalpy_RT_ref
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS.cpp:92
Cantera::PDSS::PDSS
PDSS()
Default Constructor.
Definition: PDSS.cpp:17
Cantera::PDSS::m_p0
doublereal m_p0
Reference state pressure of the species.
Definition: PDSS.h:461
Cantera::PDSS::m_mw
doublereal m_mw
Molecular Weight of the species.
Definition: PDSS.h:470
Cantera::PDSS::cpDelp_mole
virtual doublereal cpDelp_mole() const
Get the difference in standard state heat capacity between the current pressure and the reference pre...
Definition: PDSS.cpp:127
Cantera::PDSS::setState_TR
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
Definition: PDSS.cpp:186
Cantera::PDSS::density
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS.cpp:77
Cantera::PDSS::entropy_R_ref
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS.cpp:97
Cantera::PDSS::gibbs_RT_ref
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS.cpp:87
Cantera::PDSS::temperature
virtual doublereal temperature() const
Return the current stored temperature.
Definition: PDSS.cpp:162
Cantera::PDSS::gibbsDelp_mole
virtual doublereal gibbsDelp_mole() const
Get the difference in the standard state Gibbs free energy between the current pressure and the refer...
Definition: PDSS.cpp:122
Cantera::PDSS::satPressure
virtual doublereal satPressure(doublereal T)
saturation pressure
Definition: PDSS.cpp:191
Cantera::PDSS::critDensity
virtual doublereal critDensity() const
critical density
Definition: PDSS.cpp:152
Cantera::PDSS::intEnergy_mole
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS.cpp:37
Cantera::PDSS::m_minTemp
doublereal m_minTemp
Minimum temperature.
Definition: PDSS.h:464
Cantera::PDSS::entropyDelp_mole
virtual doublereal entropyDelp_mole() const
Get the difference in the standard state entropy between the current pressure and the reference press...
Definition: PDSS.cpp:117
ctml.h
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::npos
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:192
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113