summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Thermodynamics/ch5.ipynb
blob: 82c295624e0ae5dfcfc0b9943d47df074ac169b9 (plain)
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
{
 "metadata": {
  "name": "",
  "signature": "sha256:7f13a6535713e6dd307350b25e55b55427f77dbef3f6f6422a5890eea0412625"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : First Law of Thermodynamics for Control Volumes"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1 Page No : 119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Q = -24.; \t\t\t#KJ/kg\n",
      "\n",
      "p1 = 5e5; \t\t\t#N/m**2\n",
      "t1 = 227.; \t\t\t#\u00b0C\n",
      "V1 = 50.; \t\t\t#m/s\n",
      "v1 = 0.78; \t\t\t#m**3/kg\n",
      "\n",
      "p2 = 1e5; \t\t\t#N/m**2\n",
      "t2 = 57.; \t\t\t#\u00b0C\n",
      "V2 = 100.; \t\t\t#m/s\n",
      "v2 = 0.97; \t\t\t#m**3/kg\n",
      "\n",
      "g = 9.81; \t\t\t#m/s**2 \t\t\t#acceleration due to gravity\n",
      "\n",
      "delta_z = -5; \t\t\t#m \n",
      "Cv = 0.7; \t\t\t#KJ/kg \n",
      "delta_u = Cv*(t2 - t1); \t\t\t#KJ/kg \t\t\t#change in internal energy \t\t\t#u2-u1\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "delta_h = delta_u + (p2*v2 - p1*v1)*.001; \t\t\t#KJ/kg \t\t\t#change in enthalpy \t\t\t#h2-h1\n",
      "\n",
      "W_x = Q - (delta_h + (V2**2 - V1**2)/2*.001 + g*delta_z*.001); \t\t\t#kJ/kg \t\t\t#Work Output\n",
      "\n",
      "print \"Work output = %.1f KJ/kg\"%(W_x);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work output = 384.3 KJ/kg\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2 Page No : 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\t\t\t\n",
      "# Variables\n",
      "m = 5000./3600 \t\t\t# kg/s \t\t\t# flow rate\n",
      "W_x = 550.   \t\t\t# KJ/s \t\t\t#power developed by turbine\n",
      "Q = 0.   \t    \t\t#Heat loss is negligible\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "#Part (a)\n",
      "print \"Parta\"\n",
      "V1 = 0. \t\t\t# m/s \t\t\t#inlet velocity\n",
      "V2 = 360. \t\t\t# m/s \t\t\t#exit velocity\n",
      "g = 9.81 \t\t\t# m/s**2\n",
      "delta_z = 0. \t\t\t#m \t\t\t#z2-z1\n",
      "\n",
      "delta_h = ((Q-W_x)/m)-g*delta_z*.001-((V2**2-V1**2)/2000) \t\t\t#KJ/Kg \t\t\t#change in enthalpy\n",
      "print \"Change in enthalpy = %.2f KJ/kg\"%(delta_h)\n",
      "\n",
      "#Part (a)\n",
      "print \"Partb\"\n",
      "V1 = 60. \t\t\t# m/s \t\t\t#inlet velocity\n",
      "V2 = 360. \t\t\t# m/s \t\t\t#exit velocity\n",
      "g = 9.81 \t\t\t# m/s**2\n",
      "delta_z = 0. \t\t\t#m \t\t\t#z2-z1\n",
      "\n",
      "delta_h = ((Q-W_x)/m)-g*delta_z*.001-((V2**2-V1**2)/2000) \t\t\t#KJ/Kg \t\t\t#change in enthalpy\n",
      "print \"Change in enthalpy = %.2f KJ/kg\"%(delta_h)\n",
      "\n",
      "# note : rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Parta\n",
        "Change in enthalpy = -460.80 KJ/kg\n",
        "Partb\n",
        "Change in enthalpy = -459.00 KJ/kg\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3 Page No : 122"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "mA = 0.8 \t\t\t# kg/s \t\t\t#flow rate of stream A\n",
      "pA = 15e5 \t\t\t# N/m**2 \t\t\t#Pressure of stream A\n",
      "tA = 250. \t\t\t#\u00b0C \t\t\t#temperature of stream A\n",
      "\n",
      "mB = 0.5 \t\t\t# kg/s \t\t\t#flow rate of stream B\n",
      "pB = 15e5 \t\t\t# N/m**2 \t\t\t#Pressure of stream B\n",
      "tB = 200. \t\t\t#\u00b0C \t\t\t#temperature of stream B\n",
      "\n",
      "Q = 0. \t\t\t#No heat loss\n",
      "\n",
      "p1 = 10e5 \t\t\t# N/m**2 \t\t\t#pressure supply of chamber\n",
      "t2 = 30. \t\t\t#\u00b0C \t\t\t#exhaust air temperature from turbine\n",
      "\n",
      "Cv = 0.718 \t\t\t# KJ/kgK \t\t\t#heat capacity at constant volume\n",
      "Cp = 1. \t\t\t# KJ/kgK \t\t\t#heat capacity at constant pressure\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "#Part(a)\n",
      "print \"Part a\"\n",
      "t1 = ((mA*Cp*tA)+(mB*Cp*tB))/((mA*Cp)+(mB*Cp)) \t\t\t# \u00b0C \t\t\t#the temperature of air at inlet to the turbine\n",
      "print \"The temperature of air at inlet to the turbine = %.2f \u00b0C\"%(t1);\n",
      "\n",
      "#Part(b)\n",
      "print \"Part b\"\n",
      "WT = -1*(mA+mB)*Cp*(t2-t1) \t\t\t# \u00b0kW \t\t\t#power developed by turbine\n",
      "print \"Power developed by turbine = %.0f kW\"%(WT);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part a\n",
        "The temperature of air at inlet to the turbine = 230.77 \u00b0C\n",
        "Part b\n",
        "Power developed by turbine = 261 kW\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4 Page No : 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "d1 = 0.15 \t\t\t#m \t\t\t#inlet diameter\n",
      "m = 4000./3600 \t\t\t# kg/s \t\t\t#flow rate\n",
      "v1 = 0.285 \t\t\t#m**3/kg \t\t\t#specific volume at entry\n",
      "d2 = 0.25 \t\t\t#m \t\t\t#exit diameter\n",
      "v2 = 15. \t\t\t# m**3/kg \t\t\t#specific volume at exit\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "\n",
      "A1 = math.pi*d1**2/4 \t\t\t#m**2 \t\t\t#inlet cross sectional area\n",
      "A2 = math.pi*d2**2/4 \t\t\t# m**2 \t\t\t# exit cross sectional area\n",
      "print \"Inlet cross sectional area A1)= %.5f m**2\"%(A1);\n",
      "print \"Exit cross sectional area A2)= %.4f m**2\"%(A2);\n",
      "\n",
      "V1 = m*v1/A1 \t\t\t#m/s \t\t\t#inlet velocity\n",
      "V2 = m*v2/A2 \t\t\t#m/s \t\t\t#exit velocity\n",
      "\n",
      "print \"Inlet velocity = %.1f m/s\"%(V1);\n",
      "print \"Exit velocity = %.1f m/s\"%(int(V2));\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inlet cross sectional area A1)= 0.01767 m**2\n",
        "Exit cross sectional area A2)= 0.0491 m**2\n",
        "Inlet velocity = 17.9 m/s\n",
        "Exit velocity = 339.0 m/s\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5 Page No : 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "p1 = 10.\t\t\t#bar \t\t\t#inlet pressure\n",
      "t1 = 300. \t\t\t#\u00b0C \t\t\t#inlet temperature\n",
      "\n",
      "p2 = 0.1 \t\t\t#bar \t\t\t#exit pressure\n",
      "Cp = 1. \t\t\t#kJ/kgK \t\t\t# heat capacity at constant pressure\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "#Adiabatic process\n",
      "delta_h = 0 \t\t\t#change in enthalpy\n",
      "t2 = delta_h/Cp + t1\n",
      "print \"Temperature of air after throttling = %.0f \u00b0C\"%(t1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature of air after throttling = 300 \u00b0C\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6 Page No : 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "p1 = 1e5 \t\t\t# N/m**2 \t\t\t#inlet pressure\n",
      "v1 = 0.08 \t\t\t#m**3/kg \t\t\t# specific volume at inlet\n",
      "p2 = 7e5 \t\t\t# N/m**2 \t\t\t#exit pressure\n",
      "v2 = 0.016 \t\t\t# m**3/kg \t\t\t#specific volume at exit\n",
      "u1 = 48. \t\t\t# kJ/kg \t\t\t# internal energy at inlet\n",
      "u2 = 200. \t\t\t# kJ/kg \t\t\t# internal energy at exit\n",
      "Q = -120. \t\t\t# kJ/kg \t\t\t# heat loss\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "Wc = ((u2 - u1) + (p2*v2 - p1*v1)*.001 - Q)*-1 \t\t\t# kJ/kg \t\t\t# work input to compressor\n",
      "print \"Work input to compressor Wc) = %.1f kJ/kg\"%(Wc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work input to compressor Wc) = -275.2 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7 Page No : 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# variables\n",
      "mh = 9.45 \t\t\t# kg/s \t\t\t# flow rate of steam\n",
      "h_h2 = 140. \t\t\t# kJ/kg \t\t\t# enthalpy of condensate\n",
      "h_h1 = 2570. \t\t\t# kJ/kg \t\t\t# inlet enthalpy of steam\n",
      "t1 = 25. \t\t\t# \u00b0C \t\t\t#inlet temperature of cooling water\n",
      "t2 = 36. \t\t\t# \u00b0C \t\t\t#exit temperature of cooling water\n",
      "c = 4.189 \t\t\t# kJ/kg deg \t\t\t# specific heat of water\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "mc = -1*(mh*(h_h2-h_h1))/(c*(t2-t1)) \t\t\t# kg/s \t\t\t#mass flow rate of cooling water\n",
      "print \"Mass flow rate of cooling water = %.2f kg/s\"%(mc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass flow rate of cooling water = 498.35 kg/s\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.8 Page No : 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# variables\n",
      "mh = 9.45 \t\t\t# kg/s \t\t\t# flow rate of steam\n",
      "h_h2 = 140. \t\t\t# kJ/kg \t\t\t# enthalpy of condensate\n",
      "h_h1 = 2570. \t\t\t# kJ/kg \t\t\t# inlet enthalpy of steam\n",
      "t1 = 25. \t\t\t# \u00b0C \t\t\t#inlet temperature of cooling water\n",
      "t2 = 36. \t\t\t# \u00b0C \t\t\t#exit temperature of cooling water\n",
      "c = 4.189 \t\t\t# kJ/kg deg \t\t\t# specific heat of water\n",
      "fractionalheatloss = 0.1 \t\t\t# fractional heat loss\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "mc = -1*((1-fractionalheatloss)*mh*(h_h2-h_h1))/(c*(t2-t1)) \t\t\t# kg/s \t\t\t#mass flow rate of cooling water\n",
      "print \"Mass flow rate of cooling water = %.1f kg/s\"%(mc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass flow rate of cooling water = 448.5 kg/s\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.9 Page No : 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# variables\n",
      "V1 = 300 \t\t\t#m/s \t\t\t#inlet air velocity\n",
      "t2 = 100 \t\t\t#\u00b0C \t\t\t#exit air temperature\n",
      "V2 = 15 \t\t\t#m/s \t\t\t#exit air velocity\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "t1 = t2 + .001*(V2**2 - V1**2)/2 \t\t\t# \u00b0C \t\t\t#inlet air temperature\n",
      "print \"Inlet air temperature = %.1f \u00b0C\"%(t1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inlet air temperature = 55.1 \u00b0C\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.10 Page No : 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "m1 = 0.8 \t\t\t#kg \t\t\t#initial mass of air\n",
      "p1 = 150. \t\t\t#kPa \t\t\t#initial pressure of air\n",
      "T1 = 300. \t\t\t#K \t\t\t#initial temperature of air\n",
      "p_p = 600. \t\t\t#kPa \t\t\t#pressure of air in pipe\n",
      "T_p = 330. \t\t\t#K \t\t\t# temperature of air in pipe\n",
      "\n",
      "\t\t\t\n",
      "# Calculations and Results\n",
      "m2T2 = (p_p/p1)*T1*m1\n",
      "m2 = ((0.718*(m2T2/m1-T1))/(331.65)*m1)+m1 \t\t\t#kg \t\t\t#final mass of air\n",
      "print \"Mass of air entering in vessel = %.4f kg\"%(m2-m1)\n",
      "T2 = m2T2/m2 \t\t\t#K \t\t\t#Temperature of air in vessel\n",
      "print \"Temperature of air in vessel = %.0f K\"%(T2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of air entering in vessel = 1.5588 kg\n",
        "Temperature of air in vessel = 407 K\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}