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
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
|
{
"metadata": {
"name": "",
"signature": "sha256:009f400f836702cde3e9c0f5d144589b0ec3eb912d883ee490ce810f95fed24c"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 06:SECOND LAW OF THERMODYNAMICS AND ENTROPY"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.1, Page No:259"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"QH=500; # Heat supplied in kJ\n",
"QL=200; # Heat rejected in kJ\n",
"TH=720; # Resorvior Temperature in kelvin\n",
"TL=360; # Resorvior Temperature in kelvin\n",
"W=260; # Work developed in kJ\n",
"\n",
"#Calculation\n",
"e_max=1-TL/TH; # maximum efficiency\n",
"e_clamied=W/QH; # Efficiency clamied\n",
"\n",
"#Result\n",
"if e_clamied<e_max:\n",
" print \"It obeys the second law of thermodynamics.The claim is true\"\n",
"else:\n",
" print \"It violates the second law of thermodynamics.The claim is False\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"It violates the second law of thermodynamics.The claim is False\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.2, Page No:260"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"QH=325; # Heat supplied in kJ\n",
"QL=125; # Heat rejected in kJ\n",
"TH=1000; # Resorvior Temperature in kelvin\n",
"TL=400; # Resorvior Temperature in kelvin\n",
"W=200; # Work developed in kJ\n",
"\n",
"#Calculation\n",
"e_carnot=1-TL/TH; # maximum efficiency\n",
"e_clamied=W/QH; # Efficiency clamied\n",
"\n",
"#Result\n",
"print \"e_carnot =\",e_carnot\n",
"print \"e_clamied=\",round(e_clamied,3) \n",
"if e_carnot==e_clamied:\n",
" print \"\\nThe machine is reversible\"\n",
"elif e_carnot>e_clamied:\n",
" print \"\\nThe machine is irreversible\"\n",
"else:\n",
" print \"\\nHere e_clamied > e_carnot so the cyclic machine is impossible.\"\n",
"\n",
"print \"It would be reversible if its thermal efficiency is equal to Carnot efficiency,\"\n",
"print \"and irreversible if it is less than Carnot efficiency.\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"e_carnot = 0.6\n",
"e_clamied= 0.615\n",
"\n",
"Here e_clamied > e_carnot so the cyclic machine is impossible.\n",
"It would be reversible if its thermal efficiency is equal to Carnot efficiency,\n",
"and irreversible if it is less than Carnot efficiency.\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.3, Page No:260"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"# Air conditioning unit\n",
"TL=278; # Operating temperature in kelvin\n",
"TH=318; # Operating temperature in kelvin\n",
"\n",
"#Calculation\n",
"COP1=TL/(TH-TL); # COP of Air conditioning unit\n",
"QL=1; # For some calculation purpose\n",
"W1=QL/COP1; # Work input of Air conditioning unit\n",
"# Food refrigeration unit\n",
"TL=258; # Operating temperature in kelvin\n",
"TH=318; # Operating temperature in kelvin\n",
"COP2=TL/(TH-TL); # COP of Food refrigeration unit\n",
"W2=QL/COP2; # Work input of Food refrigeration unit\n",
"Wper=(W2-W1)/W1; # Increase in work input\n",
"\n",
"#Result\n",
"print \"Increase in work input = \",round(Wper*100,0),\"%\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Increase in work input = 62.0 %\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.4, Page No:261"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"#(a).Summer air conditioning (cooling)\n",
"TL=298; # Operating temperature in kelvin\n",
"TH=318; # Operating temperature in kelvin\n",
"q=0.75; # Heat Transfer from fabric of room per degree of temperature difference in kW\n",
"\n",
"#Calculation for (a)\n",
"QL=q*(TH-TL); # Heat Transfer from fabric of room\n",
"COPc=TL/(TH-TL); # COP of Air conditioning unit\n",
"W=QL/COPc; # Work input of Air conditioning unit\n",
"\n",
"#Result for (a)\n",
"print \"(a).Summer air conditioning (cooling)\",\"\\nWork input of Air conditioning unit = \",round(W,0),\"kW\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).Winter air conditioning (recerse cycle heating)\n",
"TH=293; # Operating temperature in kelvin\n",
"TL=(-(-2*q*TH)-math.sqrt ((-2*q*TH)**2-(4*q*(q*TH**2-TH))))/(2*q);# Lowest outdoor Temperature by root\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).Winter air conditioning (recerse cycle heating)\",\"\\nLowest outdoor Temperature = \",round(TL,0),\"K\"\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Summer air conditioning (cooling) \n",
"Work input of Air conditioning unit = 1.0 kW\n",
"\n",
"(b).Winter air conditioning (recerse cycle heating) \n",
"Lowest outdoor Temperature = 273.0 K\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.5, Page No:263"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"# (a).For the refrigerator \n",
"TL=258; # Operating temperature in kelvin\n",
"TH=313; # Operating temperature in kelvin\n",
"QL=3.5167; # Ton of refrigeration in kW\n",
"\n",
"#Calculation for(a)\n",
"COP=TL/(TH-TL); # COP of Refrigeration unit\n",
"W=QL/COP; # Power comsumption of refrigerator\n",
"\n",
"#Result for (a)\n",
"print \"(a).For the refrigerator\",\"\\nPower comsumption of refrigerator = \",round(W,2),\"kW\"\n",
"\n",
"#calculation for (b)\n",
"# (b). For the freezer\n",
"TL=248; # Operating temperature in kelvin\n",
"TH=313; # Operating temperature in kelvin\n",
"COP=TL/(TH-TL); # COP of Freezer unit\n",
"QL=W*COP; # Refrigeration produced\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b). For the freezer\",\"\\nRefrigeration produced = \",round(QL,3),\"kW\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).For the refrigerator \n",
"Power comsumption of refrigerator = 0.75 kW\n",
"\n",
"(b). For the freezer \n",
"Refrigeration produced = 2.86 kW\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.6, Page No:277"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"Psat=200;#Pressure of water in kPa\n",
"Tsat=393.38; # Saturation temperaure at Psat in kelvin\n",
"# (i).From the equation Tds=du+pdv \n",
"# Following are from steam table at Psat\n",
"ufg=2025; # specific internal energy of vapourization in kJ/kg\n",
"vg=0.8857; # specific volume in m^3/kg\n",
"vf=0.001061; # specific volume in m^3/kg\n",
"\n",
"#Calculation for (i)\n",
"sfg=(ufg/Tsat)+(Psat*(vg-vf)/Tsat); # specific entropy of vapourization\n",
"\n",
"#Result for (i)\n",
"print \"(i).From the equation Tds=du+pdv \",\"\\nspecific entropy of vapourization = \",round(sfg,4),\"kJ/kg K\"\n",
"\n",
"#Calculation for (ii)\n",
"# (ii).From the equation Tds=dh-vdp\n",
"hfg=2201.9; # Specific enthalpy of vapourization in kJ/kg\n",
"sfg=hfg/Tsat; # specific entropy of vapourization\n",
"\n",
"#Result for (ii)\n",
"print \"\\n(ii).From the equation Tds=dh-vdp \",\"\\nspecific entropy of vapourization = \",round(sfg,4),\"kJ/kg K\"\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i).From the equation Tds=du+pdv \n",
"specific entropy of vapourization = 5.5975 kJ/kg K\n",
"\n",
"(ii).From the equation Tds=dh-vdp \n",
"specific entropy of vapourization = 5.5974 kJ/kg K\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.7, Page No:277"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"p1=1; # Pressure of steam at state 1 in bar\n",
"T=473; # Temperature of steam at state 1 in kelvin\n",
"\n",
"#Calculation for (i)\n",
"# (i).Pressure after compression\n",
"p2=1.5538; # Pressure after compression at (Psat)T from steam table in MPa\n",
"\n",
"#Result for (i)\n",
"print \"(i).Pressure after compression\",\"\\nPressure after compression = \",p2,\"MPa\"\n",
"\n",
"#Calcultion for (ii)\n",
"# (ii).Heat Transfer and work done during the process\n",
"# Following are from steam table \n",
"s2=6.4323; # specific entropy of steam at state 2 in kJ/kg K\n",
"s1=7.8343; # specific entropy of steam at state 1 in kJ/kg K\n",
"u2=2595.3; # specific internal energy of steam at state 2 in kJ/kg \n",
"u1=2658.1; # specific internal energy of steam at state 1 in kJ/kg \n",
"q=T*(s2-s1); # Heat transfer during the process\n",
"w=q-(u2-u1); # Work done during the process\n",
"\n",
"#Result for (ii)\n",
"print \"\\n(ii).Heat Transfer and work done during the process\",\"\\nHeat transfer during the process = \",round(q,0),\"kJ\"\n",
"print \"Work done during the process = \",round(w,1),\"kJ\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i).Pressure after compression \n",
"Pressure after compression = 1.5538 MPa\n",
"\n",
"(ii).Heat Transfer and work done during the process \n",
"Heat transfer during the process = -663.0 kJ\n",
"Work done during the process = -600.3 kJ\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.8, Page No:278"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"p1=6; # Initial pressure of steam in MPa\n",
"T1=500; # Initial temperature of steam in degree celcius\n",
"p2=10; # Final pressure of steam in bar\n",
"# From steam tables\n",
"s1=6.8803; sf2=1.3026; sfg2=6.0568; # specific entropy in kJ/kg K\n",
"u1=3082.2; uf2=761.68; ufg2=1822; # specific internal energy in kJ/kg\n",
"v1=0.05665; vf2=0.001043; vg2=1.694; # specific volume in m^3/kg\n",
"\n",
"#Calculation\n",
"x2=(v1-vf2)/(vg2-vf2);# Quality of steam\n",
"u2=uf2+x2*ufg2; # specific internal energy in kJ/kg \n",
"s2=sf2+x2*sfg2; # specific entropy in kJ/kg K\n",
"s21=s2-s1; # Entropy change\n",
"q=u2-u1; # Heat transfer\n",
"\n",
"#Result\n",
"print \"Entropy change of the process = \",round(s21,3),\"kJ/kg\",\"\\nHeat transfer for the process =\",round(q,1),\"kJ\"\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entropy change of the process = -5.379 kJ/kg \n",
"Heat transfer for the process = -2260.7 kJ\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.10, Page No:280"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"p1=3; # initial pressure of air in bar\n",
"T1=200; # initial temperature of air in degree celcius\n",
"p2=1.5; # final pressure of air in bar\n",
"T2=105; # final temperature of air in degree celcius\n",
"Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
"R=0.287; # characteristic gas constant of air in kJ/kg K\n",
"\n",
"#Calculation\n",
"delta_s= Cpo*math.log ((T2+273)/(T1+273))- R*math.log (p2/p1) # change in entropy during irreversible process\n",
"#The value of p2 is taken as wrong in the textbook\n",
"\n",
"#Result\n",
"print \"change in entropy during irreversible process = \",round(delta_s,4),\"kJ/kg K (Answer in the textbook was wrong)\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"change in entropy during irreversible process = -0.0261 kJ/kg K (Answer in the textbook was wrong)\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.11, Page No:281"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"p1=5; # Initial pressure of argon gas in bar\n",
"T1=30; # Initial temperature of argon gas in degree celcius\n",
"v1=1; # Initial volume of argon gas in m^3 by assumption\n",
"v2=2*v1; # Final volume of argon gas in m^3\n",
"R=8.3144/40; # Characteristic gas constant of argon gas in kJ/kg K\n",
"\n",
"#Calculation\n",
"p2=p1*(v1/v2); # Final pressure of argon gas\n",
"delta_s= R*math.log (v2/v1); # change in entropy (choosing the reversible isothermal path)\n",
"\n",
"#Result\n",
"print \"Final pressure of argon gas =\",p2,\"bar\"\n",
"print \"change in entropy (choosing the reversible isothermal path) = \",round(delta_s,4),\"kJ/kg K\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Final pressure of argon gas = 2.5 bar\n",
"change in entropy (choosing the reversible isothermal path) = 0.1441 kJ/kg K\n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.12, Page No:284"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"p1=1; # Atmospheric pressure in bar\n",
"T1=348; # Atmospheric temperature in kelvin\n",
"V1=800; # Volume of air sucked into the cylinder in cm^3\n",
"p2=15; # pressure of air after compression in bar\n",
"V2=V1/8; # volume of air after compression in cm^3\n",
"p3=50; # pressure of air after heat addition in bar\n",
"Cvo=0.7165; # Specific heat at constant volme in kJ/kg K\n",
"R=0.287; # characteristic gas constant of air in kJ/kg K\n",
"\n",
"#Calculation for (a)\n",
"# (a).Index of compression process\n",
"n=math.log (p2/p1)/math.log (V1/V2); # Index of compression process\n",
"\n",
"#Result for (a)\n",
"print \"(a).Index of compression process\"\n",
"print \"Index of compression process = \",round(n,1),\" which is less than 1.4. The compression process is polytropic.\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).Change in entropy of air during each process\n",
"m=(p1*10**2*V1*10**-6)/(R*T1); # Mass of air in cylinder\n",
"T2=T1*(p2/p1)*(V2/V1); # Temperature after compression\n",
"T3=T2*(p3/p2); # Temperature after heat addition\n",
"delta_s21=m*(Cvo*math.log (T2/T1)+R*math.log (V2/V1)); # change in entropy during compression\n",
"delta_s32=m*Cvo*math.log (T3/T2); #change in entropy during heat addition\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).Change in entropy of air during each process\"\n",
"print \"change in entropy during compression = (Error in textbook)\",round(delta_s21,6),\"kJ/K\"\n",
"print \"change in entropy during heat addition = (Error in textbook)\",round(delta_s32,6),\"kJ/K\"\n",
"\n",
"#Calculation for (c)\n",
"# (c).Heat transfer during polytropic compression process\n",
"k=1.4;# Index of isentropic preocess\n",
"Q=m*Cvo*((k-n)/(1-n))*(T2-T1); # Heat transfer during polytropic compression process\n",
"\n",
"#Result for (c)\n",
"print \"\\n(c).Heat transfer during polytropic compression process\"\n",
"print \"Heat transfer during polytropic compression process = (Error in textbook)\",round(Q,4),\"kJ\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Index of compression process\n",
"Index of compression process = 1.3 which is less than 1.4. The compression process is polytropic.\n",
"\n",
"(b).Change in entropy of air during each process\n",
"change in entropy during compression = (Error in textbook) -0.000117 kJ/K\n",
"change in entropy during heat addition = (Error in textbook) 0.000691 kJ/K\n",
"\n",
"(c).Heat transfer during polytropic compression process\n",
"Heat transfer during polytropic compression process = (Error in textbook) -0.0565 kJ\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.13, Page No:287"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"p1=0.3; # initial pressure of ateam in MPa\n",
"T1=350; # Initial temperature of steam in degree celcius\n",
"# following are the values taken from steam table for initial state \n",
"v1=0.9535; # specific volume in m^3/kg\n",
"u1=2886.2; # specific internal energy in kJ/kg\n",
"s1=7.868; # specific entropy in kJ/kg K\n",
"v2=2*v1; # final specific volume of steam\n",
"u2=u1;\n",
"# following are the values taken from steam table final state\n",
"T2=349; # Final temperature of steam in degree celcius\n",
"p2=0.167; # Final pressure of ateam in MPa\n",
"s2=8.164; # specific entropy in kJ/kg K\n",
"\n",
"#Calculation\n",
"delta_s=s2-s1; # Entropy generation\n",
"LW=(T1+T2)/2 * delta_s; # Lost work\n",
"\n",
"#Result\n",
"print \"Entropy Generation =\",round(delta_s,3),\"kJ/kg K\",\"\\nLost work = \",round(LW,1),\"kJ\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entropy Generation = 0.296 kJ/kg K \n",
"Lost work = 103.5 kJ\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.15, Page No:291"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"m=1; # Mass of water in kg\n",
"T1=300; # Temperature of water in kelvin\n",
"C=4.1868; # Specific heat in kJ/kg K\n",
"# (a). Heat Transfer\n",
"T2=500; # Temperature of heat reservoir in kelvin\n",
"\n",
"#Calculation for (a)\n",
"Q=m*C*(T2-T1); # Heat transfer\n",
"del_Swater=m*C*math.log (T2/T1); # Entropy change of water\n",
"del_Sreservoir=-Q/T2; # Entropy change of reservoir\n",
"del_Suniverse=del_Swater+del_Sreservoir; # Entropy change of universe\n",
"\n",
"#Result for (a)\n",
"print \"(a).Heat Transfer\",\"\\nEntropy change of universe =\",round(del_Suniverse,4),\"kJ/K\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).Heat Transfer in each reservoir\n",
"T2=400; # Temperature of intermediate reservoir in kelvin\n",
"T3=500; # Temperature of heat reservoir in kelvin\n",
"Q=m*C*(T3-T2); # Heat transfer\n",
"del_Swater=m*C*(math.log (T2/T1)+math.log (T3/T2)); # Entropy change of water\n",
"del_SreservoirI=-Q/T2; # Entropy change of reservoir I\n",
"del_SreservoirII=-Q/T3; # Entropy change of reservoir II\n",
"del_Suniverse=del_Swater+del_SreservoirI+del_SreservoirII; # Entropy change of universe\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).Heat Transfer in each reservoir\",\"\\nEntropy change of universe =\",round(del_Suniverse,5),\"kJ/K\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Heat Transfer \n",
"Entropy change of universe = 0.464 kJ/K\n",
"\n",
"(b).Heat Transfer in each reservoir \n",
"Entropy change of universe = 0.25466 kJ/K\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.16, Page No:292"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"m=1; # Mass of saturated steam in kg\n",
"T=100; # Teamperature of steam in degree celcius\n",
"T0=303; # temperature of Surroundings in kelvin\n",
"hfg=2257; # Latent heat of evaporation in kJ/kg\n",
"sfg=6.048; # specific entropy in kJ/kg K\n",
"\n",
"#Calculation for (a)\n",
"# (a).Entropy change\n",
"Q=m*hfg; # Heat transfer\n",
"del_Ssystem=-m*sfg; # Change of entropy of system\n",
"del_Ssurr=Q/T0; # Change of entropy of surroundings\n",
"del_Suniverse=del_Ssystem+del_Ssurr; # Change of entropy of universe\n",
"\n",
"#Ressult for (a)\n",
"print \"(a).Entropy change\",\"\\nChange of entropy of system =\",del_Ssystem,\"kJ/K\"\n",
"print \"Change of entropy of surroundings =\",round(del_Ssurr,4),\"kJ/K\"\n",
"print \"Change of entropy of universe =\",round(del_Suniverse,4),\"kJ/K\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).Effect of heat transfer\n",
"del_Suniverse=0; # process is reversible\n",
"del_Ssurr=del_Suniverse-del_Ssystem; #Change of entropy of surroundings\n",
"QH=hfg; # Heat transfer from the condensing steam to reversible heat engine\n",
"QL=T0*del_Ssurr; # Heat receiveded by the surroundins reversible heat engine\n",
"W=QH-QL; #work output of reversible heat engine\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).Effect of heat transfer\",\"\\nHeat transfer from the condensing steam to reversible heat engine =\",QH,\"kJ\"\n",
"print \"Heat receiveded by the surroundins reversible heat engine =\",round(QL,1),\"kJ\"\n",
"print \"work output of reversible heat engine =\",round(W,1),\"kJ\"\n",
"print \"Difference between QH & QL is converted into work output in a reversible cyclic process\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Entropy change \n",
"Change of entropy of system = -6.048 kJ/K\n",
"Change of entropy of surroundings = 7.4488 kJ/K\n",
"Change of entropy of universe = 1.4008 kJ/K\n",
"\n",
"(b).Effect of heat transfer \n",
"Heat transfer from the condensing steam to reversible heat engine = 2257 kJ\n",
"Heat receiveded by the surroundins reversible heat engine = 1832.5 kJ\n",
"work output of reversible heat engine = 424.5 kJ\n",
"Difference between QH & QL is converted into work output in a reversible cyclic process\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.17, Page No:293"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"m=1; # Mass of ice in kg\n",
"T1=258;# Temperature of ice in kelvin\n",
"Tm=273; # Melting point of ice in kelvin\n",
"T2=303; # temperature of Surroundings in kelvin\n",
"Cpice=2.095; # Specific heat of ice in kJ/kg K\n",
"hsg=333.5; # Latent heat of fusion in kJ/kg\n",
"Cpw=4.1868; # Specific heat of water in kJ/kg K\n",
"\n",
"#Calculation for (a)\n",
"# (a).Change of entropy\n",
"Q=m*(Cpice*(Tm-T1)+hsg+Cpw*(T2-Tm));# Heat transfer\n",
"del_Ssystem=m*((Cpice*math.log (Tm/T1))+(hsg/Tm)+(Cpw*math.log (T2/Tm)));# Change of entropy of system\n",
"del_Ssurr=-Q/T2; # Change of entropy of surroundings\n",
"del_Suniverse=del_Ssystem+del_Ssurr; # Change of entropy of universe\n",
"\n",
"#Result for (a)\n",
"print \"(a).Entropy change\",\"\\nChange of entropy of system =\",round(del_Ssystem,4),\"kJ/K\"\n",
"print \"Change of entropy of surroundings =\",round(del_Ssurr,4),\"kJ/K\"\n",
"print \"Change of entropy of universe =\",round(del_Suniverse,4),\"kJ/K\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).The minimum work of restoring water back to ice\n",
"QL=Q; # Refrigerating effect\n",
"W=T2*del_Ssystem-QL; # The minimum work of restoring water back to ice\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).The minimum work of restoring water back to ice = \",round(W,1),\"kJ\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Entropy change \n",
"Change of entropy of system = 1.7765 kJ/K\n",
"Change of entropy of surroundings = -1.6189 kJ/K\n",
"Change of entropy of universe = 0.1576 kJ/K\n",
"\n",
"(b).The minimum work of restoring water back to ice = 47.8 kJ\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.18, Page No:297"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"TA=323;# Temperature at section A in kelvin\n",
"PA=125; # Pressure at section A in kPa\n",
"TB=287;# Temperature at section B in kelvin\n",
"PB=100; # Pressure at section B in kPa\n",
"Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
"R=0.287; # characteristic gas constant of air in kJ/kg K\n",
"\n",
"#Calculation\n",
"SBA=(Cpo*math.log (TB/TA))-(R*math.log (PB/PA)); # Change in entropy\n",
"\n",
"#Result\n",
"print \"Change in entropy from B to A =\",SBA,\"kJ/kg (Error in Textbook)\",\"\\nHence SA>SB. Therefore B to A\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Change in entropy from B to A = -0.054541503612 kJ/kg (Error in Textbook) \n",
"Hence SA>SB. Therefore B to A\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.19, Page No:298"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"p1=12.5; # Pressure of steam at inlet in MPa\n",
"T1=500; # Temperature of steam at inlet in degree celcius\n",
"V1=50; # Velocity of steam at inlet in m/s\n",
"p2=10; # Pressure of steam at outlet in kPa\n",
"V2=100; # Velocity of steam at outlet in m/s\n",
"# (a).Actual expansion\n",
"x2=0.85; # Quality of steam\n",
"# From steam table\n",
"h1=3341.8; hf2=191.83; hg2=2584.7; # specific enthalpy in kJ/kg \n",
"s1=6.4618; sf2=0.6493; sfg2=7.5009; # specific entropy in kJ/kg K\n",
"\n",
"#Calculation for (a)\n",
"h2a=(1-x2)*hf2+x2*hg2; # specific enthalpy in kJ/kg \n",
"wa=(h1-h2a)+((V1**2-V2**2)/2000); # Actual work output\n",
"\n",
"#Result for (a)\n",
"print \"(a).Actual work output of turbine = \",round(wa,2),\"kJ\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).Reversible adiabatic expansion\n",
"x2s=(s1-sf2)/sfg2; # Quality of steam after reversible adiabatic expansion\n",
"h2s=(1-x2s)*hf2+x2s*hg2; # specific enthalpy in kJ/kg \n",
"ws=(h1-h2s)+((V1**2-V2**2)/2000); # Reversible adiabatic work output\n",
"L=ws-wa; # Lost of work\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).Reversible adiabatic expansion\",\"\\nReversible adiabatic work output = \",round(ws,1),\"kJ/kg\"\n",
"print \"Lost of work due to irreversibity of expansion process =\",round(L,1),\"kJ/kg\"\n",
"\n",
"#Calculation for (c)\n",
"# (c).Entropy Generation\n",
"s2a=sf2+x2*sfg2; # actual specific entropy in kJ/kg K\n",
"Sgen=s2a-s1; # Entropy generation\n",
"\n",
"#Reult for (c)\n",
"print \"\\n(c).Entropy Generation =\",round(Sgen,4),\"kJ/kg K\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Actual work output of turbine = 1112.28 kJ\n",
"\n",
"(b).Reversible adiabatic expansion \n",
"Reversible adiabatic work output = 1292.0 kJ/kg\n",
"Lost of work due to irreversibity of expansion process = 179.7 kJ/kg\n",
"\n",
"(c).Entropy Generation = 0.5633 kJ/kg K\n"
]
}
],
"prompt_number": 17
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.20, Page No:302"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"p1=0.1; # pressure at state 1 in MPa\n",
"p2=6; # Pressure at state 2 in MPa\n",
"# (a).Pump work for water\n",
"vf1=0.001043; # specific volume in m^3/kg\n",
"\n",
"#Calculation for (a)\n",
"wp=-vf1*(p2-p1)*10**3; # Pump work for water\n",
"\n",
"#Result for (a)\n",
"print \"(a).Pump work for water =\",round(wp,2),\"kJ\"\n",
"\n",
"\n",
"#Variable declaration for (b)\n",
"# (b).For steam\n",
"h1=2675.5;# specific enthalpy in kJ/kg \n",
"s1=7.3595;# specific entropy in kJ/kg K\n",
"# From superheated steam table\n",
"t2=675; # Temperature at state 2 in degree celcius\n",
"h2=3835.3;# specific enthalpy in kJ/kg \n",
"\n",
"#Calculation for (b)\n",
"wc=-(h2-h1); # Compressor work for steam\n",
"\n",
"#Result for (b)\n",
"print \"(b).Compressor work for steam =\",wc,\"kJ/kg\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Pump work for water = -6.15 kJ\n",
"(b).Compressor work for steam = -1159.8 kJ/kg\n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 6.21, Page No:303"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"# (a).Restoring to initial state by throttling process\n",
"T1=303; #Temperature of air at state 1 in kelvin\n",
"p1=1; #Pressure of air at state 1 in bar\n",
"p2=5; #Pressure of air at state 2 in bar\n",
"p3=1;#Pressure of air at state 3 in bar\n",
"T3=303; #Temperature of air at state 3 in kelvin\n",
"Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
"R=0.287; # characteristic gas constant of air in kJ/kg K\n",
"k=1.4; # Index of reversible adiabatic compression\n",
"\n",
"#Calculation for (a)\n",
"T2=T1*(p2/p1)**((k-1)/k); # Temperature after reversible adiabatic compression\n",
"w12=Cpo*(T2-T1); # Work of reversible adiabatic compression\n",
"s21=0; # Entropy change of air\n",
"s32=-R*math.log (p3/p2); # Entropy change \n",
"s31=s32; # Net entropy change of air\n",
"d_Ssurr=0; # Entropy change of surroundings because There is no heat transfer\n",
"d_Suniv=s31+d_Ssurr; # Net Entropy change of universe\n",
"\n",
"#Result for (a)\n",
"print \"(a).Restoring to initial state by throttling process\",\"\\nWork of reversible adiabatic compression = \",round(w12,1),\"kJ/kg\"\n",
"print \"Net Entropy change of universe = \",round(d_Suniv,4),\"kJ/kg K\"\n",
"\n",
"#Calculation for (b)\n",
"# (b).Restoring to initial state by by completing cycle\n",
"T0=298; # Temperature of surroundings in kelvin\n",
"d_Ssystem=0; # Entropy change of systrem is zero because it is cyclic process\n",
"q31=Cpo*(T2-T3); # Heat rejected to the surroundings\n",
"d_Ssurr=q31/T0; # Entropy change of surroundings\n",
"d_Suniv=d_Ssystem+d_Ssurr; # Increase in entropy of the universe\n",
"\n",
"#Result for (b)\n",
"print \"\\n(b).Restoring to initial state by by completing cycle\",\"\\nNet Entropy change of universe = \",round(d_Suniv,3),\"kJ/kg K\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(a).Restoring to initial state by throttling process \n",
"Work of reversible adiabatic compression = 177.5 kJ/kg\n",
"Net Entropy change of universe = 0.4619 kJ/kg K\n",
"\n",
"(b).Restoring to initial state by by completing cycle \n",
"Net Entropy change of universe = 0.596 kJ/kg K\n"
]
}
],
"prompt_number": 19
}
],
"metadata": {}
}
]
}
|