1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Appendix C"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 1"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sublimation Pressure: 0.00109 KPa\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"from math import exp\n",
"#Example: 14.1\n",
"'''Determine the sublimation pressure of water vapor at −60◦C using data available in the\n",
"steam tables.\n",
"Control mass: Water.'''\n",
"\n",
"#Variable Declaration: \n",
"#from table in appendix B.1.5\n",
"T1 = 213.2\t\t\t#K, Temperature at state 1\n",
"P2 = 0.0129\t\t\t#kPa, pressure at state 2\n",
"T2 = 233.2\t\t\t#K, Temperature at state 2\n",
"hig = 2838.9\t\t#kJ/kg, enthalpy of sublimation \n",
"R = .46152\t\t\t#Gas constant \n",
"\n",
"#Calculations:\n",
"P1 = P2*exp(-hig/R*(1/T1-1/T2)) #using relation log(P2/P1) = (hig/R)*(1/T1-1/T2) \n",
"\n",
"#Results:\n",
"print 'Sublimation Pressure: ',round(P1,5),'KPa'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 4"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Change in internal energy: -159.4 J/Kg\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 14.4\n",
"'''The pressure on a block of copper having a mass of 1 kg is increased in a reversible process\n",
"from 0.1 to 100 MPa while the temperature is held constant at 15◦C. Determine the work\n",
"done on the copper during this process, the change in entropy per kilogram of copper, the\n",
"heat transfer, and the change of internal energy per kilogram.\n",
"Over the range of pressure and temperature in this problem, the following data can\n",
"be used:\n",
"Volume expansivity = αP = 5.0 × 10−5 K−1\n",
"Isothermal compressibility = βT = 8.6 × 10−12 m2/N\n",
"Specific volume = 0.000 114 m3/kg'''\n",
"\n",
"#Variable Declaration: \n",
"#known data\n",
"ap = 5*10**-5\t\t\t\t#K**-1 Volume expansivity\n",
"bt = 8.6*10**-12\t\t\t#m**2/N, Isothermal compressibility\n",
"v = 0.000114\t\t\t\t#m**3/kg, specific volume\n",
"P2 = 100*10**6\t\t\t\t#pressure at state 2 in kPa\n",
"P1 = 100\t\t\t\t\t#pressure at state 1 in kPa\n",
"T = 288.2\t\t\t\t\t#Temperature in K\n",
"\n",
"#Calculations:\n",
"w = -v*bt*(P2**2-P1**2)/2\t#work done in J/kg\n",
"q = -T*v*ap*(P2-P1)\t\t\t#heat in J/kg\n",
"du = q-w\t\t\t\t\t#change in internal energy in J/kg\n",
"\n",
"#Results:\n",
"print 'Change in internal energy: ',round(du,1),'J/Kg'\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 5"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Enthalpy change: 18.73 KJ/Kg\n",
"Temperature : 146.0 K\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 14.5\n",
"'''Nitrogen is throttled from 20 MPa, −70◦C, to 2 MPa in an adiabatic, steady-state, steadyflow\n",
"process. Determine the final temperature of the nitrogen.\n",
"Control volume:\n",
"Inlet state:\n",
"Exit state:\n",
"Process:\n",
"Diagram:\n",
"Model:\n",
"Throttling valve.\n",
"P1, T1 known; state fixed.\n",
"P2 known.\n",
"Steady-state, throttling process.\n",
"Figure 14.8.\n",
"Generalized charts, Fig. D.2.'''\n",
"\n",
"#Variable Declaration: \n",
"#from table A.2\n",
"P1 = 20\t\t#pressure at state 1 in MPa\n",
"P2 = 2\t\t#pressure at state 2 in MPa\n",
"T1 = 203.2\t\t#Temperature at state 1 in K\n",
"Pr1 = P1/3.39\t\t#Reduced pressure at state 1\n",
"Pr2 = P2/3.39\t\t#Reduced pressure at state 2\n",
"Tr1 = T1/126.2\t\t#Reduced temperature\n",
"#from compressibility chart h1*-h1 = 2.1*R*Tc\n",
"#from zero pressure specific heat data h1*-h2* = Cp*(T1a-T2a)\n",
"#h2*-h2 = 0.5*R*Tc\n",
"#this gives dh = h1-h2 = -2.1*R*Tc+Cp*(T1a-T2a)+0.5*R*Tc\n",
"R = 0.2968\t\t#gas constant for given substance\n",
"Tc = 126.2\t\t#K, Constant temperature\n",
"Cp = 1.0416\t\t#heat enthalpy at constant pressure in kJ/kg\n",
"T2 = 146\t\t#temperature at state 2\n",
"\n",
"#Calculations:\n",
"dh = 0.5*R*Tc#\n",
"\n",
"#Results:\n",
"print 'Enthalpy change: ',round(dh,2),'KJ/Kg'\n",
"print 'Temperature :',round(T2,2),'K' "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 6"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Enthalpy change: 61.98 kJ/kg\n",
"Entropy Change: 1.0782 kJ/kg.K\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"from math import log\n",
"\n",
"#Example: 14.6\n",
"'''Nitrogen at 8 MPa, 150 K, is throttled to 0.5 MPa. After the gas passes through a short\n",
"length of pipe, its temperature is measured and found to be 125 K. Determine the heat\n",
"transfer and the change of entropy using the generalized charts. Compare these results\n",
"with those obtained by using the nitrogen tables.\n",
"Control volume:\n",
"Inlet state:\n",
"Exit state:\n",
"Process:\n",
"Diagram:\n",
"Model:\n",
"Throttle and pipe.\n",
"P1, T1 known; state fixed.\n",
"P2, T2 known; state fixed.\n",
"Steady state.\n",
"Figure 14.10.\n",
"Generalized charts, results to be compared with those\n",
"obtained with nitrogen tables.'''\n",
"\n",
"#Variable Declaration: \n",
"#from table A.2\n",
"P1 = 8\t\t\t\t\t#pressure at state 1 in MPa\n",
"P2 = 0.5\t\t\t\t#pressure at state 2 in MPa\n",
"T1 = 150\t\t\t\t#Temperature at state 1 in K\n",
"Pr1 = P1/3.39\t\t\t#Reduced pressure at state 1\n",
"Pr2 = P2/3.39\t\t\t#Reduced pressure at state 2\n",
"Tr1 = T1/126.2\t\t\t#Reduced temperature\n",
"T2 = 125\t\t\t\t#Temperature at state 2\n",
"R = 0.2968\t\t\t\t#gas constant for given substance\n",
"Tc = 126.2\t\t\t\t#K, Constant temperature\n",
"Cp = 1.0416\t\t\t\t#Heat enthalpy at constant pressure in kJ/kg\n",
"\n",
"#Calculations:\n",
"dh = (2.35)*R*Tc+Cp*(T2-T1)\t\t#\n",
"ds = 1.6*R-0.1*R+Cp*log(T2/T1)-R*log(P2/P1)\n",
"\n",
"#Results:\n",
"print 'Enthalpy change: ',round(dh,2),'kJ/kg'\n",
"print 'Entropy Change: ',round(ds,4),'kJ/kg.K'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 7"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Percentage deviation in specific volume using Kays rule: 4.8 %\n",
"Percentage deviation in specific volume using vander waals eqn: 6.4 %\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"from math import sqrt\n",
"#Example: 14.7\n",
"'''A mixture of 80% CO2 and 20% CH4 (mass basis) is maintained at 310.94 K, 86.19 bar,\n",
"at which condition the specific volume has been measured as 0.006757 m3/kg. Calculate\n",
"the percent deviation if the specific volume had been calculated by (a) Kay’s rule and (b)\n",
"van der Waals’ equation of state.\n",
"Control mass:\n",
"State:\n",
"Model:\n",
"Gas mixture.\n",
"P, v, T known.\n",
"(a) Kay’s rule. (b) van der Waals’ equation.'''\n",
"#Keys:\n",
"#a-denotes C02\n",
"#b-denotes CH4\n",
"#c-denotes critical conditions\n",
"\n",
"#Variable Declaration: \n",
"T = 310.94\t\t\t\t#Temperature of mixture K\n",
"P = 86.19\t\t\t\t#Pressure of mixture in MPa\n",
"Tca = 304.1\t\t\t\t#K\n",
"Tcb = 190.4\t\t\t\t#K\n",
"Pca = 7.38\t\t\t\t#MPa\n",
"Pcb = 4.60\t\t\t\t#MPa\n",
"Ra = 0.1889\t\t\t\t#gas constant for a in kJ/kg.K\n",
"Rb = 0.5183\t\t\t\t#gas constant for b in kJ/kg.K\n",
"xa = 0.8\t\t\t\t#fraction of CO2\n",
"xb = 0.2\t\t\t\t#fraction of CH4\n",
"Ma = 44.01\t\t\t\t#molecular mass of a\n",
"Mb = 16.043\t\t\t\t#molecular mass of b\n",
"Zm = 0.7\t\t\t\t#Compressiblity from generalised compressibility chart\n",
"ve = 0.0006757\t\t\t#experimental specific volume in m**3/kg\n",
"\n",
"#Calculations:\n",
"Rm = xa*Ra+xb*Rb\t\t#mean gas constant in kJ/kg.K\n",
"ya = xa/Ma/(xa/Ma+xb/Mb)#mole fraction of a\n",
"yb = xb/Mb/(xa/Ma+xb/Mb)#mole fraction of b\n",
"Tcm = ya*Tca+yb*Tcb\t\t#mean critical temp in K\n",
"Pcm = ya*Pca+yb*Tcb\t\t#mean critical pressure n MPa\n",
"Trm = T/Tcm\n",
"Prm = P/Pcm\n",
"vc = Zm*Rm*T/P/1000\t\t#specific volume calculated in m**3/kg\n",
"pd1 = (ve-vc)/ve*100\t#percent deviation\n",
"Aa = 27*Ra**2*Tca**2/(64*Pca*1000)\n",
"Ba = Ra*Tca/(8*Pca*1000)\n",
"Ab = 27*Rb**2*Tcb**2/(64*Pcb*1000)\n",
"Bb = Rb*Tcb/(8*Pcb*1000)\n",
"Am = (xa*sqrt(Aa)+xb*sqrt(Ab))**2\n",
"Bm = (xa*Ba+xb*Bb)\n",
"vc = 0.0006326\t\t\t#calculated specific volume in m**3/kg\n",
"pd2 = (ve-vc)/ve*100\n",
"\n",
"#Results:\n",
"print 'Percentage deviation in specific volume using Kays rule: ',round(pd1,1),'%'\n",
"print 'Percentage deviation in specific volume using vander waals eqn: ',round(pd2,1),'%' "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|