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 {
PDSS()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 
enthalpy_mole() const27 doublereal PDSS::enthalpy_mole() const
28 {
29     throw NotImplementedError("PDSS::enthalpy_mole");
30 }
31 
enthalpy_RT() const32 doublereal PDSS::enthalpy_RT() const
33 {
34     throw NotImplementedError("PDSS::enthalpy_RT");
35 }
36 
intEnergy_mole() const37 doublereal PDSS::intEnergy_mole() const
38 {
39     throw NotImplementedError("PDSS::intEnergy_mole");
40 }
41 
entropy_mole() const42 doublereal PDSS::entropy_mole() const
43 {
44     throw NotImplementedError("PDSS::entropy_mole");
45 }
46 
entropy_R() const47 doublereal PDSS::entropy_R() const
48 {
49     throw NotImplementedError("PDSS::entropy_R");
50 }
51 
gibbs_mole() const52 doublereal PDSS::gibbs_mole() const
53 {
54     throw NotImplementedError("PDSS::gibbs_mole");
55 }
56 
gibbs_RT() const57 doublereal PDSS::gibbs_RT() const
58 {
59     throw NotImplementedError("PDSS::gibbs_RT");
60 }
61 
cp_mole() const62 doublereal PDSS::cp_mole() const
63 {
64     throw NotImplementedError("PDSS::cp_mole");
65 }
66 
cp_R() const67 doublereal PDSS::cp_R() const
68 {
69     throw NotImplementedError("PDSS::cp_R");
70 }
71 
molarVolume() const72 doublereal PDSS::molarVolume() const
73 {
74     throw NotImplementedError("PDSS::molarVolume");
75 }
76 
density() const77 doublereal PDSS::density() const
78 {
79     throw NotImplementedError("PDSS::density");
80 }
81 
cv_mole() const82 doublereal PDSS::cv_mole() const
83 {
84     throw NotImplementedError("PDSS::cv_mole");
85 }
86 
gibbs_RT_ref() const87 doublereal PDSS::gibbs_RT_ref() const
88 {
89     throw NotImplementedError("PDSS::gibbs_RT_ref");
90 }
91 
enthalpy_RT_ref() const92 doublereal PDSS::enthalpy_RT_ref() const
93 {
94     throw NotImplementedError("PDSS::enthalpy_RT_ref");
95 }
96 
entropy_R_ref() const97 doublereal PDSS::entropy_R_ref() const
98 {
99     throw NotImplementedError("PDSS::entropy_RT_ref");
100 }
101 
cp_R_ref() const102 doublereal PDSS::cp_R_ref() const
103 {
104     throw NotImplementedError("PDSS::entropy_RT_ref");
105 }
106 
molarVolume_ref() const107 doublereal PDSS::molarVolume_ref() const
108 {
109     throw NotImplementedError("PDSS::molarVolume_ref");
110 }
111 
enthalpyDelp_mole() const112 doublereal PDSS::enthalpyDelp_mole() const
113 {
114     return enthalpy_mole() - m_temp * GasConstant * enthalpy_RT_ref();
115 }
116 
entropyDelp_mole() const117 doublereal PDSS::entropyDelp_mole() const
118 {
119     return entropy_mole() - GasConstant * entropy_R_ref();
120 }
121 
gibbsDelp_mole() const122 doublereal PDSS::gibbsDelp_mole() const
123 {
124     return gibbs_mole() - m_temp * GasConstant * gibbs_RT_ref();
125 }
126 
cpDelp_mole() const127 doublereal PDSS::cpDelp_mole() const
128 {
129     return cp_mole() - GasConstant * cp_R_ref();
130 }
131 
pressure() const132 doublereal PDSS::pressure() const
133 {
134     return m_pres;
135 }
136 
thermalExpansionCoeff() const137 doublereal PDSS::thermalExpansionCoeff() const
138 {
139     throw NotImplementedError("PDSS::thermalExpansionCoeff");
140 }
141 
critTemperature() const142 doublereal PDSS::critTemperature() const
143 {
144     throw NotImplementedError("PDSS::critTemperature");
145 }
146 
critPressure() const147 doublereal PDSS::critPressure() const
148 {
149     throw NotImplementedError("PDSS::critPressure");
150 }
151 
critDensity() const152 doublereal PDSS::critDensity() const
153 {
154     throw NotImplementedError("PDSS::critDensity");
155 }
156 
setPressure(doublereal pres)157 void PDSS::setPressure(doublereal pres)
158 {
159     m_pres = pres;
160 }
161 
temperature() const162 doublereal PDSS::temperature() const
163 {
164     return m_temp;
165 }
166 
setTemperature(doublereal temp)167 void PDSS::setTemperature(doublereal temp)
168 {
169     m_temp = temp;
170 }
171 
molecularWeight() const172 doublereal PDSS::molecularWeight() const
173 {
174     return m_mw;
175 }
setMolecularWeight(doublereal mw)176 void PDSS::setMolecularWeight(doublereal mw)
177 {
178     m_mw = mw;
179 }
180 
setState_TP(doublereal temp,doublereal pres)181 void PDSS::setState_TP(doublereal temp, doublereal pres)
182 {
183     throw NotImplementedError("PDSS::setState_TP");
184 }
185 
setState_TR(doublereal temp,doublereal rho)186 void PDSS::setState_TR(doublereal temp, doublereal rho)
187 {
188     throw NotImplementedError("PDSS::setState_TR");
189 }
190 
satPressure(doublereal t)191 doublereal PDSS::satPressure(doublereal t)
192 {
193     throw NotImplementedError("PDSS::satPressure");
194 }
195 
reportParams(size_t & kindex,int & type,doublereal * const c,doublereal & minTemp_,doublereal & maxTemp_,doublereal & refPressure_) const196 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 
enthalpy_RT() const211 doublereal PDSS_Molar::enthalpy_RT() const
212 {
213     return enthalpy_mole() / (GasConstant * temperature());
214 }
215 
entropy_R() const216 doublereal PDSS_Molar::entropy_R() const
217 {
218     return entropy_mole() / GasConstant;
219 }
220 
gibbs_RT() const221 doublereal PDSS_Molar::gibbs_RT() const
222 {
223     return gibbs_mole() / (GasConstant * temperature());
224 }
225 
cp_R() const226 doublereal PDSS_Molar::cp_R() const
227 {
228     return cp_mole() / GasConstant;
229 }
230 
231 // PDSS_Nondimensional methods
232 
PDSS_Nondimensional()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 
enthalpy_mole() const247 doublereal PDSS_Nondimensional::enthalpy_mole() const
248 {
249     return enthalpy_RT() * GasConstant * temperature();
250 }
251 
entropy_mole() const252 doublereal PDSS_Nondimensional::entropy_mole() const
253 {
254     return entropy_R() * GasConstant;
255 }
256 
gibbs_mole() const257 doublereal PDSS_Nondimensional::gibbs_mole() const
258 {
259     return gibbs_RT() * GasConstant * temperature();
260 }
261 
cp_mole() const262 doublereal PDSS_Nondimensional::cp_mole() const
263 {
264     return cp_R() * GasConstant;
265 }
266 
gibbs_RT_ref() const267 double PDSS_Nondimensional::gibbs_RT_ref() const
268 {
269     return m_g0_RT;
270 }
271 
enthalpy_RT_ref() const272 double PDSS_Nondimensional::enthalpy_RT_ref() const
273 {
274     return m_h0_RT;
275 }
276 
entropy_R_ref() const277 double PDSS_Nondimensional::entropy_R_ref() const
278 {
279     return m_s0_R;
280 }
281 
cp_R_ref() const282 double PDSS_Nondimensional::cp_R_ref() const
283 {
284     return m_cp0_R;
285 }
286 
molarVolume_ref() const287 double PDSS_Nondimensional::molarVolume_ref() const
288 {
289     return m_V0;
290 }
291 
enthalpy_RT() const292 double PDSS_Nondimensional::enthalpy_RT() const
293 {
294     return m_hss_RT;
295 }
296 
entropy_R() const297 double PDSS_Nondimensional::entropy_R() const
298 {
299     return m_sss_R;
300 }
301 
gibbs_RT() const302 double PDSS_Nondimensional::gibbs_RT() const
303 {
304     return m_gss_RT;
305 }
306 
cp_R() const307 double PDSS_Nondimensional::cp_R() const
308 {
309     return m_cpss_R;
310 }
311 
molarVolume() const312 double PDSS_Nondimensional::molarVolume() const
313 {
314     return m_Vss;
315 }
316 
density() const317 double PDSS_Nondimensional::density() const
318 {
319     return m_mw / m_Vss;
320 }
321 
322 }
323