summaryrefslogtreecommitdiff
path: root/Fundamentals_Of_Thermodynamics/chapter10.ipynb
blob: e985ae83dcc6a719727a33e5c2eb624fca65fa3a (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
{

 "metadata": {

  "name": "",

  "signature": "sha256:498eddefb3635fb861c09bdd97718d2b72fb04f4d3b083cedbf9f6de28a92b4e"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter10:IRREVERSIBILITY AND AVAILABILITY"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.1:pg-386"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 1\n",

      "#Calculating reversible work\n",

      "#Form the Steam Tables,the inlet and the exit state properties are \n",

      "\n",

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

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

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

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

      "m=5 #mass flow rate of feedwater in kg/s\n",

      "q1=900/m #heat added by one of the sources in kJ/kg\n",

      "q2=he-hi-q1 #second heat transfer in kJ/kg\n",

      "To=25+273.3 #Temp. of the surroundings in K\n",

      "T1=100+273.2 #temp. of reservoir of one of the source in K\n",

      "T2=200+273.2 #temp. of reservoir of second source in K\n",

      "wrev=To*(se-si)-(he-hi)+q1*(1-To/T1)+q2*(1-To/T2) #reversible work in kJ/kg\n",

      "print\"\\n Hence, the irreversibility is\",round(wrev),\"kJ/kg\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " Hence, the irreversibility is 62.0 kJ/kg\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.2:pg-387"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 2\n",

      "#Calculating reversible work\n",

      "#Form the Steam Tables,the inlet and the exit state properties are\n",

      "\n",

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

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

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

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

      "q=-50 #heat lost to surroundings in kJ/kg\n",

      "w=hi-he+q #work in kJ/kg\n",

      "To=25+273.2 #Temp. of the surroundings in K\n",

      "P1=100 #Pressure of ambient air in kPa\n",

      "P2=1000 #Final pressure of air after compression in kPa\n",

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

      "wrev=To*(se-si-R*log(P2/P1))-(he-hi)+q*(1-To/To)#reversible work for the given change of state in kJ/kg\n",

      "i=wrev-w #irreversibility in kJ/kg\n",

      "print\"\\n Hence,the irreversibility is\",round(i,1),\"kJ/kg\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " Hence,the irreversibility is 32.8 kJ/kg\n"

       ]

      }

     ],

     "prompt_number": 10

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.2E:pg-388"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 2E\n",

      "#Calculating reversible work\n",

      "#Form the Steam Tables,the inlet and the exit state properties are\n",

      "\n",

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

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

      "se=1.7803 #final specific entropy in Btu/lbm R\n",

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

      "q=-22 #heat lost to surroundings in Btu/lbm\n",

      "w=hi-he+q #work in Btu/lbm\n",

      "To=539.7 #Temp. of the surroundings in R\n",

      "P1=14.7 #Pressure of ambient air in lbf/in^2\n",

      "P2=150 #Final pressure of air after compression in lbf/in^2\n",

      "R=0.06855 #Universal gas constant in Btu/lbm R\n",

      "wrev=To*(se-si-R*log(P2/P1))-(he-hi)+q*(1-To/To)#reversible work for the given change of state in Btu/lbm\n",

      "i=wrev-w #irreversibility in Btu/lbm\n",

      "print\"\\n Hence,the irreversibility is\",round(i,2),\"Btu/lbm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " Hence,the irreversibility is 11.52 Btu/lbm\n"

       ]

      }

     ],

     "prompt_number": 18

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.3:pg-390"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 3\n",

      "#Calculating reversible work and irreversibility\n",

      "#Form the Steam Tables at state 1\n",

      "\n",

      "u1=1243.5 #initial specific internal energy in kJ/kg\n",

      "s1=4.4819 #initial specific entropy in kJ/kg-K\n",

      "v1=28.895 #initial specific volume in m^3/kg\n",

      "v2=2*v1 #final specific volume in kg/m^3\n",

      "u2=u1 #initial specific internal energy in kJ/kg\n",

      "#These two independent properties, v2 and u2 , fix state 2.The final temp. is calculated by interplotation using the data for T2=5C and v2,x=0/3928 and u=948.5 kJ/kg. For T2=10C and v2, x=0.5433 and u=1317 kJ/kg\n",

      "T2=9.1+273.2 #final temp. in K\n",

      "x2=0.513 #quality in final state\n",

      "s2=4.644 #final specific entropy in kJ/kg\n",

      "V1=1 #volume of part of A in m^3\n",

      "m=V1/v1  #mass flow rate in kg/s\n",

      "To=20+273.2 #Room temperature in K\n",

      "Wrev=To*m*(s2-s1) #reversible work in kJ\n",

      "I=Wrev #irreversibility of the process\n",

      "print\"\\n The irreversibility is\",round(I,3),\"kJ\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " The irreversibility is 1.645 kJ\n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.4:pg-391"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 4\n",

      "#calculating the final mass in the tank and the irreversibility in the process\n",

      "#From the ammonia tables, the initial and line state properties are\n",

      "\n",

      "V=1#volume of the rigid tank in m^3\n",

      "v1=0.6995#initial specific volume in m^3/kg\n",

      "u1=1369.5#initial specific internal energy in kJ/kg\n",

      "s1=5.927#initial specific entropy in kJ/kg K\n",

      "h1=134.41#initial specific heat of enthalpy in kJ/kg\n",

      "si=0.5408#in kJ/kg K\n",

      "m1=V/v1#initial mass in kg\n",

      "x2=0.007182\n",

      "v2=(0.001534 + x2 * 0.41684)#in m^3/kg\n",

      "v2=round(v2,7)\n",

      "s2=0.5762#final specific entropy in kJ/kg\n",

      "m2=V/v2#the final mass in kg\n",

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

      "mi=round(mi,3)\n",

      "T=293.15# in K\n",

      "S2gen=(m2*s2-m1*s1-mi*si)#in kJ/kg\n",

      "S2gen=round(S2gen,3)\n",

      "Icv=T*S2gen#in kJ\n",

      "print\"\\n the final mass is \",round(m2,2),\"kg\"\n",

      "print\"\\n the irreversiblity is\",round(Icv,3),\"kJ\"\n",

      "\n",

      "\n",

      "\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " the final mass is  220.86 kg\n",

        "\n",

        " the irreversiblity is 34.885 kJ\n"

       ]

      }

     ],

     "prompt_number": 31

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.5:pg-396"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 5\n",

      "#calculating the availability per kilogram of the steam entering and at both points at which steam leaves the turbine,\n",

      "#the isentropic efficiency,the second-law efficiency for this process\n",

      "#For the ideal isentropic turbine,\n",

      "\n",

      "h0=104.9#in kJ/kg\n",

      "s0=0.3674#entropy at state0 in kJ/kgK\n",

      "m1=30#mass at state1 in kg\n",

      "phi1=1109.6#in kJ/kg\n",

      "h1=3115.3#enthalpy at state1 in kJ/kg\n",

      "m2=5#mass at state2 in kg\n",

      "phi2=755.3#in kJ/kg\n",

      "h2=2855.4#enthalpy at state2 For the actual turbine in kJ/kg\n",

      "m3=25#mass at state3 in kg\n",

      "phi3=195.0#in kJ/kg\n",

      "S2s=6.7428#entropy in kJ/kg K at state2\n",

      "x2s=(6.7428-1.8606)/4.906# dryness factor at state2 \n",

      "x2s=round(x2s,4)\n",

      "h2s=640.2+(x2s*2108.5)#entropy at state2 for the ideal isentropic turbine\n",

      "S3s=6.7428#entropy in kJ/kg K\n",

      "x3s=(6.7428-0.7549)/7.2536# dryness factor at state3\n",

      "x3s=round(x3s,4)\n",

      "h3s=225.9+(x3s*2373.1)#enthalpy in kJ/kg\n",

      "h3=2361.8#enthalpy at state3 For the actual turbine in kJ/kg\n",

      "Ws=(m1*h1-m2*h2s-m3*h3s)#workdone for the ideal isentropic turbine in kW\n",

      "W=(m1*h1-m2*h2-m3*h3)#workdone For the actual turbine in kW\n",

      "W2=(m1*phi1-m2*phi2-m3*phi3)#workdone for the second ideal isentropic turbine in kW\n",

      "eta1=W/Ws#The isentropic efficiency\n",

      "eta2=W/W2#he second-law efficiency\n",

      "print\"\\n the workdone for the ideal isentropic turbine is \",round(Ws),\"kW\"\n",

      "print\"\\n the workdone for the actual turbine is \",round(W),\"kg\"\n",

      "print\"\\n the workdone for the second ideal isentropic turbine  is \",round(W2),\"kW\"\n",

      "print\"\\n the isentropic efficiency is \",round(eta1,3)\n",

      "print\"\\n the second-law efficiency is \",round(eta2,3)\n",

      "#The answer of the x2s in the book is wrong.\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " the workdone for the ideal isentropic turbine is  25145.0 kW\n",

        "\n",

        " the workdone for the actual turbine is  20137.0 kg\n",

        "\n",

        " the workdone for the second ideal isentropic turbine  is  24637.0 kW\n",

        "\n",

        " the isentropic efficiency is  0.801\n",

        "\n",

        " the second-law efficiency is  0.817\n"

       ]

      }

     ],

     "prompt_number": 1

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.6:pg-399"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 6\n",

      "#calculate the second-law efficiency for this process and the irreversibility per kilogram of water evaporated\n",

      "\n",

      "he1=2950#enthalpy in kJ/kg\n",

      "hi1=632.2#enthalpy in kJ/kg\n",

      "he2=599.5#enthalpy in kJ/kg\n",

      "hi2=1199#enthalpy in kJ/kg\n",

      "#r=mp/mh\n",

      "r=(he1-hi1)/(hi2-he2)#the ratio of the mass flow of water\n",

      "T0=298.15#in K\n",

      "S1=1.8418#entropy at state1 in kJ/kgK\n",

      "S2=7.0384#entropy at state2 in kJ/kgK\n",

      "S3=7.8751#entropy at state3 in kJ/kgK\n",

      "S4=7.3173#entropy at state4 in kJ/kgK\n",

      "#phi=phi2-phi1\n",

      "phi=(he1-hi1)-T0*(S2-S1)#The increase in availability of the water is, per kilogram of water in kJ/kg\n",

      "#w=(mp2/mh2)*(phi3-phi4)\n",

      "w=r*((hi2-he2)-T0*(S3-S4))#The decrease in availability of the products, per kilogram of water in kJ/kg\n",

      "eta=phi/w#the second-law efficiency\n",

      "#i=I/mh\n",

      "i=phi+w#the process irreversibility per kilogram of water in kJ/kg\n",

      "#e=I2/mh2\n",

      "e=(T0*(S2-S1)+(T0*r*(S4-S3)))#The total irreversibility in kJ/kg\n",

      "print\"\\n the second law efficiency is \",round(eta,3)\n",

      "print\"\\n the total irreversibility is \",round(e,2),\"kJ/kg\"\n",

      "\n",

      "\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " the second law efficiency is  0.459\n",

        "\n",

        " the total irreversibility is  906.38 kJ/kg\n"

       ]

      }

     ],

     "prompt_number": 17

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.7:pg-403"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 7\n",

      "#calculate the heater\u2019s second-law efficiency\n",

      "\n",

      "h0=104.87#enthalpy in kJ/kg\n",

      "s0=0.3673#entropy in kJ/kg K\n",

      "h1=171.97#in kJ/kg\n",

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

      "s1=0.5705#in kJ/kg K\n",

      "T0=298.2#in C\n",

      "se=2.1341#in kJ/kg K\n",

      "shi1=(h1-h0)-T0*(s1-s0)#in kJ/kg\n",

      "shie=(he-h0)-T0*(se-s0)#in kJ/kg\n",

      "T1=373.2#in C\n",

      "T2=473.2#in C\n",

      "q1=180#heat at state1 in kJ\n",

      "q2=413.28#heat at state2 in kJ\n",

      "phisource1=(1-T0/T1)*q1#in kJ/kg\n",

      "phisource2=(1-T0/T2)*q2#in kJ/kg\n",

      "phisource=phisource1+phisource2#in kJ/kg\n",

      "Icv=phisource+shi1-shie#in kJ/kg\n",

      "eta2law=(phisource-Icv)/phisource#the heater\u2019s second-law efficiency\n",

      "print\"\\n the heater\u2019s second-law efficiency is\",round(eta2law,2)\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " the heater\u2019s second-law efficiency is 0.67\n"

       ]

      }

     ],

     "prompt_number": 53

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex10.8:pg-404"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#example 8\n",

      "#calculate any heat transfer downward, and follow the flux of exergy, and find the exergy destruction in the process.\n",

      "Qout=500.0#in W\n",

      "Qin=500.0#in W\n",

      "Tsurf=1000.0#in K\n",

      "T0=298.15#in K\n",

      "Sgen1=Qout/Tsurf#in W/K\n",

      "phides=(T0*Sgen1)#in W\n",

      "phitrans=((1-T0/Tsurf)*Qout)#in W\n",

      "Ttop=500#in K\n",

      "Sgen2=(Qout/Ttop)-(Qin/Tsurf)#in W/K\n",

      "Te=phitrans-phides-((1-T0/Ttop)*Qout)#the exergy destruction in the process\n",

      "print\"\\n the exergy destruction in the process  is\",round(Te)\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "\n",

        " the exergy destruction in the process  is 0.0\n"

       ]

      }

     ],

     "prompt_number": 77

    }

   ],

   "metadata": {}

  }

 ]

}