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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 8 : Ideal and Real Gases"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.1 Page no : 392"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"How many kg of air must be removed from the chamber during the process ? Express this\n",
"mass as a volume measured at 1 bar and 25\u00b0C.\n",
"'''\n",
"\n",
"import math \n",
"\n",
"# Variables\n",
"R = 287.; \t\t\t#J/kg K\n",
"V1 = 40.; \t\t\t#m**3\n",
"V2 = 40.; \t\t\t#m**3\n",
"p1 = 1.*10**5; \t\t\t#Pa\n",
"p2 = 0.4*10**5; \t\t\t#Pa\n",
"T1 = 298.; \t\t\t#K\n",
"T2 = 278.; \t\t\t#K\n",
"\n",
"# Calculations\n",
"m1 = p1*V1/R/T1;\n",
"m2 = p2*V2/R/T2;\n",
"#Let mass of air removed be m\n",
"m = m1-m2;\n",
"\n",
"# Results\n",
"print (\"Mass of air removed = %.3f\")% (m),(\"kg\")\n",
"\n",
"V = m*R*T1/p1;\n",
"print (\"Volume of gas removed = %.3f\")% (V), (\"m**3\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Mass of air removed = 26.716 kg\n",
"Volume of gas removed = 22.849 m**3\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.2 Page no : 393"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"(i) How many kg of nitrogen will the flask hold at the designed conditions ?\n",
"(ii) At what temperature must the fusible plug melt in order to limit the pressure of a full\n",
"flask to a maximum of 150 bar ?\n",
"'''\n",
"\n",
"# Variables\n",
"V = 0.04; \t\t\t#m**3\n",
"p = 120.*10**5; \t\t\t#Pa\n",
"T = 293.; \t\t\t#K\n",
"R0 = 8314.; \n",
"\n",
"# Calculations and Results\n",
"print (\"(i) kg of nitrogen the flask can hold\")\n",
"M = 28; \t\t\t#molecular weight of Nitrogen\n",
"R = R0/M;\n",
"\n",
"m = p*V/R/T;\n",
"print (\"kg of nitrogen = %.3f\")% (m), (\"kg\")\n",
"\n",
"print (\"(ii) Temperature at which fusible plug should melt\")\n",
"p = 150.*10**5; \t\t\t#Pa\n",
"T = p*V/R/m; \t\t\t#K\n",
"t = T-273; \t\t\t#0C\n",
"print (\"Temperature = %.3f\")% (t),(\"\u00b0C\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i) kg of nitrogen the flask can hold\n",
"kg of nitrogen = 5.517 kg\n",
"(ii) Temperature at which fusible plug should melt\n",
"Temperature = 93.250 \u00b0C\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.3 Page no : 393"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"(i) What mass of original gas must have escaped if the dimensions of the balloon is not\n",
"changed ?\n",
"(ii) Find the amount of heat to be removed to cause the same drop in pressure at constant\n",
"volume.\n",
"'''\n",
"\n",
"import math \n",
"\n",
"# Variables\n",
"p1 = 1.*10**5; \t\t\t#Pa\n",
"T1 = 293.; \t\t\t#K\n",
"d = 6.; \t\t\t#m; diameter of the spherical balloon\n",
"p2 = 0.94*p1;\n",
"T2 = T1;\n",
"cv = 10400.; \t\t\t#J/kg K\n",
"R = 8314/2.;\n",
"r = 3.; \t\t\t#m\n",
"\n",
"# Calculations and Results\n",
"print (\"(i) Mass of original gas escaped\")\n",
"\n",
"mass_escaped = (p1-p2)/p1*100;\n",
"print (\"%mass_escaped = \"), (mass_escaped), (\"%\")\n",
"\n",
"print (\"(ii)Amount of heat to be removed \")\n",
"T2 = 0.94*T1;\n",
"m = p1*4/3*math.pi*r**3/R/T1;\n",
"\n",
"Q = m*cv*(T1-T2)/10**6;\n",
"print (\"Q = %.3f\")% (Q),(\"MJ\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i) Mass of original gas escaped\n",
"%mass_escaped = 6.0 %\n",
"(ii)Amount of heat to be removed \n",
"Q = 1.698 MJ\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.4 Page no : 394"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"(i) Calculate pressure and the specific volume of the gas.\n",
"(ii) evaluate the values of c p and c v .\n",
"(iii) evaluate the final pressure of gas.\n",
"(iv) Evaluate the increase in specific internal energy, the increase in specific enthalpy, increase\n",
"in specific entropy and magnitude and sign of heat transfer.\n",
"'''\n",
"\n",
"from numpy import *\n",
"import math \n",
"\n",
"# Variables\n",
"m = 28.; \t\t\t#kg\n",
"V1 = 3.; \t\t\t#m**3\n",
"T1 = 363.; \t\t\t#K\n",
"R0 = 8314.;\n",
"M = 28.; \t\t\t#Molecular mass of N2\n",
"R = R0/m;\n",
"V2 = V1;\n",
"T2 = 293.; \t\t\t#K\n",
"\n",
"# Calculations and Results\n",
"print (\"(i) Pressure (p1) and specific volume (v1) of the gas\")\n",
"\n",
"p1 = m*R*T1/V1/10**5; \t\t\t#bar\n",
"print (\"Pressure = %.3f\")% (p1), (\"bar\")\n",
"\n",
"v1 = V1/m;\n",
"print (\"specific volume = %.3f\")% (v1), (\"m**3/kg\")\n",
"\n",
"\n",
"#cp-cv = R/1000;\n",
"#cp-1.4cv = 0;\n",
"#solving the above two eqns \n",
"A = [[1,-1],[1,-1.4]];\n",
"B = [R/1000,0];\n",
"X = linalg.inv(A)*B;\n",
"cp = X[0,0]\n",
"print (\"cp = %.3f\")% (cp), (\"kJ/kg K\")\n",
"\n",
"cv = X[1][0];\n",
"print (\"cv = %.3f\")% (cv),(\"kJ/kg K\")\n",
"\n",
"print (\"(iii) Final pressure of the gas after cooling to 20\u00b0C\")\n",
"p2 = p1*T2/T1;\n",
"print (\"p2 = %.3f\")% (p2), (\"bar\")\n",
"\n",
"\n",
"du = cv*(T2-T1);\n",
"print (\"Increase in specific internal energy = %.3f\")% (du), (\"kJ/kg\")\n",
"\n",
"dh = cp*(T2-T1);\n",
"print (\"Increase in specific Enthalpy = %.3f\")%(dh), (\"kJ/kg\")\n",
"\n",
"v2 = v1;\n",
"ds = cv*math.log(T2/T1) + R*math.log(v2/v1);\n",
"print (\"Increase in specific entropy = %.3f\")%(ds),(\"kJ/kg K\")\n",
"\n",
"W = 0; \t\t\t#constant volume process\n",
"Q = m*du+W;\n",
"print (\"Heat transfer = %.3f\")%(Q), (\"kJ\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i) Pressure (p1) and specific volume (v1) of the gas\n",
"Pressure = 10.060 bar\n",
"specific volume = 0.107 m**3/kg\n",
"cp = 1.039 kJ/kg K\n",
"cv = 0.742 kJ/kg K\n",
"(iii) Final pressure of the gas after cooling to 20\u00b0C\n",
"p2 = 8.120 bar\n",
"Increase in specific internal energy = -51.963 kJ/kg\n",
"Increase in specific Enthalpy = -72.748 kJ/kg\n",
"Increase in specific entropy = -0.159 kJ/kg K\n",
"Heat transfer = -1454.950 kJ\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.5 Page no : 396"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"(a) \n",
"determine :\n",
"(i) The final specific volume, temperature and increase in entropy ;\n",
"(ii) The work done and the heat transfer.\n",
"(b) Repeat (a) assuming the process to be irreversible and adiabatic between end states.\n",
"'''\n",
"\n",
"import math \n",
"\n",
"print (\"Part (a)\")\n",
"# Variables\n",
"R = 0.287; \t\t\t#kJ/kg K\n",
"y = 1.4;\n",
"m1 = 1.; \t\t\t#kg\n",
"p1 = 8.*10**5; \t\t\t#Pa\n",
"T1 = 373.; \t\t\t#K\n",
"p2 = 1.8*10**5; \t\t\t#Pa\n",
"cv = 0.717; \t\t\t#kJ/kg K\n",
"n = 1.2;\n",
"\n",
"# Calculations and Results\n",
"#pv**1.2 = consmath.tant\n",
"print (\"(i) The final specific volume, temperature and increase in entropy\")\n",
"\n",
"v1 = R*10**3*T1/p1;\n",
"v2 = v1*(p1/p2)**(1./n);\n",
"print (\"v2 = %.3f\")%(v2), (\"m**3/kg\")\n",
"\n",
"T2 = p2*v2/R/10**3; \t\t\t#K\n",
"t2 = T2-273; \t\t\t#0C\n",
"print (\"Final temperature = %.3f\")% (t2), (\"0C\")\n",
"\n",
"ds = cv*math.log(T2/T1) + R*math.log(v2/v1);\n",
"print (\"ds = %.3f\")%(ds), (\"kJ/kg K\")\n",
"\n",
"\n",
"W = R*(T1-T2)/(n-1);\n",
"print (\"Work done = %.3f\")% (W), (\"kJ/kg\")\n",
"\n",
"Q = cv*(T2-T1) + W;\n",
"print (\"Heat transfer = %.3f\")%(Q),(\"kJ/kg\")\n",
"\n",
"print (\"Part (b)\")\n",
"\n",
"print (\"(i) Though the process is assumed now to be irreversible and adiabatic, the end states are given to be the same as in (a). Therefore, all the properties at the end of the process are the same as in (a).\")\n",
"\n",
"\n",
"print (\"(ii) Adiabatic process\")\n",
"Q = 0;\n",
"print (\"Heat transfer = %.3f\")%(Q), (\"kJ/kg\")\n",
"\n",
"W = -cv*(T2-T1);\n",
"print (\"Work done = %.3f\")%(W),(\"kJ/kg\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Part (a)\n",
"(i) The final specific volume, temperature and increase in entropy\n",
"v2 = 0.464 m**3/kg\n",
"Final temperature = 17.897 0C\n",
"ds = 0.179 kJ/kg K\n",
"Work done = 117.818 kJ/kg\n",
"Heat transfer = 58.950 kJ/kg\n",
"Part (b)\n",
"(i) Though the process is assumed now to be irreversible and adiabatic, the end states are given to be the same as in (a). Therefore, all the properties at the end of the process are the same as in (a).\n",
"(ii) Adiabatic process\n",
"Heat transfer = 0.000 kJ/kg\n",
"Work done = 58.868 kJ/kg\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.6 Page no : 397"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"determine the pressure in the spheres when the system attains equilibrium.\n",
"'''\n",
"\n",
"# Variables\n",
"d = 2.5; \t\t\t#m; diameter\n",
"V1 = 4./3*math.pi*(d/2)**3; \t\t\t#volume of each sphere\n",
"T1 = 298.; \t\t\t#K\n",
"T2 = 298.; \t\t\t#K\n",
"m1 = 16.; \t\t\t#kg\n",
"m2 = 8.; \t\t\t#kg\n",
"V = 2.*V1; \t\t\t#total volume\n",
"m = m1+m2;\n",
"R = 287.; \t\t\t#kJ/kg K\n",
"\n",
"# Calculations\n",
"p = m*R*T1/V/10**5; \t\t\t#bar\n",
"\n",
"\n",
"# Results\n",
"print (\"pressure in the spheres when the system attains equilibrium = %.3f\")%(p),(\"bar\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"pressure in the spheres when the system attains equilibrium = 1.254 bar\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.7 Page no : 398"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"evaluate the heat transfer rate from the gas and the power delivered by the turbine.\n",
"'''\n",
"\n",
"# Variables\n",
"m = 6.5/60; \t\t\t#kg/s\n",
"import math \n",
"cv = 0.837; \t\t\t#kJ/kg K\n",
"p1 = 10*10**5; \t\t\t#Pa\n",
"p2 = 1.05*10**5; \t\t\t#Pa\n",
"T1 = 453; \t\t\t#K\n",
"R0 = 8.314;\n",
"M = 44.; \t\t\t#Molecular mass of CO2\n",
"\n",
"\n",
"# Calculations and Results\n",
"R = R0/M;\n",
"cp = cv+R;\n",
"y = cp/cv;\n",
"\n",
"T2 = T1*(p2/p1)**((y-1)/y);\n",
"print T2\n",
"t2 = T2-273;\n",
"print (\"Final temperature = %.3f\")%(t2),(\"0C\")\n",
"\n",
"v2 = R*10**3*T2/p2; \t\t\t#m**3/kg\n",
"print (\"final specific volume = %.3f\")%(v2), (\"m**3/kg\")\n",
"\n",
"ds = 0; \t\t\t#Reversible and adiabatic process\n",
"print (\"Increase in entropy = \"), (ds)\n",
"\n",
"Q = 0; \t\t\t#Adiabatic process\n",
"print (\"Heat transfer rate from turbine = \"), (Q)\n",
"\n",
"W = m*cp*(T1-T2);\n",
"print (\"Power delivered by the turbine = %.3f\")% (W), (\"kW\")\n",
"\n",
"\n",
"# Note : answers wont match with the book because of the rounding error."
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"299.106840283\n",
"Final temperature = 26.107 0C\n",
"final specific volume = 0.538 m**3/kg\n",
"Increase in entropy = 0\n",
"Heat transfer rate from turbine = 0\n",
"Power delivered by the turbine = 17.104 kW\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.8 Page no : 400"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"Evaluate the following :\n",
"(i) The heat received in the cycle ;\n",
"(ii) The heat rejected in the cycle ;\n",
"(iii) Efficiency of the cycle.\n",
"'''\n",
"\n",
"import math \n",
"\n",
"# Variables\n",
"p1 = 8.*10**5; \t\t\t#Pa\n",
"V1 = 0.035; \t\t\t#m**3\n",
"T1 = 553.; \t\t\t#K\n",
"p2 = 8.*10**5; \t\t\t#Pa\n",
"V2 = 0.1; \t\t\t#m**3\n",
"n = 1.4;\n",
"R = 287.; \t\t\t#J/kg K\n",
"T3 = 553.; \t\t\t#K\n",
"cv = 0.71; \t\t\t#kJ/kg K\n",
"\n",
"# Calculations and Results\n",
"m = p1*V1/R/T1;\n",
"T2 = p2*V2/m/R;\n",
"p3 = p2/((T2/T3)**(n/(n-1)));\n",
"V3 = m*R*T3/p3;\n",
"\n",
"print (\"(i) The heat received in the cycle\")\n",
"\n",
"#constant pressure process 1-2\n",
"W_12 = p1*(V2-V1)/10**3; \t\t\t#kJ\n",
"Q_12 = m*cv*(T2-T1) + W_12; \t\t\t#kJ\n",
"\n",
"#polytropic process 2-3\n",
"W_23 = m*R/10**3*(T2-T3)/(n-1);\n",
"Q_23 = m*cv*(T3-T2) + W_23;\n",
"\n",
"Q_received = Q_12 + Q_23;\n",
"print (\"Total heat received in the cycle = \"),(Q_received), (\"kJ\")\n",
"\n",
"print (\"(ii) The heat rejected in the cycle\")\n",
"\n",
"#Isothermal process 3-1\n",
"W_31 = p3*V3*math.log(V1/V3)/10**3; \t\t\t#kJ\n",
"Q_31 = m*cv*(T3-T1) + W_31;\n",
"print (\"Heat rejected in the cycle = %.3f\")% (-Q_31), (\"kJ\")\n",
"\n",
"\n",
"n = (Q_received - (-Q_31))/Q_received*100;\n",
"print (\"Efficiency of the cycle = %.3f\")% (n), (\"%\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i) The heat received in the cycle\n",
"Total heat received in the cycle = 182.0 kJ\n",
"(ii) The heat rejected in the cycle\n",
"Heat rejected in the cycle = 102.883 kJ\n",
"Efficiency of the cycle = 43.471 %\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.9 Page no : 424"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"Compute the pressure by\n",
"(i) Van der Waals\u2019 equation\n",
"(ii) Perfect gas equation.\n",
"'''\n",
"\n",
"\n",
"# Variables\n",
"v = 44.; \t\t\t#m**3/kg-mol\n",
"T = 373.; \t\t\t#K\n",
"\n",
"\n",
"# Calculations and Results\n",
"print (\"(i) Using Van der Waals\u2019 equation\")\n",
"a = 362850.; \t\t\t#N*m**4/(kg-mol)**2\n",
"b = 0.0423; \t\t\t#M**3/kg-mol\n",
"R0 = 8314.; \t\t\t#J/kg K\n",
"\n",
"p = ((R0*T/(v-b)) - a/v**2);\n",
"print (\"Pressure umath.sing Van der Waals equation = %.3f\")%(p), (\"N/m**2\")\n",
"\n",
"print (\"(ii) Using perfect gas equation\")\n",
"\n",
"p = R0*T/v;\n",
"print (\"Pressure using perfect gas equation = %.3f\")% (p), (\"N/m**2\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i) Using Van der Waals\u2019 equation\n",
"Pressure umath.sing Van der Waals equation = 70360.445 N/m**2\n",
"(ii) Using perfect gas equation\n",
"Pressure using perfect gas equation = 70480.045 N/m**2\n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.10 Page no : 425"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"Estimate the\n",
"pressure exerted by CO 2 by using :\n",
"(i) Perfect gas equation\n",
"(ii) Van der Waals\u2019 equation\n",
"(iii) Beattie Bridgeman equation.\n",
"'''\n",
"# Variables\n",
"V = 3.; \t\t\t#m**3\n",
"m = 10.; \t\t\t#kg\n",
"T = 300.; \t\t\t#K\n",
"\n",
"# Calculations and Results\n",
"R0 = 8314.;\n",
"M = 44.; \n",
"R = R0/M;\n",
"p = m*R*T/V;\n",
"print (\"Pressure Using perfect gas equation = %.3f\")% (p),(\"N/m**2\")\n",
"\n",
"a = 362850; \t\t\t#Nm**4/(kg-mol)**2\n",
"b = 0.0423; \t\t\t#m**3/(kg-mol)\n",
"v = 13.2; \t\t\t #m**3/kg-mol\n",
"\n",
"p = R0*T/(v-b) - a/v**2;\n",
"print (\"Pressure Using Van der Waals\u2019 equation = %.3f\")%(p), (\"N/m**2\")\n",
"\n",
"\n",
"A0 = 507.2836;\n",
"a = 0.07132;\n",
"B0 = 0.10476;\n",
"b = 0.07235;\n",
"C = 66*10**4;\n",
"A = A0*(1-a/v);\n",
"B = B0*(1-b/v);\n",
"e = C/v/T**3;\n",
"\n",
"p = R0*T*(1-e)/v**2*(v+B) - A/v**2;\n",
"print (\"Pressure Using Beattie Bridgeman equation = %.3f\")%(p), (\"N/m**2\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Pressure Using perfect gas equation = 188954.545 N/m**2\n",
"Pressure Using Van der Waals\u2019 equation = 187479.533 N/m**2\n",
"Pressure Using Beattie Bridgeman equation = 190090.365 N/m**2\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.11 Page no : 404"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"find :\n",
"(i) The work done during the process\n",
"(ii) The final pressure.\n",
"'''\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
"# Variables\n",
"a = 139250; \t\t\t#Nm**4/(kg-mol)**2\n",
"b = 0.0314; \t\t\t#m**3/kg-mol\n",
"R0 = 8314; \t\t\t#Nm/kg-mol K\n",
"v1 = 0.2*32; \t\t\t#m**3/kg-mol\n",
"v2 = 0.08*32; \t\t\t#m**3/kg-mol\n",
"T = 333; \t\t\t#K\n",
"print (\"(i) Work done during the process\")\n",
"\n",
"# Calculations\n",
"def f21( v): \n",
"\t return R0*T/(v-b) - a/v**2\n",
"\n",
"W = quad(f21, v1, v2)[0]\n",
"\n",
"\n",
"# Results\n",
"print (\"W = %.3f\")% (W),(\"Nm/kg-mol\")\n",
"\n",
"\n",
"print (\"(ii) The final pressure\")\n",
"p2 = R0*T/(v2-b) - a/v2**2;\n",
"print (\"p2 = %.3f\")%(p2), (\"N/m**2\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i) Work done during the process\n",
"W = -2524722.415 Nm/kg-mol\n",
"(ii) The final pressure\n",
"p2 = 1073651.290 N/m**2\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.12 Page no : 404"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"compute the temperature.\n",
"'''\n",
"\n",
"# Variables\n",
"pr = 20;\n",
"Z = 1.25;\n",
"Tr = 8.0;\n",
"Tc = 282.4; \t\t\t#K\n",
"\n",
"# Calculations\n",
"T = Tc*Tr;\n",
"\n",
"# Results\n",
"print (\"Temperature = %.3f\")%(T),(\"K\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Temperature = 2259.200 K\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.13 Page no : 405"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"Calculate the density using the compressibility chart\n",
"'''\n",
"\n",
"# Variables\n",
"p = 260.*10**5; \t\t\t#Pa\n",
"T = 288.; \t\t\t#K\n",
"pc = 33.94*10**5; \t\t\t#Pa\n",
"Tc = 126.2; \t\t\t#K\n",
"R = 8314./28;\n",
"\n",
"# Calculations\n",
"pr = p/pc;\n",
"Tr = T/Tc;\n",
"Z = 1.08;\n",
"rho = p/Z/R/T;\n",
"\n",
"# Results\n",
"print (\"Density of N2 = %.3f\")% (rho), (\"kg/m**3\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Density of N2 = 281.517 kg/m**3\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.14 Page no : 405"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"What should be the temperature of 1.3 kg of CO 2 gas to behave as an ideal ?\n",
"'''\n",
"# Variables\n",
"p = 200.*10**5; \t\t\t#Pa\n",
"pc = 73.86*10**5; \t\t\t#Pa\n",
"Tc = 304.2; \t\t\t#K\n",
"pr = p/pc;\n",
"Z = 1;\n",
"Tr = 2.48;\n",
"\n",
"# Calculations\n",
"T = Tr*Tc;\n",
"\n",
"# Results\n",
"print (\"Temperature = \"), (T), (\"K\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Temperature = 754.416 K\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.15 Page no : 405"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"Find the mass of H 2 in the balloon using real gas equation.\n",
"'''\n",
"\n",
"import math \n",
"\n",
"# Variables\n",
"d = 12.; \t\t\t#m; diameter of spherical balloon\n",
"V = 4./3*math.pi*(d/2)**3;\n",
"T = 303.; \t\t\t#K\n",
"p = 1.21*10**5; \t\t\t#Pa\n",
"pc = 12.97*10**5; \t\t\t#Pa\n",
"Tc = 33.3; \t\t\t#K\n",
"R = 8314./2;\n",
"\n",
"# Calculations\n",
"pr = p/pc;\n",
"Tr = T/Tc;\n",
"Z = 1;\n",
"m = p*V/Z/R/T;\n",
"\n",
"# Results\n",
"print (\"Mass of H2 in the balloon = %.3f\")% (m), (\"kg\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Mass of H2 in the balloon = 86.917 kg\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 8.16 Page no : 406"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''\n",
"Determine the value of compressibility factor \n",
"'''\n",
"# Calculations\n",
"Z_cp = 3./2-9./8;\n",
"\n",
"# Results\n",
"print (\"Z_cp = \"),(Z_cp)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Z_cp = 0.375\n"
]
}
],
"prompt_number": 17
}
],
"metadata": {}
}
]
}
|