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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 4 : Second Law of Thermodynamics"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.1, Page no:90"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate the maximum efficiency\n",
"\n",
"# Variables\n",
"#Given:\n",
"T1 = 700.; \t\t\t#temperature of heat source(K)\n",
"T2 = 300.; \t\t\t#temperature of heat sink(K)\n",
"\n",
"# Calculations\n",
"#To calculate the maximum efficiency\n",
"eff=((T1-T2)/T1); \t\t\t#efficiency of a heat engine\n",
"\n",
"# Results\n",
"print 'Maximum efficiency of heat engine is %f'%eff\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Maximum efficiency of heat engine is 0.571429\n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.2, Page no:90"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine minimum amount of work done and heat given to surrounding\n",
"\n",
"# Variables\n",
"#Given:\n",
"m = 1.; \t\t\t#mass of water(kg)\n",
"T1 = 300.; \t\t\t#temperature of surrounding(K)\n",
"T2 = 273.; \t\t\t#temperature of water(K)\n",
"Hf = 334.11; \t\t\t#latent heat of fusion of ice(kJ/kg)\n",
"\n",
"# Calculations and Results\n",
"#To determine minimum amount of work and heat given upto surrounding\n",
"#(a)\n",
"Q2 = m*Hf; \t\t\t#heat absobed at temperature T2\n",
"W = ((Q2*(T1-T2))/T2); \t\t\t#minimumm amount of work required\n",
"print 'Minimum amount of work required is %f kJ'%W\n",
" \n",
"#(b)\n",
"#Q1 is the heat given up the surrounding\n",
"Q1 = W+Q2;\n",
"print 'Heat given upto surrounding is %f kJ'%Q1\n",
"\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Minimum amount of work required is 33.043846 kJ\n",
"Heat given upto surrounding is 367.153846 kJ\n"
]
}
],
"prompt_number": 22
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.3, Page no:90"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine efficiency of proposed engine\n",
"\n",
"# Variables\n",
"#Given:\n",
"P_out = 4.5; \t\t\t#output power(hp)\n",
"P_in = 6.25; \t\t\t#input power(kW)\n",
"T1 = 1000.; \t\t\t#source temperature(K)\n",
"T2 = 500.; \t\t\t#sink temperature(K)\n",
"\n",
"# Calculations and Results\n",
"#To determine efficiency of proposed engine \n",
"ep = ((P_out*745.7)/(P_in*1000)); \t\t\t#proposed efficiency\n",
"print 'Efficiency of proposed engine is %f'%ep\n",
"\n",
"em = ((T1-T2)/T1); \t\t\t#maximum efficiency\n",
"print 'The maximum efficieny is %f'%em\n",
"print 'Hence the claim of the proposed engine is impossible'\n",
"\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Efficiency of proposed engine is 0.536904\n",
"The maximum efficieny is 0.500000\n",
"Hence the claim of the proposed engine is impossible\n"
]
}
],
"prompt_number": 23
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.4, Page no:93"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate entropy of evaporation\n",
"\n",
"# Variables\n",
"#Given:\n",
"P = 500.; \t\t\t#pressure of dry saturated steam(kPa)\n",
"\n",
"#From steam tables\n",
"Hv = 2106.; \t\t\t#latent heat of vaporisation(kJ/kg)\n",
"T = 425.; \t\t\t#saturation temperature(K)\n",
" \n",
"# Calculations \n",
"#To calculate the entropy of evaporation\n",
"#By equation 4.25 (Page no. 93)\n",
"Sv = (Hv/T); \t\t\t#entropy change accompanying vaporisation\n",
"\n",
"# Results\n",
"print 'Entropy of evaporation is %f kJ/kg K'%Sv\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entropy of evaporation is 4.955294 kJ/kg K\n"
]
}
],
"prompt_number": 24
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.5, Page no:94"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine change in entropy\n",
"\n",
"# Variables\n",
"#Given:\n",
"m = 2.; \t\t\t#mass of gas(kg)\n",
"T1 = 277.; \t\t\t#initial temperature(K)\n",
"T2 = 368.; \t\t\t#final temperature(K)\n",
"Cv = 1.42; \t\t\t#specific geat at constant volume(kJ/kg K)\n",
"\n",
"# Calculations\n",
"import math\n",
"#Using equation 4.31 (Page no. 94)\n",
"S = (m*Cv*math.log(T2/T1)); \t\t\t#change in entropy(kJ/K)\n",
"\n",
"# Results\n",
"print 'Change in entropy is %f kJ/K'%S\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Change in entropy is 0.806746 kJ/K\n"
]
}
],
"prompt_number": 25
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.6, Page no:94"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate the entropy change\n",
"\n",
"#Given:\n",
"T = 300.; \t\t\t#temperature in K\n",
"P1 = 10.; \t\t\t#initial pressure(bar)\n",
"P2 = 1.; \t\t\t#final pressure(bar)\n",
"R = 8.314; \t\t\t#ieal gas constant\n",
"\n",
"# Calculations\n",
"import math\n",
"#To calculate the entropy change\n",
"#Using equation 4.33(Page no. 94)\n",
"S = (R*math.log(P1/P2)); \t\t\t#(kJ/kmol K)\n",
"\n",
"# Results\n",
"print 'Entopy change is %f kJ/kmol K'%S\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entopy change is 19.143692 kJ/kmol K\n"
]
}
],
"prompt_number": 26
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.7, Page no:94"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine change in entropy\n",
"\n",
"# Variables\n",
"#Given:\n",
"T1 = 335.; \t\t\t#initial temperature in K\n",
"T2 = 300.; \t\t\t#final temperature in K\n",
"P1 = 10.; \t\t\t#initial pressure(bar)\n",
"P2 = 1.; \t\t\t#final pressure(bar)\n",
"Cp = 29.3; \t\t\t#specific heat constant at constant pressure(kJ/kmol K)\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
"\n",
"# Calculations\n",
"import math\n",
"#To determine change in entropy\n",
"#Using equation 4.30 (Page no. 94)\n",
"S = ((Cp*math.log(T2/T1))-(R*math.log(P2/P1))); \t\t\t#entropy change(kJ/kmol K)\n",
"\n",
"# Results\n",
"print 'Entropy change in the process is %f kJ/kmol K'%S\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entropy change in the process is 15.910494 kJ/kmol K\n"
]
}
],
"prompt_number": 27
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.8, Page no:95"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine the change in entropy\n",
"\n",
"# Variables\n",
"#Given:\n",
"m1 = 10.; \t\t\t#mass of water at 375 K (kg)\n",
"m2 = 30.; \t\t\t#mass of water at 275 K (kg)\n",
"c = 4.2; \t\t\t#specific heat of water (kJ.kg K)\n",
"\n",
"# Calculations\n",
"import math\n",
"#To determine the change in entropy\n",
"#Let T be the final temperature(K)\n",
"T = ((m1*375)+(m2*275))/(m1+m2);\n",
"#S1 be change in entropy for hot water\n",
"S1 = (m1*c*math.log(T/375)); \t\t\t#[kJ/K]\n",
"#S2 be the change in entropy for cold water\n",
"S2 = (m2*c*math.log(T/275)); \t\t\t#[kJ/K]\n",
"#S be the total entropy change\n",
"S = S1+S2; \n",
"\n",
"# Results\n",
"print 'The total entropy change is %f kJ/K'%S\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change is 1.591404 kJ/K\n"
]
}
],
"prompt_number": 28
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.9, Page no:95"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate the total entropy change\n",
"\n",
"# Variables\n",
"#Given:\n",
"m1 = 35.; \t\t\t#mass of steel in kg\n",
"m2 = 150.; \t\t\t#mass of oil in kg\n",
"T1 = 725.; \t\t\t#temperature of steel(K)\n",
"T2 = 275.; \t\t\t#temperature of oil(K)\n",
"c1 = 0.88; \t\t\t#specific heat of steel (kJ/kg K)\n",
"c2 = 2.5; \t\t\t#specific heat of oil(kJ/kg K)\n",
"\n",
"# Calculations\n",
"import math\n",
"#To calculate the total entropy change\n",
"#Let T be the final temperature\n",
"T = (((m1*c1*T1)+(m2*c2*T2))/((m1*c1)+(m2*c2)));\n",
"#S1 be the in entropy for steel\n",
"S1 = (m1*c1*math.log(T/T1)); \t\t\t#[kJ/K]\n",
"#S2 be the change in entropy for oil\n",
"S2 = (m2*c2*math.log(T/T2)); \t\t\t#[kJ/K]\n",
"#S be the total entropy change\n",
"S = S1+S2;\n",
"\n",
"# Results\n",
"print 'The total entropy change is %f kJ/K'%S\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change is 17.649827 kJ/K\n"
]
}
],
"prompt_number": 29
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.10"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate entropy of 1 kmole of air\n",
"\n",
"# Variables\n",
"#Given:\n",
"n1 = 0.21; \t\t\t#volume % of oxygen in air\n",
"n2 = 0.79; \t\t\t#volume % of nitrogen in air\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
"\n",
"# Calculations\n",
"import math\n",
"#To calculate entropy of 1 kmol of air\n",
"#Using equation 4.35 (Page no. 96)\n",
"S = (-R*(n1*math.log(n1)+n2*math.log(n2))); \t\t\t#[kJ/kmol K]\n",
"\n",
"# Results\n",
"print 'The total entropy change is %f kJ/kmol K'%S\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change is 4.273036 kJ/kmol K\n"
]
}
],
"prompt_number": 30
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.11"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine change in entropy for the reaction\n",
"\n",
"# Variables\n",
"H = -2.8318*10**5; \t\t\t#heat of reaction (J/mol)\n",
"T = 298.; \t\t\t#temperature of reaction in K\n",
"#Absolute entropies for CO, O2, CO2 are (in J/mol K)\n",
"S_CO = 198.;\n",
"S_O2 = 205.2;\n",
"S_CO2 = 213.8;\n",
"\n",
"# Calculations and Results\n",
"# To determine the change in entropy for the reaction\n",
"# Referring equation 4.36 (Page no. 96)\n",
"S_reactant = S_CO + 0.5*S_O2; \t\t\t#entropy change for reactants\n",
"S_product = S_CO2; \t\t\t#entropy change for products\n",
"S = S_product-S_reactant; \t\t\t#total entropy change\n",
"print 'The total entropy change for the reaction is %f J/mol'%S\n",
"print 'Since the reaction is highly irreversible, entropy change cannot be calculated as the ratio of heat of reaction to the temperature'\n",
"\n",
"#The energy available for useful work is the difference between heat of reaction and entropy energy due to ireversible nature of the process\n",
"W_useful = -H+(T*S); \t\t\t#energy available for useful work (J)\n",
"print 'Energy available for useful work is %3.2e J'%W_useful\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change for the reaction is -86.800000 J/mol\n",
"Since the reaction is highly irreversible, entropy change cannot be calculated as the ratio of heat of reaction to the temperature\n",
"Energy available for useful work is 2.57e+05 J\n"
]
}
],
"prompt_number": 31
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.13"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate change in entropy and check whether the process is reversible\n",
"\n",
"# Variables\n",
"#Given:\n",
"H_steam = 2923.5; \t\t\t#enthalpy of superheated steam (kJ/kg)\n",
"S_steam = 6.71; \t\t\t#entropy of superheated steam (kJ/kg K)\n",
"H_liquid = 845.; \t\t\t#enthalpy of saturated liquid (kJ/kg)\n",
"S_liquid = 2.32; \t\t\t#entropy of saturated liquid (kJ/kg K)\n",
"T = 300.; \t\t\t#temperature of system (K)\n",
"\n",
"# Calculations\n",
"#To calculate change in entropy and check whether the process is reversible\n",
"S_system = S_liquid-S_steam; \t\t\t#change in entropy of steam\n",
"\n",
"#Let Q be the heat given out during condensation\n",
"Q = -(H_liquid-H_steam);\n",
"S_surrounding = Q/T; \t\t\t#change in entropy of the surrounding\n",
"S_total = S_system+S_surrounding; \t\t\t#total entropy change\n",
"\n",
"# Results\n",
"print 'The total entropy change is %f kJ/kg'%S_total\n",
"print 'Since total entropy change is positive,the process is irreversible'\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change is 2.538333 kJ/kg\n",
"Since total entropy change is positive,the process is irreversible\n"
]
}
],
"prompt_number": 32
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.14"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To determine the change in entropy of system\n",
"\n",
"# Variables\n",
"#Given:\n",
"V = 1.; \t\t\t#volume of each compartment in cubic meters\n",
"P_sat = 683.6; \t\t#pressure of saturated steam (kPa)\n",
"P_steam = 101.3; \t#pressure of supereated steam (kPa)\n",
"T_sat = 437.2; \t\t#temperature of system (K)\n",
"\n",
"#Referring steam tables\n",
"#For saturated steam at pressure 683.6 kPa and temp 437.2 K\n",
"H_sat = 2761.; \t\t\t #enthalpy of saturated steam (kJ/kg)\n",
"S_sat = 6.7133; \t\t\t#entropy of saturated steam (kJ/kg K)\n",
"spvol_sat = 278.9*10**-3; \t#specific volume of saturated steam (cubic m/kg)\n",
"U_sat = 2570.4; \t\t\t#specific internal energy of saturated steam (kJ/kg)\n",
"\n",
"#For superheated steam at 101.3 kPa and 437.2 K\n",
"H_steam = 2804.; \t\t\t #enthalpy of superheated steam (kJ/kg)\n",
"S_steam = 7.6712; \t\t\t #entropy of superheated steam (kJ/kg K)\n",
"spvol_steam = 1976.2*10**-3; \t#specific volume of superheated steam (cubic m /kg)\n",
"U_steam = 2603.3; \t\t\t #specific internal energy of superheated steam (kJ/kg)\n",
"\n",
"\n",
"# Calculations\n",
"#To determine the change in entropy of system\n",
"m_sat = V/spvol_sat; \t\t\t#mass of satureated steam(kg)\n",
"m_steam = V/spvol_steam; \t\t#mass of superheated steam (kg)\n",
"m_sys = m_sat+m_steam; \t\t\t#mass of system (kg)\n",
"spvol_sys = (2.*V)/m_sys; \t\t#specific volume of system (cubic m/kg)\n",
"\t\t\t#Since no heat exchange and work interaction occurs so internal energy after mixing remains the same\n",
"U1_sat = m_sat*U_sat; \t\t\t #internal energy of saturated steam (kJ)\n",
"U1_steam = m_steam*U_steam; \t #internal enegy of superheated steam (kJ)\n",
"U_sys = (U1_sat+U1_steam)/m_sys; \t#specific internal energy of system (kJ/kg)\n",
"\n",
"#Referring steam tables\n",
"#At calculated U_sys and spvol_sys\n",
"S_sys = 6.9992; \t\t\t #specific entropy of system (kJ/kg K)\n",
"Si = ((m_sat*S_sat)+(m_steam*S_steam)); #initial entropy of system (kJ/K)\n",
"Sf = (m_sys*S_sys); \t\t\t #final entropy of system (kJ/K)\n",
"S = Sf-Si; \t\t\t #change in entropy\n",
"\n",
"# Results\n",
"print 'The change in entropy of the system is %f kJ/K'%S\n",
"print 'Since entropy change is positive, the process is irrevresible'\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The change in entropy of the system is 0.685052 kJ/K\n",
"Since entropy change is positive, the process is irrevresible\n"
]
}
],
"prompt_number": 33
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.15"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate entropy change\n",
"\n",
"# Variables\n",
"#Given:\n",
"V = 1.; \t\t\t#volume of each compartment in cubic m\n",
"T = 300.; \t\t\t#temperature of ideal gas in 1st compartment (K)\n",
"P = 200.; \t\t\t#pressure of ideal gas in 1st compartment (kPa)\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
"\n",
"# Calculations\n",
"#To calculate entropy change\n",
"#Let n be the number of moles of gas\n",
"n = ((P*V)/(R*T));\n",
"#Since gas in vessel exchanges no heat and work with surrounding so internal energy remains same\n",
"#This implies temperature after mixing is same as that before mixing\n",
"\n",
"#Final conditions:\n",
"Tf = 300.; \t\t\t#final temperature (K)\n",
"Vf = 2.; \t\t\t#final volume (cubic m)\n",
"Pf = 100.; \t\t\t#final pressure (kPa)\n",
"\n",
"#Initial conditions:\n",
"Ti = 300.; \t\t\t#initial temperature (K)\n",
"Vi = 1.; \t\t\t#initial volume (cubic m)\n",
"Pi = 200.; \t\t\t#initial pressure (kPa)\n",
"import math\n",
"#Using equation 4.33 (Page num 94)\n",
"S = n*R*math.log(Vf/Vi); \t\t\t#entropy change of system (kJ/K)\n",
"#Since entropy of surrounding does not change\n",
"S_total = S; \t\t\t#total entropy change\n",
"\n",
"# Results\n",
"print 'The change in total entropy is %f kJ/K'%S_total\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The change in total entropy is 0.462098 kJ/K\n"
]
}
],
"prompt_number": 34
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.16"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate entropy change in the process\n",
"\n",
"# Variables\n",
"#Given:\n",
"m_oil = 5000.; \t\t\t#mass flow rate of oil (kg/h)\n",
"Tin_oil = 500.; \t\t\t#inlet temperature of oil (K)\n",
"Tin_water = 295.; \t\t\t#inlet temperature of water (K)\n",
"c_oil = 3.2; \t\t\t#specific heat of oil (kJ/kg K)\n",
"c_water = 4.2; \t\t\t#specific heat of water (kJ/kg K)\n",
"import math\n",
"#To calculate entropy change in the process\n",
"#Assuming oil is cooled to minimum permissible temperature\n",
"Tout_oil = 305.; \t\t\t#exit temperature of oil (K)\n",
"Tout_water = 490.; \t\t\t#exit temperature of water (K)\n",
"\n",
"# Calculations\n",
"#Let m_water be the mass flow rate of water\n",
"#By enthalpy balance\n",
"m_water = ((m_oil*c_oil*(Tin_oil-Tout_oil))/(c_water*(Tout_water-Tin_water))); \t\t\t#(kg/h)\n",
"S_oil = m_oil*c_oil*math.log(Tout_oil/Tin_oil); \t\t\t#entropy change of oil (kJ/K)\n",
"S_water = m_water*c_water*math.log(Tout_water/Tin_water); \t\t\t#entropy change of water (kJ/K)\n",
"S_tot = S_oil+S_water; \t\t\t#total entropy change\n",
"\n",
"# Results\n",
"print 'The total entropy change in the process is %f kJ/K'%S_tot\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change in the process is 210.139407 kJ/K\n"
]
}
],
"prompt_number": 35
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.17"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate loss in capacity of doing work\n",
"\n",
"# Variables\n",
"#Given:\n",
"To = 275.; \t\t\t#temperature of quenching oil (K)\n",
"\n",
"# Calculations\n",
"S_steel = -26.25; \t\t\t#change in entropy os casting (kJ/K)\n",
"S_oil = 43.90; \t\t\t#change in entropy of oil (kJ/K)\n",
"S_tot = S_steel+S_oil; \t\t\t#total entropy change\n",
"#Let W be loss in capacity for doing work\n",
"W = To*S_tot; \t\t\t#(kJ)\n",
"\n",
"# Results\n",
"print 'The loss in capacity for doing work is %f kJ'%W\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The loss in capacity for doing work is 4853.750000 kJ\n"
]
}
],
"prompt_number": 36
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.18"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate total change in entropy and available work\n",
"\n",
"import math\n",
"#Given:\n",
"m_oil = 5000.; \t\t\t #mass flow rate of hydrocarbon oil (kg/h)\n",
"Tin_oil = 425.; \t\t\t#inlet temperature of oil (K)\n",
"Tout_oil = 340.; \t\t\t#exit temperature of oil (K)\n",
"m_water = 10000.; \t\t\t#mass flow rate of water (kg/h)\n",
"Tin_water = 295.; \t\t\t#inlet temperature of water (K)\n",
"c_oil = 2.5; \t\t\t #mean specific heat of oil (kJ/kg K)\n",
"c_water = 4.2; \t\t\t #mean specific heat of water (kJ/kg K)\n",
"\n",
"#To determine total change in entropy and available work\n",
"\n",
"# Calculations and Results\n",
"#(a)\n",
"#By energy balance\n",
"Tout_water = ((m_oil*c_oil*(Tin_oil-Tout_oil))/(m_water*c_water))+295; \t\t\t#exit temperature of water (K)\n",
"S_oil = m_oil*c_oil*math.log(Tout_oil/Tin_oil); \t\t\t#change in entropy of oil (kJ/K)\n",
"S_water = m_water*c_water*math.log(Tout_water/Tin_water); \t\t\t#change in entropy of water (kJ/K)\n",
"S_tot = S_oil+S_water; \t\t\t#total entropy change\n",
"print 'The total entropy change is %f kJ/K'%S_tot\n",
"\n",
"\n",
"#(b)\n",
"To = 295.; \t\t\t#temperature at which heat is rejected to surrounding (K)\n",
"#Let Q be heat given out by the oil on cooling\n",
"Q = m_oil*c_oil*(Tin_oil-Tout_oil);\n",
"#Heat rejected to the surrounding at To by the Carnot Engine is given by\n",
"#Q2 = To(Q/T) = -To*S_oil\n",
"Q2 = -To*S_oil; \t\t\t#(kJ)\n",
"#Let W be the work output of engine\n",
"W = Q-Q2;\n",
"print 'The work output of the engine would be %4.3e kJ'%W\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total entropy change is 666.266812 kJ/K\n",
"The work output of the engine would be 2.397e+05 kJ\n"
]
}
],
"prompt_number": 37
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.19"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate the molar entropy of metal\n",
"\n",
"# Variables\n",
"#Given:\n",
"T = 10.; \t\t\t#temperature of metal (K)\n",
"Cp = 0.45; \t\t\t#molar heat capacity at 10 K (J/mol K)\n",
"\n",
"# Calculations\n",
"#To determine the molar entropy of metal\n",
"#Entropy of solid at 10 K is calculated using first integral in equation 4.55 (Page no. 108)\n",
"S = Cp/3;\n",
"\n",
"# Results\n",
"print 'Molar entropy of meatl at 10 K is %f J/mol K'%S\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Molar entropy of meatl at 10 K is 0.150000 J/mol K\n"
]
}
],
"prompt_number": 38
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 4.20"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# To calculate the absolute entropy of water vapour\n",
"\n",
"# Variables\n",
"#Given:\n",
"T = 473.; \t\t\t#temperature at entropy is to be determined (K)\n",
"Tf = 273.; \t\t\t#base temperature (K)\n",
"Tb = 373.; \t\t\t#boiling temperature (K)\n",
"Cpl = 4.2; \t\t\t#avearge heat capacity of water (kJ/kg K)\n",
"Cpg = 1.9; \t\t\t#avearge heat capacity of water vapour between 373 K and 473 K\n",
"Hv = 2257.; \t\t\t#latent heat of vaporisation at 373 K (kJ/kg)\n",
"\n",
"# Calculations\n",
"import math\n",
"S = (Cpl*math.log(Tb/Tf))+(Hv/Tb)+(Cpg*math.log(T/Tb));\n",
"\n",
"\n",
"# Results\n",
"print 'Absolute entropy of water vapour at 473 K and 101.3 kPa is %f kJ/kg K'%S\n",
"print 'It compares favourably with the value reported in steam tables'\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Absolute entropy of water vapour at 473 K and 101.3 kPa is 7.813068 kJ/kg K\n",
"It compares favourably with the value reported in steam tables\n"
]
}
],
"prompt_number": 39
}
],
"metadata": {}
}
]
}
|