Cantera  2.4.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 http://www.cantera.org/license.txt for license and copyright information.
10 
11 #include "cantera/base/ctml.h"
12 #include "cantera/thermo/PDSS.h"
14 
15 namespace Cantera
16 {
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 
27 doublereal PDSS::enthalpy_mole() const
28 {
29  throw NotImplementedError("PDSS::enthalpy_mole()");
30 }
31 
32 doublereal PDSS::enthalpy_RT() const
33 {
34  throw NotImplementedError("PDSS::enthalpy_RT()");
35 }
36 
37 doublereal PDSS::intEnergy_mole() const
38 {
39  throw NotImplementedError("PDSS::intEnergy_mole()");
40 }
41 
42 doublereal PDSS::entropy_mole() const
43 {
44  throw NotImplementedError("PDSS::entropy_mole()");
45 }
46 
47 doublereal PDSS::entropy_R() const
48 {
49  throw NotImplementedError("PDSS::entropy_R()");
50 }
51 
52 doublereal PDSS::gibbs_mole() const
53 {
54  throw NotImplementedError("PDSS::gibbs_mole()");
55 }
56 
57 doublereal PDSS::gibbs_RT() const
58 {
59  throw NotImplementedError("PDSS::gibbs_RT()");
60 }
61 
62 doublereal PDSS::cp_mole() const
63 {
64  throw NotImplementedError("PDSS::cp_mole()");
65 }
66 
67 doublereal PDSS::cp_R() const
68 {
69  throw NotImplementedError("PDSS::cp_R()");
70 }
71 
72 doublereal PDSS::molarVolume() const
73 {
74  throw NotImplementedError("PDSS::molarVolume()");
75 }
76 
77 doublereal PDSS::density() const
78 {
79  throw NotImplementedError("PDSS::density()");
80 }
81 
82 doublereal PDSS::cv_mole() const
83 {
84  throw NotImplementedError("PDSS::cv_mole()");
85 }
86 
87 doublereal PDSS::gibbs_RT_ref() const
88 {
89  throw NotImplementedError("PDSS::gibbs_RT_ref()");
90 }
91 
92 doublereal PDSS::enthalpy_RT_ref() const
93 {
94  throw NotImplementedError("PDSS::enthalpy_RT_ref()");
95 }
96 
97 doublereal PDSS::entropy_R_ref() const
98 {
99  throw NotImplementedError("PDSS::entropy_RT_ref()");
100 }
101 
102 doublereal PDSS::cp_R_ref() const
103 {
104  throw NotImplementedError("PDSS::entropy_RT_ref()");
105 }
106 
107 doublereal PDSS::molarVolume_ref() const
108 {
109  throw NotImplementedError("PDSS::molarVolume_ref()");
110 }
111 
112 doublereal PDSS::enthalpyDelp_mole() const
113 {
115 }
116 
117 doublereal PDSS::entropyDelp_mole() const
118 {
119  return entropy_mole() - GasConstant * entropy_R_ref();
120 }
121 
122 doublereal PDSS::gibbsDelp_mole() const
123 {
124  return gibbs_mole() - m_temp * GasConstant * gibbs_RT_ref();
125 }
126 
127 doublereal PDSS::cpDelp_mole() const
128 {
129  return cp_mole() - GasConstant * cp_R_ref();
130 }
131 
132 doublereal PDSS::pressure() const
133 {
134  return m_pres;
135 }
136 
137 doublereal PDSS::thermalExpansionCoeff() const
138 {
139  throw NotImplementedError("PDSS::thermalExpansionCoeff()");
140 }
141 
142 doublereal PDSS::critTemperature() const
143 {
144  throw NotImplementedError("PDSS::critTemperature()");
145 }
146 
147 doublereal PDSS::critPressure() const
148 {
149  throw NotImplementedError("PDSS::critPressure()");
150 }
151 
152 doublereal PDSS::critDensity() const
153 {
154  throw NotImplementedError("PDSS::critDensity()");
155 }
156 
157 void PDSS::setPressure(doublereal pres)
158 {
159  m_pres = pres;
160 }
161 
162 doublereal PDSS::temperature() const
163 {
164  return m_temp;
165 }
166 
167 void PDSS::setTemperature(doublereal temp)
168 {
169  m_temp = temp;
170 }
171 
172 doublereal 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 
191 doublereal 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 
211 doublereal PDSS_Molar::enthalpy_RT() const
212 {
213  return enthalpy_mole() / (GasConstant * temperature());
214 }
215 
216 doublereal PDSS_Molar::entropy_R() const
217 {
218  return entropy_mole() / GasConstant;
219 }
220 
221 doublereal PDSS_Molar::gibbs_RT() const
222 {
223  return gibbs_mole() / (GasConstant * temperature());
224 }
225 
226 doublereal PDSS_Molar::cp_R() const
227 {
228  return cp_mole() / GasConstant;
229 }
230 
231 // PDSS_Nondimensional methods
232 
233 PDSS_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 
248 {
249  return enthalpy_RT() * GasConstant * temperature();
250 }
251 
253 {
254  return entropy_R() * GasConstant;
255 }
256 
258 {
259  return gibbs_RT() * GasConstant * temperature();
260 }
261 
263 {
264  return cp_R() * GasConstant;
265 }
266 
268 {
269  return m_g0_RT;
270 }
271 
273 {
274  return m_h0_RT;
275 }
276 
278 {
279  return m_s0_R;
280 }
281 
283 {
284  return m_cp0_R;
285 }
286 
288 {
289  return m_V0;
290 }
291 
293 {
294  return m_hss_RT;
295 }
296 
298 {
299  return m_sss_R;
300 }
301 
303 {
304  return m_gss_RT;
305 }
306 
308 {
309  return m_cpss_R;
310 }
311 
313 {
314  return m_Vss;
315 }
316 
318 {
319  return m_mw / m_Vss;
320 }
321 
322 }
double m_gss_RT
Standard state Gibbs free energy divided by RT.
Definition: PDSS.h:544
virtual doublereal critPressure() const
critical pressure
Definition: PDSS.cpp:147
virtual double entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS.cpp:277
virtual double enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:292
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS.cpp:252
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:221
virtual double gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS.cpp:267
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS.cpp:42
virtual double enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS.cpp:272
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS.cpp:157
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS.cpp:97
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:47
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:165
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:62
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS.cpp:77
double m_sss_R
Standard state entropy divided by R.
Definition: PDSS.h:543
virtual doublereal satPressure(doublereal T)
saturation pressure
Definition: PDSS.cpp:191
doublereal m_pres
State of the system - pressure.
Definition: PDSS.h:483
doublereal molecularWeight() const
Return the molecular weight of the species in units of kg kmol-1.
Definition: PDSS.cpp:172
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:82
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:226
virtual doublereal temperature() const
Return the current stored temperature.
Definition: PDSS.cpp:162
virtual doublereal pressure() const
Returns the pressure (Pa)
Definition: PDSS.cpp:132
double m_cp0_R
Reference state heat capacity divided by R.
Definition: PDSS.h:537
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
virtual doublereal cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:67
void setMolecularWeight(doublereal mw)
Set the molecular weight of the species.
Definition: PDSS.cpp:176
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS.cpp:27
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS.cpp:37
virtual doublereal entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:216
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS.cpp:107
double m_hss_RT
Standard state enthalpy divided by RT.
Definition: PDSS.h:541
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS.cpp:72
double m_cpss_R
Standard state heat capacity divided by R.
Definition: PDSS.h:542
double m_s0_R
Reference state entropy divided by R.
Definition: PDSS.h:538
virtual double entropy_R() const
Return the standard state entropy divided by RT.
Definition: PDSS.cpp:297
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS.cpp:167
double m_Vss
Standard State molar volume (m^3/kmol)
Definition: PDSS.h:545
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS.cpp:102
double m_V0
Reference state molar volume (m^3/kmol)
Definition: PDSS.h:540
virtual double gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:302
double m_g0_RT
Reference state Gibbs free energy divided by RT.
Definition: PDSS.h:539
virtual doublereal critDensity() const
critical density
Definition: PDSS.cpp:152
virtual double cp_R() const
Return the molar const pressure heat capacity divided by RT.
Definition: PDSS.cpp:307
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:32
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: PDSS.cpp:137
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS.cpp:87
virtual doublereal gibbs_RT() const
Return the molar Gibbs free energy divided by RT.
Definition: PDSS.cpp:57
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
doublereal m_maxTemp
Maximum temperature.
Definition: PDSS.h:492
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS.cpp:52
doublereal m_minTemp
Minimum temperature.
Definition: PDSS.h:489
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
Definition: PDSS.cpp:186
virtual double molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS.cpp:287
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
virtual double cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS.cpp:282
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
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS.cpp:247
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
PDSS()
Default Constructor.
Definition: PDSS.cpp:17
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
doublereal m_temp
Current temperature used by the PDSS object.
Definition: PDSS.h:480
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS.cpp:257
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
virtual double density() const
Return the standard state density at standard state.
Definition: PDSS.cpp:317
double m_h0_RT
Reference state enthalpy divided by RT.
Definition: PDSS.h:536
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS.cpp:92
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS.cpp:262
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
virtual doublereal enthalpy_RT() const
Return the standard state molar enthalpy divided by RT.
Definition: PDSS.cpp:211
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS.cpp:181
virtual double molarVolume() const
Return the molar volume at standard state.
Definition: PDSS.cpp:312
doublereal m_p0
Reference state pressure of the species.
Definition: PDSS.h:486
doublereal m_mw
Molecular Weight of the species.
Definition: PDSS.h:495
virtual doublereal critTemperature() const
critical temperature
Definition: PDSS.cpp:142