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
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 08: Available energy Availability and irreversibility"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.1:pg-249"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.1\n",
"\n",
" The fraction of energy that becomes unavailable due to irreversible heat transfer is 0.260038240918\n"
]
}
],
"source": [
"import math\n",
"T0 = 35.0 # Heat rejection temperature in degree Celsius \n",
"T1 = 420 # Vapor condensation temperature in degree Celsius \n",
"T1_ = 250 # water vapor temperature in degree Celsius \n",
"print \"\\n Example 8.1\"\n",
"f = ((T0+273)*((T1+273)-(T1_+273)))/((T1_+273)*((T1+273)-(T0+273)))# fraction of energy lost\n",
"print \"\\n The fraction of energy that becomes unavailable due to irreversible heat transfer is \",f \n",
"#The answers vary due to round off error\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.2:pg-250"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.2\n",
"\n",
" Total change in entropy is 2.03990232306 kJ/K\n",
"\n",
" Increase in unavailable energy is 618.090403887 kJ\n"
]
}
],
"source": [
"from scipy import integrate\n",
"import math\n",
"\n",
"lhw = 1858.5 # Latent heat of water in kJ/kg\n",
"Tew = 220 # Water evaporation temperature in degree Celsius\n",
" \n",
"Tig = 1100 # Initial temperature of the gas in degree Celsius\n",
"Tfg = 550 # Final temperature of the gas in degree Celsius\n",
"T0 = 303 # Atmospheric temperature in degree Celsius\n",
"Tg2 = 823 \n",
"Tg1 = 1373\n",
"print \"\\n Example 8.2\"\n",
"Sw = lhw/(Tew+273) # Entropy generation in water\n",
"Sg,error = integrate.quad(lambda T:3.38/T,Tg1,Tg2)\n",
"St = Sg+Sw \n",
"print \"\\n Total change in entropy is \",St ,\" kJ/K\"\n",
"\n",
"print \"\\n Increase in unavailable energy is \",T0*St ,\" kJ\"\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.4:pg-253"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.4\n",
"\n",
" The decrease in the available energy is 281.816890623 kJ\n"
]
}
],
"source": [
"import math\n",
"from scipy import integrate\n",
"Ts_ = 15 # Ambient temperature in degree Celsius\n",
"Tw1_ = 95 # Temperature of water sample 1 in degree Celsius\n",
"Tw2_ = 35# Temperature of water sample 2 in degree Celsius\n",
"m1 = 25 # Mass of water sample 1 in kg\n",
"m2 = 35 # Mass of water sample 2 in kg\n",
"cp = 4.2 # Specific heat capacity of water in kJ/kgK\n",
"print \"\\n Example 8.4\"\n",
"Ts = Ts_+273# Ambient temperature in K\n",
"Tw1 = Tw1_+273 # Temperature of water sample 1 in K\n",
"Tw2 = Tw2_+273# Temperature of water sample 2 in K\n",
"AE25,er = integrate.quad(lambda T:m1*cp*(1-(Ts/T)),Ts,Tw1)\n",
"AE35,er2 = integrate.quad(lambda T:m2*cp*(1-(Ts/T)),Ts,Tw2)\n",
"AEt = AE25 + AE35\n",
"Tm = (m1*Tw1+m2*Tw2)/(m1+m2) # Temperature after mixing\n",
"AE60,er3 = integrate.quad(lambda T:(m1+m2)*cp*(1-(Ts/T)),Ts,Tm)\n",
"AE = AEt - AE60\n",
"print \"\\n The decrease in the available energy is \",AE ,\" kJ\"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.5:pg-254"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.5\n",
"\n",
" The final RPM of the flywheel would be 222.168786807 RPM\n"
]
}
],
"source": [
"import math\n",
"from scipy import integrate\n",
"N1 = 3000 # Speed of rotation of flywheel in RPM\n",
"I = 0.54 # Moment of inertia of flywheel in kgm**2\n",
"ti_ = 15 # Temperature of insulated system in degree Celsius \n",
"m = 2 # Water equivalent of shaft \n",
"print \"\\n Example 8.5\"\n",
"w1 = (2*math.pi*N1)/60 # Angular velocity of rotation in rad/s\n",
"Ei = 0.5*I*w1**2 # rotational kinetic energy\n",
"dt = Ei/(1000*2*4.187) # temperature change\n",
"ti = ti_+273# Temperature of insulated system in Kelvin\n",
"tf = ti+dt # final temperature\n",
"AE,er = integrate.quad(lambda T: m*4.187*(1-(ti/T)),ti,tf)\n",
"UE = Ei/1000 - AE # Unavailable enrgy\n",
"w2 = math.sqrt(AE*1000*2/I) # Angular speed in rad/s \n",
"N2 = (w2*60)/(2*math.pi) # Speed of rotation in RPM\n",
"print \"\\n The final RPM of the flywheel would be \",N2 ,\" RPM\"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.6:pg-255"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.6\n",
"\n",
" The maximum work is 122.957271378 kJ\n",
"\n",
" Change in availability is 82.4328713783 kJ\n",
"\n",
" Irreversibility is 15.2572713783 kJ\n"
]
}
],
"source": [
"import math\n",
"from scipy import integrate\n",
"T1_ = 80.0 # Initial temperature of air in degree Celsius \n",
"T2_ = 5.0 # Final temperature of air in degree Celsius \n",
"V2 = 2.0 # Assumed final volume\n",
"V1 = 1.0 # Assumed initial volume\n",
"P0 = 100.0 # Final pressure of air in kPa\n",
"P1 = 500.0 # Initial pressure of air in kPa\n",
"R = 0.287 # Gas constant\n",
"cv = 0.718 # Specific heat capacity at constant volume for gas in kJ/kg K\n",
"m = 2.0 # Mass of gas in kg\n",
"print \"\\n Example 8.6\"\n",
"T1= T1_+273 # Initial temperature of air in K \n",
"T2 = T2_+273 # Final temperature of air in K \n",
"S= integrate.quad(lambda T:(m*cv)/T,T1,T2)[0] + integrate.quad(lambda V: (m*R)/V,V1,V2)[0] # Entropy change\n",
"U = m*cv*(T1-T2)# Change in internal energy\n",
"Wmax = U-(T2*(-S)) # Maximum possible work\n",
"V1_ = (m*R*T1)/P1 # volume calculation\n",
"CA = Wmax-P0*(V1_) # Change in availability\n",
"I = T2*S # Irreversibility\n",
"print \"\\n The maximum work is \",Wmax ,\" kJ\"\n",
"print \"\\n Change in availability is \",CA ,\" kJ\"\n",
"print \"\\n Irreversibility is \",I ,\" kJ\"\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.7:pg-256"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.7\n",
"\n",
" The decrease in availability is 260.756521108 kJ/kg\n",
"\n",
" The maximum work is 260.756521108 kJ/kg\n",
"\n",
" The irreversibility is 49.6565211082 kJ/kg\n",
"\n",
" Alternatively, The irreversibility is 49.6565211082 kJ/kg\n"
]
}
],
"source": [
"import math\n",
"P1 = 500.0 # Initial pressure of steam in kPa\n",
"P2 = 100.0# Final pressure of steam in kPa\n",
"T1_ = 520.0 #Initial temperature of steam in degree Celsius\n",
"T2_ = 300.0 #Final temperature of steam in degree Celsius\n",
"cp = 1.005 # Specific heat capacity of steam in kJ/kgK\n",
"t0 = 20.0 # Atmospheric temperature in degree Celsius \n",
"R = 0.287 # Gas constant\n",
"Q = -10.0 # Heat loss to surrounding in kJ/kg\n",
"print \"\\n Example 8.7\"\n",
"T1 = T1_+273 #Initial temperature of steam in degree Celsius\n",
"T2 = T2_+273 #Final temperature of steam in degree Celsius\n",
"S21 = (R*math.log(P2/P1))-(cp*math.log(T2/T1))\n",
"T0 = t0+273\n",
"CA = cp*(T1-T2)-T0*S21 # Change in availability\n",
"Wmax = CA # Maximum possible work\n",
"W = cp*(T1-T2)+Q # net work\n",
"I = Wmax-W # Irreversibility\n",
"# Altenatively\n",
"Ssystem = -Q/T0\n",
"Ssurr = -S21\n",
"I1 = T0*(Ssystem+Ssurr)\n",
"print \"\\n The decrease in availability is \",CA ,\" kJ/kg\"\n",
"print \"\\n The maximum work is \",Wmax ,\" kJ/kg\"\n",
"print \"\\n The irreversibility is \",I ,\" kJ/kg\"\n",
"print \"\\n Alternatively, The irreversibility is \",I1 ,\" kJ/kg\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.8:pg-258"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.8\n",
"\n",
" The initial and final availbility of the products are 85.9672398469 kJ/Kg and 39.6826771757 kJ/Kg respectively\n",
"\n",
" The irreversibility of the process is 319.369801955 kW\n",
"\n",
" Total power generated by the heat engine is 472.671938045 kW\n"
]
}
],
"source": [
"import math\n",
"T0 = 300.0 # Atmospheric temperature in K\n",
"Tg1_ = 300.0 # Higher temperature of combustion product in degree Celcius\n",
"Tg2_ = 200.0 # Lower temperature of combustion product in degree Celcius\n",
"Ta1 = 40.0 # Initial air temperature in K\n",
"cpg = 1.09 # Specific heat capacity of combustion gas in kJ/kgK\n",
"cpa = 1.005# Specific heat capacity of air in kJ/kgK\n",
"mg = 12.5 # mass flow rate of product in kg/s\n",
"ma = 11.15# mass flow rate of air in kg/s\n",
"\n",
"print \"\\n Example 8.8\"\n",
"Tg1 = Tg1_+273 # Higher temperature of combustion product in K\n",
"Tg2 = Tg2_+273 # Lower temperature of combustion product in K\n",
"f1 = cpg*(Tg1-T0)-T0*cpg*(math.log(Tg1/T0)) # Initial availability of product\n",
"f2 = cpg*(Tg2-T0)-T0*cpg*(math.log(Tg2/T0)) # Final availabilty of product\n",
"print \"\\n The initial and final availbility of the products are \",f1 ,\" kJ/Kg and \",f2 ,\" kJ/Kg respectively\"\n",
"#The answer provided in the textbook is wrong\n",
"\n",
"# Part (b)\n",
"Dfg = f1-f2 # Decrease in availability of products\n",
"Ta2 = (Ta1+273) + (mg/ma)*(cpg/cpa)*(Tg1-Tg2) # Exit temperature of air\n",
"Ifa = cpa*(Ta2-(Ta1+273))-T0*cpa*(math.log(Ta2/(Ta1+273))) # Increase in availability of air\n",
"I = mg*Dfg-ma*Ifa # Irreversibility \n",
"print \"\\n The irreversibility of the process is \",I ,\" kW\"\n",
"##The answer provided in the textbook contains round off error\n",
"\n",
"# Part (c)\n",
"Ta2_ = (Ta1+273)*(Tg1/Tg2)**((12.5*1.09)/(11.5*1.005))\n",
"Q1 = mg*cpg*(Tg1-Tg2) # Heat supply rate from gas to working fluid\n",
"Q2 = ma*cpa*(Ta2_-(Ta1+273))# Heat rejection rate from the working fluid in heat engine\n",
"W = Q1-Q2 # Power developed by heat engine\n",
"print \"\\n Total power generated by the heat engine is \",W ,\" kW\"\n",
"#The answer provided in the textbook contains round off error\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.9:pg-260"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.9\n",
"\n",
" The irreversibility rate is 15.8201795694 kW\n",
"\n",
" The irreversibility rate at lower temperature is 3.03317755354 kW\n"
]
}
],
"source": [
"import math\n",
"T2 = 790.0 # Final temperature of gas in degree Celsius\n",
"T1 = 800.0 # Initial temperature of gas in degree Celsius\n",
"m = 2.0 # Mass flow rate in kg/s\n",
"cp = 1.1 # Specific heat capacity in kJ/KgK\n",
"T0 = 300.0 # Ambient temperature in K\n",
"\n",
"print \"\\n Example 8.9\"\n",
"I = m*cp*(((T1+273)-(T2+273))-T0*(math.log((T1+273)/(T2+273)))) # irreversibility rate\n",
"print \"\\n The irreversibility rate is \",I ,\" kW\"\n",
"\n",
"# At lower temperature\n",
"T1_ = 80.0 # Initial temperature of gas in degree Celsius\n",
"T2_ = 70.0 # Initial temperature of gas in degree Celsius\n",
"I_ = m*cp*(((T1_+273)-(T2_+273))-T0*(math.log((T1_+273)/(T2_+273)))) # irreversibility rate\n",
"print \"\\n The irreversibility rate at lower temperature is \",I_ ,\" kW\"\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.10:pg-261"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.10\n",
"\n",
" The rate of energy loss because of the pressure drop due to friction 25.83 kW\n"
]
}
],
"source": [
"import math\n",
"m = 3 # Mass flow rate in kg/s\n",
"R = 0.287 # Gas constant\n",
"T0 = 300 # Ambient temperature in K\n",
"k = 0.10 # Fractional pressure drop\n",
"print \"\\n Example 8.10\"\n",
"Sgen = m*R*k # Entropy generation\n",
"I = Sgen*T0 # Irreversibility Calculation\n",
"print \"\\n The rate of energy loss because of the pressure drop due to friction \",I ,\" kW\"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.11:pg-261"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.11\n",
"\n",
" The rate of entropy generation is 0.0446035560498 kW/K\n",
"\n",
" The rate of energy loss due to mixing is 13.3810668149 kW\n",
"\n",
" The rate of energy loss due to mixing is 13.3810668149 kW\n"
]
}
],
"source": [
"import math\n",
"m1 = 2.0 # Flow rate of water in kg/s\n",
"m2 = 1.0 # Flow rate of another stream in kg/s\n",
"T1 = 90.0 # Temperature of water in degree Celsius\n",
"T2 = 30.0# Temperature of another stream in degree Celsius\n",
"T0 =300.0 # Ambient temperature in K\n",
"cp = 4.187 # Specific heat capacity of water in kJ/kgK\n",
"\n",
"print \"\\n Example 8.11\"\n",
"m = m1+m2 # Net mass flow rate\n",
"x = m1/m # mass fraction\n",
"t = (T2+273)/(T1+273) # Temperature ratio\n",
"Sgen = m*cp*math.log((x+t*(1-x))/(t**(1-x))) # Entropy generation\n",
"I = T0*Sgen # Irreversibility production\n",
"# Alternatively\n",
"T = (m1*T1+m2*T2)/(m1+m2) # equilibrium temperature\n",
"Sgen1 = m1*cp*math.log((T+273)/(T1+273))+m2*cp*math.log((T+273)/(T2+273))# Entropy generation\n",
"I1 = T0*Sgen1 # Irreversibility production\n",
"print \"\\n The rate of entropy generation is \",Sgen ,\" kW/K\"\n",
"print \"\\n The rate of energy loss due to mixing is \",I ,\" kW\"\n",
"print \"\\n The rate of energy loss due to mixing is \",I1 ,\" kW\" # Calculation from alternative way\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.12:pg-262"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.12\n",
" \n",
"\n",
" PART (A)\n",
"\n",
" The first law efficiency is 96.0 percent\n",
"\n",
" The second law efficiency is 79.0588235294 percent\n",
" \n",
"\n",
" PART (B)\n",
"\n",
" The first law efficiency is 90.0 percent\n",
"\n",
" The second law efficiency is 42.3529411765 percent\n",
" \n",
"\n",
" PART (C)\n",
"\n",
" The first law efficiency is 60.0 percent\n",
"\n",
" The second law efficiency is 4.41176470588 percent\n",
" \n",
"\n",
" PART (D)\n",
"\n",
" The First law efficiency for all the three cases would remain same and here is 90.0 percent\n",
"\n",
" The Second law efficiency of part (a) is 74.1176470588 percent\n",
"\n",
" The Second law efficiency of part (b) is 42.3529411765 percent\n",
"\n",
" The Second law efficiency of part (c) is 6.61764705882 percent\n"
]
}
],
"source": [
"import math\n",
"Qr = 500.0 # Heat release in kW\n",
"Tr = 2000.0 # Fuel burning temperature in K \n",
"T0 = 300.0 # Ambient temperature in K\n",
"# Part (a)\n",
"print \"\\n Example 8.12\"\n",
"Qa = 480.0 # Energy absorption by furnace in kW\n",
"Ta = 1000.0 # Furnace temperature in K \n",
"n1a = (Qa/Qr) # first law efficiency\n",
"n2a = n1a*(1.0-(T0/Ta))/(1.0-(T0/Tr)) #second law efficiency\n",
"\n",
"#The answers vary due to round off error\n",
"print \" \\n\\n PART (A)\"\n",
"print \"\\n The first law efficiency is \",n1a*100 ,\" percent\" \n",
"print \"\\n The second law efficiency is \",n2a*100 ,\" percent\"\n",
"\n",
"# Part (b)\n",
"Qb = 450.0 # Energy absorption in steam generation in kW\n",
"Tb = 500.0# steam generation temperature in K \n",
"n1b = (Qb/Qr)# first law efficiency\n",
"n2b = n1b*(1.0-(T0/Tb))/(1.0-(T0/Tr))#second law efficiency\n",
"print \" \\n\\n PART (B)\"\n",
"print \"\\n The first law efficiency is \",n1b*100 ,\" percent\" \n",
"print \"\\n The second law efficiency is \",n2b*100 ,\" percent\"\n",
"# Part (c)\n",
"Qc = 300.0 # Energy absorption in chemical process in kW\n",
"Tc = 320.0 # chemical process temperature in K \n",
"n1c = (Qc/Qr) # first law efficiency\n",
"n2c = n1c*(1.0-(T0/Tc))/(1.0-(T0/Tr))#second law efficiency\n",
"print \" \\n\\n PART (C)\"\n",
"print \"\\n The first law efficiency is \",n1c*100 ,\" percent\"\n",
"print \"\\n The second law efficiency is \",n2c*100 ,\" percent\" \n",
"# Part (d)\n",
"Qd = 450.0 \n",
"n1d = (Qd/Qr)\n",
"n2a_= n1d*(1.0-(T0/Ta))/(1.0-(T0/Tr))\n",
"n2b_= n1d*(1.0-(T0/Tb))/(1.0-(T0/Tr))\n",
"n2c_= n1d*(1.0-(T0/Tc))/(1.0-(T0/Tr))\n",
"print \" \\n\\n PART (D)\"\n",
"print \"\\n The First law efficiency for all the three cases would remain same and here is \",n1d*100 ,\" percent\" #The answer provided in the textbook is wrong\n",
"\n",
"print \"\\n The Second law efficiency of part (a) is \",n2a_*100 ,\" percent\"\n",
"\n",
"print \"\\n The Second law efficiency of part (b) is \",n2b_*100 ,\" percent\"\n",
"\n",
"print \"\\n The Second law efficiency of part (c) is \",n2c_*100 ,\" percent\"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.14:pg-265"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.14\n",
"\n",
" The power input is -235.675 kW\n",
" \n",
" The second law efficiency of the compressor is 85.5494233193 percent\n"
]
}
],
"source": [
"import math\n",
"cp = 1.005 # Specific heat capacity of air in kJ/kgK \n",
"T2 = 160.0 # Compressed air temperature in degree Celsius\n",
"T1 = 25.0 # Ambient temperature\n",
"T0 = 25.0 # Ambient temperature\n",
"R = 0.287 # Gas constant\n",
"P2 = 8.0 # Pressure ratio\n",
"P1 = 1.0 # Initial pressure of gas in bar\n",
"Q = -100.0 # Heat loss to surrounding in kW\n",
"m = 1.0 # Mass flow rate in kg/s\n",
"\n",
"print \"\\n Example 8.14\"\n",
"W = Q + m*cp*((T1+273)-(T2+273)) # power input\n",
"AF = cp*((T2+273)- (T1+273))-(T0+273)*((cp*math.log((T2+273)/(T1+273))-(R*math.log(P2/P1)))) # Availability\n",
"e = AF/-W # efficiency \n",
"print \"\\n The power input is \",W ,\" kW\"\n",
"print \" \\n The second law efficiency of the compressor is \",e*100 ,\" percent\"\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.15:pg-265"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.15\n",
"\n",
" The exergy of the complete vacuum is 100.0 kJ\n"
]
}
],
"source": [
"import math\n",
"# Since vacuum has zero mass\n",
"U = 0 # Initial internal energy in kJ/kg\n",
"H0 = 0 # Initial enthalpy in kJ/kg\n",
"S = 0 # Initial entropy in kJ/kgK\n",
"# If the vacuum has reduced to dead state\n",
"U0 = 0 # Final internal energy in kJ/kg\n",
"H0 = 0 # Final enthalpy in kJ/kg\n",
"S0 = 0 # Final entropy in kJ/kgK\n",
"V0 = 0 # Final volume in m**3\n",
"P0 = 1.0 # Pressure in bar\n",
"V = 1.0 # Volume of space in m**3\n",
"fi = P0*1e5*V\n",
"\n",
"print \"\\n Example 8.15\"\n",
"print \"\\n The exergy of the complete vacuum is \",fi/1e3 ,\" kJ\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.16:pg-266"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.16\n",
"\n",
" Exergy produced is 34.6210270729 MJ or 9.61695196469 kWh\n"
]
}
],
"source": [
"import math\n",
"m = 1000.0 # Mass of fish in kg \n",
"T0 = 300.0 # Ambient temperature in K\n",
"P0 = 1.0 # Ambient pressure in bar\n",
"T1 = 300.0 # Initial temperature of fish in K\n",
"T2_ = -20.0 # Final temperature of fish in degree Celsius\n",
"Tf_ = -2.2 # Freezing point temperature of fish in degree Celsius\n",
"Cb = 1.7 # Specific heat of fish below freezing point in kJ/kg\n",
"Ca = 3.2 # Specific heat of fish above freezing point in kJ/kg\n",
"Lh = 235.0 # Latent heat of fusion of fish in kJ/kg \n",
"\n",
"print \"\\n Example 8.16\"\n",
"T2 = T2_+273 # Final temperature of fish in K\n",
"Tf = Tf_+273 # Freezing point temperature of fish in K\n",
"H12 = m*((Cb*(Tf-T2))+Lh+(Ca*(T1-Tf))) # Enthalpy change \n",
"H21 = -H12 # Enthalpy change \n",
"S12 = m*((Cb*math.log(Tf/T2))+(Lh/Tf)+(Ca*math.log(T1/Tf))) # Entropy change\n",
"S21 = -S12 # Entropy change\n",
"E = H21-T0*S21 #Exergy produced\n",
"print \"\\n Exergy produced is \",E/1e3 ,\" MJ or \",E/3600 ,\" kWh\"\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.17:pg-267"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.17\n",
"\n",
" The irreversibility in case a is 110.031839359 kJ/kg\n",
"\n",
" The irreversibility in case b is 38.2318393592 kJ/kg\n"
]
}
],
"source": [
"import math\n",
"cv = 0.718 # Specific heat capacity of air in kJ/kg\n",
"T2 = 500.0 # Final temperature of air in K\n",
"T1 = 300.0# Initial temperature of air in K\n",
"m = 1.0 # Mass of air in kg\n",
"T0 = 300.0 # Ambient temperature\n",
"# Case (a)\n",
"print \"\\n Example 8.17\"\n",
"Sua = cv*math.log(T2/T1) # Entropy change of universe\n",
"Ia = T0*Sua # irreversibility\n",
"print \"\\n The irreversibility in case a is \",Ia ,\" kJ/kg\"\n",
"\n",
"# Case (b)\n",
"Q = m*cv*(T2-T1) # Heat transfer\n",
"T = 600 # Temperature of thermal reservoir in K\n",
"Sub = Sua-(Q/T) # Entropy change of universe\n",
"Ib = T0*Sub # irreversibility\n",
"print \"\\n The irreversibility in case b is \",Ib ,\" kJ/kg\"\n",
"#The answers vary due to round off error\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.18:pg-268"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.18\n",
"\n",
" Irreversibility per unit mass is 142.7096 kJ/kg\n",
"\n",
" The second law efficiency of the turbine is 78.0527289547 percent\n"
]
}
],
"source": [
"import math\n",
"h1 = 3230.9 # Enthalpy of steam at turbine inlet in kJ/kg\n",
"s1 = 6.69212# Entropy of steam at turbine inlet in kJ/kgK \n",
"V1 = 160.0 # Velocity of steam at turbine inlet in m/s\n",
"T1 = 400.0 # Temperature of steam at turbine inlet in degree Celsius\n",
"h2 = 2676.1 # Enthalpy of steam at turbine exit in kJ/kg\n",
"s2 = 7.3549 # Entropy of steam at turbine exit in kJ/kgK \n",
"V2 = 100.0 # Velocity of steam at turbine exit in m/s\n",
"T2 = 100.0 # Temperature of steam at turbine exit in degree Celsius\n",
"T0 = 298.0 # Ambient temperature in K\n",
"W = 540.0 # Work developed by turbine in kW\n",
"Tb = 500.0 # Average outer surface temperature of turbine in K\n",
"\n",
"print \"\\n Example 8.18\"\n",
"Q = (h1-h2)+((V1**2-V2**2)/2)*1e-03-W # Heat loss\n",
"I = 151.84-Q*(0.404) # Irreversibility \n",
"AF = W + Q*(1.0-(T0/Tb)) + I # Exergy transfer\n",
"n2 = W/AF # second law efficiency\n",
"\n",
"print \"\\n Irreversibility per unit mass is \",I ,\" kJ/kg\"\n",
"print \"\\n The second law efficiency of the turbine is \",n2*100 ,\" percent\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.19:pg-269"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.19\n",
"\n",
" Case A:\n",
"\n",
" Rate of availability transfer with heat and the irreversibility rate are \n",
" 1.7 kW and -6.8 kW respectively.\n",
"\n",
" Case B:\n",
"\n",
" Rate of availability in case b is 3.4 kW \n"
]
}
],
"source": [
"import math\n",
"T0 = 300.0 # Ambient temperature in K\n",
"T = 1500.0 # Resistor temperature in K\n",
"Q = -8.5 # Power supply in kW\n",
" \n",
"# Case (a)\n",
"W = -Q # work transfer\n",
"I = Q*(1.0-T0/T) + W # Irreversibility\n",
"R = Q*(1.0-T0/T) # availability\n",
"\n",
"print \"\\n Example 8.19\"\n",
"print \"\\n Case A:\"\n",
"print \"\\n Rate of availability transfer with heat and the irreversibility rate are \\n \",I ,\" kW and \",R ,\" kW respectively.\"\n",
"# Case (b)\n",
"T1 = 500.0 # Furnace wall temperature\n",
"Ib = - Q*(1.0-T0/T) + Q*(1.0-T0/T1) # Irreversibility\n",
"print \"\\n Case B:\"\n",
"print \"\\n Rate of availability in case b is \",Ib ,\" kW \"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Ex8.20:pg-270"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" Example 8.20\n",
"\n",
"\n",
" Part A:\n",
"\n",
" There is heat loss to surrounding.\n",
"\n",
"\n",
" Part B:\n",
"\n",
" The polytropic index is 1.0\n",
"\n",
"\n",
" Part C:\n",
"\n",
" Isothermal efficiency is 97.8793558312 percent \n",
"\n",
"\n",
" Part D:\n",
"\n",
" The minimum work input is -6.44697949667 kJ/kg, and irreversibility is 108.941520503 kJ/kg\n",
"\n",
"\n",
" Part E:\n",
"\n",
" Second law efficiency is 6.0 percent\n"
]
}
],
"source": [
"import math\n",
"p1 = 1 # Air pressure at compressure inlet in bar\n",
"t1 = 30 # Air temperature at compressure inlet in degree Celsius\n",
"p2 = 3.5 # Air pressure at compressure exit in bar\n",
"t2 = 141 # Air temperature at compressure exit in degree Celsius\n",
"v = 90 # Air velocity at compressure exit in m/s\n",
"cp = 1.0035 # Specific heat capacity of air in kJ/kg\n",
"y = 1.4 # Heat capacity ratio\n",
"R = 0.287 # Gas constant\n",
"print \"\\n Example 8.20\\n\"\n",
"T2s = (t1+273)*(p2/p1)**((y-1)/y)\n",
"if T2s>(t2+273): \n",
" print \"\\n Part A:\"\n",
" print \"\\n There is heat loss to surrounding.\"\n",
"n =(1/(1-((math.log((t2+273)/(t1+273)))/(math.log(p2/p1)))))\n",
"print \"\\n\\n Part B:\"\n",
"print \"\\n The polytropic index is \",n\n",
"Wa = cp*(t1-t2)-(v**2)/2000 # Actual work \n",
"Wt = -R*(t1+273)*math.log(p2/p1) - (v**2)/2000 # Isothermal work\n",
"nt =Wt/Wa # Isothermal efficency\n",
"print \"\\n\\n Part C:\"\n",
"print \"\\n Isothermal efficiency is \",nt*100 ,\" percent \"\n",
"df = cp*(t1-t2) + (t1+273)*(R*math.log(p2/p1) - cp*math.log((t2+273)/(t1+273))) -(v**2)/2000\n",
"Wm = df # Minimum work input\n",
"I = Wm-Wa # Irreversibility\n",
"\n",
"print \"\\n\\n Part D:\"\n",
"print \"\\n The minimum work input is \",Wm,\" kJ/kg, and irreversibility is \",I ,\" kJ/kg\"\n",
"# The answers given in the book contain round off error\n",
"\n",
"neta = Wm/Wa\n",
"print \"\\n\\n Part E:\"\n",
"print \"\\n Second law efficiency is \",math. ceil(neta*100) ,\" percent\"\n",
"\n"
]
}
],
"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.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|