summaryrefslogtreecommitdiff
path: root/backup/Thermodynamics_for_Engineers_version_backup/Chapter_10.ipynb
blob: 6a9f7f744e55ac994626c9739629a8281ca48966 (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
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
{
 "metadata": {
  "name": "",
  "signature": "sha256:cbda57f5092671910369ce2a43538fa17705152cf0ccb12e90ebe176631fb4e1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 - Vapors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the specific volume, enthalpy and entropy of the gas\n",
      "#Initialization of variables\n",
      "import math\n",
      "p=3000. #psia\n",
      "T=250. #F\n",
      "#calculations\n",
      "print '%s' %(\"From table 1, keenan and keynes,\")\n",
      "vf=0.01700\n",
      "print '%s' %(\"From table 4,\")\n",
      "dvf=-18.3*math.pow(10,-5)\n",
      "v=vf+dvf\n",
      "print '%s' %(\"From table 1,\")\n",
      "hf=218.48\n",
      "print '%s' %(\"From table 4,\")\n",
      "dhf=6.13\n",
      "h=hf+dhf\n",
      "sf=0.3675\n",
      "dsf=-4.34*math.pow(10,-3)\n",
      "s=sf+dsf\n",
      "#results\n",
      "print '%s %.5f %s' %(\"Specific volume =\",v,\" cu ft/lb\")\n",
      "print '%s %.2f %s' %(\"\\n Enthalpy =\",h,\" Btu/lb\")\n",
      "print '%s %.4f %s' %(\"\\n Entropy  =\",s,\" Btu/lb per deg R\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1, keenan and keynes,\n",
        "From table 4,\n",
        "From table 1,\n",
        "From table 4,\n",
        "Specific volume = 0.01682  cu ft/lb\n",
        "\n",
        " Enthalpy = 224.61  Btu/lb\n",
        "\n",
        " Entropy  = 0.3632  Btu/lb per deg R\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the state of the gas and moisture content\n",
      "#Initialization of variables\n",
      "h=1100 #Btu/lb\n",
      "P=100 #psia\n",
      "#calculations\n",
      "print '%s' %(\"From table 2 of keenan and keynes,\")\n",
      "hg=1187.2 #Btu/lb\n",
      "hfg=888.8 #Btu/lb\n",
      "y=-(h-hg)/hfg*100\n",
      "#results\n",
      "print '%s %.2f %s %.2f %s' %(\"The state is\",P,\"psia with a moisture content of\",y,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2 of keenan and keynes,\n",
        "The state is 100.00 psia with a moisture content of 9.81 percent\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the state of steam\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 1 of keenan and keynes,\")\n",
      "v1=0.2688\n",
      "#calculations\n",
      "v2=3.060\n",
      "p2=200 #psia\n",
      "t2=600 #F\n",
      "#results\n",
      "print '%s %d %s %d %s' %(\"State of steam is\",p2, \"psia and\",t2,\"F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 of keenan and keynes,\n",
        "State of steam is 200 psia and 600 F\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the state of steam\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 2 of keenan and keynes,\")\n",
      "t1=439.60 #F\n",
      "u1=1118.4 #Btu/lb\n",
      "#calculations\n",
      "p2=380 #psia\n",
      "#results\n",
      "print '%s %d %s %.2f %s' %(\"The state of steam is saturated at\",p2,\"psia and\",t1,\"F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2 of keenan and keynes,\n",
        "The state of steam is saturated at 380 psia and 439.60 F\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcualte the state of steam and moisture content\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 2 of keenan and keynes,\")\n",
      "p1=1 #in of Hg\n",
      "s=1.9812 \n",
      "#calculations\n",
      "sf=2.0387\n",
      "sfg=1.9473\n",
      "y=-(s-sf)/sfg*100\n",
      "#results\n",
      "print '%s %d %s %.2f %s' %(\"The state is\",p1, \"in of Hg with a moisture content of\",y, \"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2 of keenan and keynes,\n",
        "The state is 1 in of Hg with a moisture content of 2.95 percent\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the final state of steam and temperature. Also calculate the final enthalpy\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 1 of keenan and keynes,\")\n",
      "h1=1204.8 #Btu/lb\n",
      "q=174. #Btu/lb\n",
      "#calculations\n",
      "h2=h1+q\n",
      "p2=30. #psia\n",
      "t2=720. #F\n",
      "#results\n",
      "print '%s %d %s %d %s' %(\"Final state of steam is\",p2,\"psia and\",t2,\" F\")\n",
      "print '%s %.1f %s' %(\"\\n Final enthalpy is\",h2,\"Btu/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 of keenan and keynes,\n",
        "Final state of steam is 30 psia and 720  F\n",
        "\n",
        " Final enthalpy is 1378.8 Btu/lb\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the final specific volume and final state of steam\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 1 of keenan and keynes,\")\n",
      "p=70 #psia\n",
      "x=0.1\n",
      "p2=198 #psia\n",
      "#calculations\n",
      "v1=6.206\n",
      "v2=0.017\n",
      "vx=v1-x*(v1-v2)\n",
      "t2=1400 #F\n",
      "#results\n",
      "print '%s %.3f %s' %(\"Final specific volume =\",vx,\"cu ft\")\n",
      "print '%s %d %s %d %s' %(\"\\n Final state is\",p2,\"psia and\",t2,\"F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 of keenan and keynes,\n",
        "Final specific volume = 5.587 cu ft\n",
        "\n",
        " Final state is 198 psia and 1400 F\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - Pg 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the final state of steam\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 1 of keenan and keynes,\")\n",
      "p=400 #psia\n",
      "t1=700 #F\n",
      "p2=85 #psia\n",
      "#calculations\n",
      "s2=1.6398 #units/lb\n",
      "t2=350 #F\n",
      "#results\n",
      "print '%s %d %s %d %s' %(\"Final state of steam is\",p2,\"psia and\",t2,\"F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 of keenan and keynes,\n",
        "Final state of steam is 85 psia and 350 F\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - Pg 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the work of compression and heat removed\n",
      "#Initialization of variables\n",
      "import math\n",
      "p1=20. #psia\n",
      "p2=140. #psia\n",
      "J=778.\n",
      "t2=150. #F\n",
      "t1=30. #F\n",
      "#calculations\n",
      "print '%s' %(\"From Table A-3,\")\n",
      "v1=2.0884 #cu ft/lb\n",
      "v2=0.33350 #cu ft/lb\n",
      "h2=95.709\n",
      "h1=81.842\n",
      "n=math.log(p2/p1) /math.log(v1/v2)\n",
      "W=(p2*v2-p1*v1)*144/(1-n)\n",
      "du=h2-h1 + (p1*v1-p2*v2)*144/J\n",
      "Q=du+W/J\n",
      "s2=0.17718\n",
      "s1=0.18126\n",
      "Q2=((t2+t1)/2 +460) *(s2-s1)\n",
      "#results\n",
      "print '%s %d %s' %(\"Work of compression =\",W,\"ft-lb\")\n",
      "print '%s %.3f %s' %(\"\\n Heat removed per pound of refrigerant =\",Q,\" Btu/lb\")\n",
      "print '%s %.4f %s' %(\"\\n Heat removed in case 2 =\",Q2,\" Btu\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From Table A-3,\n",
        "Work of compression = -11671 ft-lb\n",
        "\n",
        " Heat removed per pound of refrigerant = -2.046  Btu/lb\n",
        "\n",
        " Heat removed in case 2 = -2.2440  Btu\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10 - Pg 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the specific enthalpy of exhaust steam\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 1 of keenan and keynes,\")\n",
      "intt=440000 #lb/hr\n",
      "out=255000 #lb/hr\n",
      "p1=400 #psia\n",
      "t1=700 #F\n",
      "p2=35 #psia\n",
      "t2=290 #F\n",
      "vel=500 #ft/s\n",
      "hp=44000 #hp\n",
      "ent=1362.7 #Btu/lb\n",
      "#calculations\n",
      "ein=ent*intt\n",
      "eout=hp*2544 + out*1183 + 925000.\n",
      "h2= (ein-eout)/185000.\n",
      "#results\n",
      "print '%s %d %s' %(\"Specific enthalpy of exhaust steam =\",h2,\"Btu/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 of keenan and keynes,\n",
        "Specific enthalpy of exhaust steam = 1000 Btu/lb\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11 - Pg 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcualte the final state of steam and loss of available energy\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 1 of keenan and keynes,\")\n",
      "h1=1351.1 #Btu/lb\n",
      "p1=600. #psia\n",
      "t1=700. #F\n",
      "p2=234. #psia\n",
      "h2=1.6865\n",
      "h1=1.5875\n",
      "t3=101.74\n",
      "#calculations\n",
      "t2=660. #F\n",
      "loss= (h2-h1)*(t3+459.69)\n",
      "#results\n",
      "print '%s %d %s %d %s' %(\"Final state of steam is\",p2,\" psia and\",t2,\"F\")\n",
      "print '%s %.1f %s' %(\"\\n Loss of available energy =\",loss,\"Btu/lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 1 of keenan and keynes,\n",
        "Final state of steam is 234  psia and 660 F\n",
        "\n",
        " Loss of available energy = 55.6 Btu/lb\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12 - Pg 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the state of vapor and also the quality\n",
      "#Initialization of variables\n",
      "print '%s' %(\"From table 2 of keenan and keynes,\")\n",
      "p1=98.87 #psia\n",
      "p2=31.78 #psia\n",
      "t1=80 #F\n",
      "h2=26.365 #btu/lb\n",
      "h1=11.554 #btu/lb\n",
      "hfg=67.203 #btu/lb\n",
      "#calculations\n",
      "x=(h2-h1)/hfg*100\n",
      "#results\n",
      "print '%s %.2f %s %.2f %s' %(\"The state of vapor leaving is\",p2, \"psia with a quality of\",x, \" percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 2 of keenan and keynes,\n",
        "The state of vapor leaving is 31.78 psia with a quality of 22.04  percent\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13 - Pg 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the mean state in the line and also the moisture content\n",
      "#Initialization of variables\n",
      "ps=216 #psig\n",
      "pb=29.12 #in of Hg\n",
      "p2=0.4 #in\n",
      "t2=244 #F\n",
      "#calculations\n",
      "pa=0.491*pb\n",
      "pabs=pa + p2*0.491\n",
      "plb=pa+ ps\n",
      "hcal=1166.5 #Btu/lb\n",
      "h2=1200.1 #Btu/lb\n",
      "h3=831.9 #Btu/lb\n",
      "y=-(hcal-h2)/h3*100\n",
      "#results\n",
      "print '%s %.1f %s %.2f %s' %(\"Mean state in the line is\",plb,\" psia with a moisture content of\",y,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mean state in the line is 230.3  psia with a moisture content of 4.04 percent\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}