summaryrefslogtreecommitdiff
path: root/Fundamentals_Of_Thermodynamics/Chapter9_6.ipynb
blob: db80c9d597cbb7aa5470de7ec968b3499a7a1144 (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
580
581
582
583
584
585
586
587
588
{

 "metadata": {

  "name": "",

  "signature": "sha256:14f50faeadc2ed8de4732f59bac3e49ea9db1041eaf016b1692117fea4d3a511"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter9:SECOND-LAW ANALYSIS FOR A CONTROL VOLUME"

     ]

    },

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Ex9.1:pg-336"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 1\n",

      "#work done by steam\n",

      "\n",

      "hi=3051.2 #initial specific heat of enthalpy of steam in kJ/kg\n",

      "si=7.1228 #initial specific entropy of steam in kJ/kg-K\n",

      "Pe=0.15 #final pressure in MPa\n",

      "se=si #specific entropy in final state in kJ/kg-K\n",

      "sf=1.4335 #in kJ/kg-K\n",

      "sfg=5.7897 #in kJ/kg-K\n",

      "vi=50.0 #velocity with which steam enters turbine in m/s\n",

      "ve=200.0 #velocity with which steam leaves the turbine in m/s\n",

      "xe=(se-sf)/sfg #quality of steam in final state\n",

      "hf=467.1 #in kJ/kg\n",

      "hfg=2226.5 #in kJ/kg\n",

      "he=hf+xe*hfg #final specific heat of enthalpy of steam in kJ/kg\n",

      "w=hi+vi**2/(2*1000)-he-ve**2/(2*1000) #work of steam for isentropic process in kJ/kg\n",

      "print\"\\n hence, work per kilogram of steam for this isentropic process is\",round(w,1),\"KJ/kg\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence, work per kilogram of steam for this isentropic process is 377.5 KJ/kg\n"

       ]

      }

     ],

     "prompt_number": 5

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.2:pg-337"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 2\n",

      "#exit velocity of steam from nozzle\n",

      "\n",

      "hi=3051.2 #initial specific heat of enthalpy in kJ/kg\n",

      "si=7.1228 #initial specific entropy in kJ/kg-K\n",

      "se=si #final specific entropy \n",

      "Pe=0.3 #final pressure in MPa\n",

      "print\"from steam table,various properties at final state are\"\n",

      "he=2780.2 #final specific heat of enthalpy in kJ/kg-K\n",

      "Te=159.1 #final temperature in celsius\n",

      "vi=30.0 #velocity with which steam enters the nozzle in m/s\n",

      "ve=((2*(hi-he)+(vi**2/1000))*1000)**0.5 #final velocity of steam with which it exits in m/s\n",

      "print\"\\n hence,exit velocity of the steam from the nozzle is\",round(ve),\"m/s\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "from steam table,various properties at final state are\n",

        "\n",

        " hence,exit velocity of the steam from the nozzle is 737.0 m/s\n"

       ]

      }

     ],

     "prompt_number": 9

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.2E:pg-339"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 2E\n",

      "#exit velocity of steam from nozzle\n",

      "\n",

      "hi=1279.1 #initial specific heat of enthalpy in Btu/lbm\n",

      "si=1.7085 #initial specific entropy in Btu/lbm R\n",

      "se=si #final specific entropy \n",

      "Pe=40 #final pressure in lbf/in^2\n",

      "he=1193.9 #final specific heat of enthalpy in Btu/lbm\n",

      "Te=314.2 #final temperature in F\n",

      "vi=100.0 #velocity with which steam enters the nozzle in ft/s\n",

      "ve=((2*((hi-he)+(vi**2/(32.17*778)))*(32.17*778)))**0.5 #final velocity of steam with which it exits in ft/s\n",

      "print\"\\n hence,exit velocity of the steam from the nozzle is\",round(ve),\"ft/s\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,exit velocity of the steam from the nozzle is 2070.0 ft/s\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.3:pg-340"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 3\n",

      "#violation of second law\n",

      "\n",

      "print\"from R-134a tables\"\n",

      "se=1.7148 #specific entropy in final state in kJ/kg-K\n",

      "si=1.7395 #initial specific entropy in kJ/kg-K \n",

      "print\"therefore,se<si,whereas for this process the second law requires that se>=si.The process described involves a violation of the second law and thus would be impossible.\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "from R-134a tables\n",

        "therefore,se<si,whereas for this process the second law requires that se>=si.The process described involves a violation of the second law and thus would be impossible.\n"

       ]

      }

     ],

     "prompt_number": 10

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.4:pg-340"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 4\n",

      "#calculating required specific work\n",

      "\n",

      "Cp=1.004 #specific heat of air at constant pressure in kJ/kg-K\n",

      "Ti=290 #initial temperature in kelvins\n",

      "Pi=100 #initial pressure in kPa\n",

      "Pe=1000 #final pressure in kPa\n",

      "k=1.4 \n",

      "Te=Ti*(Pe/Pi)**((k-1)/k) #final temperature in kelvins\n",

      "we=Cp*(Ti-Te) #required specific work in kJ/kg\n",

      "print\"\\n hence,specific work required is\",round(we),\"kJ/kg\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,specific work required is -271.0 kJ/kg\n"

       ]

      }

     ],

     "prompt_number": 12

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.4E:pg-341"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 4E\n",

      "#calculating required specific work\n",

      "\n",

      "Cp=0.24 #specific heat of air at constant pressure in Btu/lbm R\n",

      "Ti=520 #initial temperature in R\n",

      "Pi=14.7 #initial pressure in lbf/in^2\n",

      "Pe=147 #final pressure in lbf/in^2\n",

      "k=1.4 \n",

      "Te=Ti*(Pe/Pi)**((k-1)/k) #final temperature in R\n",

      "we=Cp*(Ti-Te) #required specific work in Btu/lbm\n",

      "print\"\\n hence,specific work required is\",round(we,2),\"Btu/lbm\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,specific work required is -116.15 Btu/lbm\n"

       ]

      }

     ],

     "prompt_number": 34

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.5:pg-342"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 5\n",

      "#entropy generation\n",

      "\n",

      "h1=2865.54 #specific heat of enthalpy at state 1 in kJ/kg\n",

      "h2=83.94 #specific heat of enthalpy  at state 2 in kJ/kg\n",

      "h3=2725.3 #specific heat of enthalpy at state 3 in kJ?kg\n",

      "s1=7.3115 #specific entropy at state 1 in kJ/kg-K\n",

      "s2=0.2966 #specific entropy at state 2 in kJ/kg-K\n",

      "s3=6.9918 #specific entropy at state 3in kJ/kg-K\n",

      "m1=2 #mass flow rate at state 1 in kg/s\n",

      "m2=m1*(h1-h3)/(h3-h2) #mass flow rate at state 2 in kg/s\n",

      "m3=m1+m2 #mass flow rate at state 3 in kg/s\n",

      "Sgen=m3*s3-m1*s1-m2*s2 #entropy generation in the process\n",

      "print\"\\n hence,entropy generated in this process is \",round(Sgen,3),\"kW/K\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,entropy generated in this process is  0.072 kW/K\n"

       ]

      }

     ],

     "prompt_number": 15

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.6:pg-344"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 6\n",

      "#work required to fill the tank\n",

      "import math\n",

      "T1=17+273 #initial temperature of tank in Kelvins\n",

      "sT1=6.83521 #specific entropy in kJ/kg-K\n",

      "R=0.287 #gas constant in kJ/kg-K\n",

      "P1=100 #initial pressure in kPa\n",

      "P2=1000 #final pressure in kPa\n",

      "sT2=sT1+R*math.log(P2/P1) #specific entropy at temperature T2 in kJ/kg-K\n",

      "T2=555.7 #from interplotation \n",

      "V1=0.04 #volume of tank in m^3\n",

      "V2=V1 #final volume is equal to initial volume\n",

      "m1=P1*V1/(R*T1) #initial mass of air in tank in kg\n",

      "m2=P2*V2/(R*T2) #final mass of air in tank in kg\n",

      "Min=m2-m1 #in kg\n",

      "u1=207.19 #initial specific heat of enthalpy in kJ/kg\n",

      "u2=401.49 #final specific heat of enthalpy in kJ/kg\n",

      "hin=290.43 #in kJ/kg\n",

      "W12=Min*hin+m1*u1-m2*u2 #work required to fill the tank in kJ\n",

      "print\"\\n hence,the total amount of work required to fill the tank is\",round(W12,1),\"kJ\" "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,the total amount of work required to fill the tank is -31.9 kJ\n"

       ]

      }

     ],

     "prompt_number": 18

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.7:pg-347"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 7\n",

      "#work required to pump water isentropically \n",

      "\n",

      "P1=100 #initial pressure in kPa\n",

      "P2=5000 #final pressure in kPa\n",

      "v=0.001004 #specific volume in m^3/kg\n",

      "w=v*(P2-P1) #work required to pump water isentropically\n",

      "print\"\\n hence,work required to pump water isentropically  is \",round(w,2),\"kJ/kg\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,work required to pump water isentropically  is  4.92 kJ/kg\n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.8:pg-348"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 8\n",

      "#Velocity in exit flow\n",

      "\n",

      "print\"From Steam Tables, for liquid water at 20 C\"\n",

      "vf=0.001002 #in m^3/kg\n",

      "v=vf\n",

      "Pi=300 #Line pressure in kPa\n",

      "Po=100 #in kPa\n",

      "Ve=(2*v*(Pi-Po)*1000)**0.5 #velocity in the exit flow\n",

      "print\" \\n Hence, an ideal nozzle can generate upto \",round(Ve),\"m/s\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "From Steam Tables, for liquid water at 20 C\n",

        " \n",

        " Hence, an ideal nozzle can generate upto  20.0 m/s\n"

       ]

      }

     ],

     "prompt_number": 24

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.9:pg-351"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 9\n",

      "#Rate of Entropy Generation\n",

      "\n",

      "print\"From R-410a tables,we get\"\n",

      "hi=280.6 #in kJ/kg\n",

      "he=307.8 #in kJ/kg\n",

      "si=1.0272 #in kJ/kg\n",

      "se=1.0140 #in kJ/kg\n",

      "m=0.08 #flow rate of refrigerant in kg/s\n",

      "P=3 #electrical power input in kW\n",

      "Qcv=m*(he-hi)-P #in kW\n",

      "To=30 #in Celsius\n",

      "Sgen=m*(se-si)-Qcv/(To+273.2) #rate of entropy generation \n",

      "print\"\\n Hence,the rate of entropy generation for this process is\",round(Sgen,5),\"kW/K\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "From R-410a tables,we get\n",

        "\n",

        " Hence,the rate of entropy generation for this process is 0.00166 kW/K\n"

       ]

      }

     ],

     "prompt_number": 29

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.10:pg-353"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 10\n",

      "#turbine efficiency\n",

      "\n",

      "hi=3051.2 #initial specific heat of enthalpy in kJ/kg\n",

      "si=7.1228 #initial specific entropy in kJ/kg-K\n",

      "sf=0.7548 #in kJ/kg-K\n",

      "sfg=7.2536 #in kJ/kg-K\n",

      "ses=si #final specific entropy is same as the initial\n",

      "xes=(si-sf)/sfg #quality of steam when it leaves the turbine\n",

      "hf=225.9 #in kJ/kg\n",

      "hfg=2373.1 #in kJ/kg\n",

      "hes=hf+xes*hfg #final specific heat of enthalpy in kJ/kg\n",

      "ws=hi-hes #work output of turbine calculated ideally  in kJ/kg\n",

      "wa=600 #actual work output of turbine in kJ/kg\n",

      "nturbine=wa/ws #efiiciency of turbine \n",

      "print\"\\n hence,efficiency of the turbine is\",round(nturbine*100,1),\"%\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,efficiency of the turbine is 80.9 %\n"

       ]

      }

     ],

     "prompt_number": 32

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.11:pg-355"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 11\n",

      "#turbine inlet pressure\n",

      "import math\n",

      "hi=1757.3 #initial specific heat of enthalpy of air in  kJ/kg\n",

      "si=8.6905 #initial specifc entropy of airin kJ/kg-K\n",

      "he=855.3 #final specific heat of enthalpy of air in kJ/kg\n",

      "w=hi-he #actual work done by turbine in kJ/kg\n",

      "n=0.85 #efficiency of turbine \n",

      "ws=w/n #ideal work done by turbine in kJ/kg\n",

      "hes=hi-ws #from first law of isentropic process\n",

      "Tes=683.7 #final temperature in kelvins from air tables\n",

      "ses=7.7148 #in kJ/kg-K\n",

      "R=0.287 #gas constant in kJ/kg-K\n",

      "Pi=100/math.e**((si-ses)/-R) #turbine inlet pressure in kPa\n",

      "print\"\\n hence,turbine inlet pressure is\",round(Pi),\"kPa\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,turbine inlet pressure is 2995.0 kPa\n"

       ]

      }

     ],

     "prompt_number": 36

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex9.12:pg-357"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 12\n",

      "#required work input\n",

      "\n",

      "Pe=150.0 #final pressure of air in kPa\n",

      "Pi=100.0 #initial presure of air in kPa\n",

      "k=1.4\n",

      "Ti=300.0 #initial temperature of air in kelvis\n",

      "Tes=Ti*(Pe/Pi)**((k-1)/k) #from second law\n",

      "ws=1.004*(Ti-Tes) #from first law of isentropic process\n",

      "n=0.7 #efficiency of automotive supercharger \n",

      "w=ws/n #real work input in kJ/kg\n",

      "Te=Ti-w/1.004 #temperature at supercharger exit in K\n",

      "print\"\\n hence,required work input is \",round(w),\"kJ/kg\"\n",

      "print\"\\n and exit temperature is \",round(Te,1),\"K\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " hence,required work input is  -53.0 kJ/kg\n",

        "\n",

        " and exit temperature is  352.6 K\n"

       ]

      }

     ],

     "prompt_number": 44

    }

   ],

   "metadata": {}

  }

 ]

}