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
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
|
{
"metadata": {
"name": "",
"signature": "sha256:e125bf54ea1a9a80b48556c3a0d9bfe5a0daef9c6dd0d17606321588bbf0db06"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 3 : Flow through constant area duct adiabatic flow"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.1 page : 11"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
"M2 = 1 \t\t\t\t#Mach number at exit\n",
"D = 0.04 \t\t\t\t#inner tude diameter in m\n",
"f = 0.002 \t\t\t\t#frictional factor\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter at entry from gas tables @M1 = 0.25\n",
"X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter at exit from gas tables @M2 = 1\n",
"X = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter i.e. (4*f*L)/D\n",
"L = (X*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the pipe is %3.3f m'%(L)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe is 42.685 m\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.2 page : 11"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"M1 = 0.1 \t\t\t\t#Mach number at entrance\n",
"M2 = 0.5 \t\t\t\t#Mach number at a section\n",
"M3 = 1 \t\t\t\t#Mach number at critical condition\n",
"D = 0.02 \t\t\t\t#Diameter of duct in m\n",
"f = 0.004 \t\t\t\t#Frictional factor\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"X1 = 66.922 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M1 = 0.1\n",
"X2 = 1.069 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2 = 0.5\n",
"X3 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M3 = 1\n",
"X4 = X1-X3 \t\t\t\t#\t\t\t\t#frictional consmath.tant fanno parameter from M2 = 0.1 to M3 = 1\n",
"L1 = (X4*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"X5 = X2-X3 \t\t\t\t#frictional consmath.tant fanno parameter from M2 = 0.5 to M3 = 1\n",
"L2 = (X5*D)/(4*f) \t\t\t\t#Addition length of the pipe required to accelerate into critical condition in m\n",
"L = L1-L2 \t\t\t\t#Length of the pipe required to accelerate the flow from M1 = 0.1 to M2 = 0.5 in m\n",
"\n",
"\t\t\t\t\n",
"#Output \n",
"print 'A)Length of the pipe required to accelerate the flow from M1 = %3.1f to M2 = %3.1f is %3.3f m \\\n",
"\\nB)Additional length required to accelerate into critical condition is %3.5f m'%(M1,M2,L,L2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe required to accelerate the flow from M1 = 0.1 to M2 = 0.5 is 82.316 m \n",
"B)Additional length required to accelerate into critical condition is 1.33625 m\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.3 page : 12"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D = 0.05 \t\t\t\t#inner pipe diameter in m\n",
"Po = 10 \t\t\t\t#Stagnation Pressure at reservoir in bar\n",
"To = 400 \t\t\t\t#Stagnation temperature at reservoir in K\n",
"f = 0.002 \t\t\t\t#frictional factor \n",
"M1 = 3 \t\t\t\t#Mach number at entrance\n",
"M2 = 1 \t\t\t\t#Mach number at end of pipe\n",
"R = 287 \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"X1 = 0.522 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M1 = 3\n",
"X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2 = 1\n",
"X = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L = (X*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"p1 = 0.0272 \t\t\t\t#Pressure ratio from gas tables (M = 3,k = 1.4,isentropiC)\n",
"P1 = p1*Po \t\t\t\t#Static pressure at entrance in bar\n",
"t1 = 0.3571 \t\t\t\t#Temperature ratio from gas tables (M = 3,k = 1.4,isentropic)\n",
"T1 = t1*To \t\t\t\t#Static temperature at entrance in K\n",
"d1 = (P1*10**5)/(R*T1) \t\t\t\t#Density of air in kg/m**3, P1 in Pa\n",
"a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
"C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
"A1 = (math.pi*D**2)/4 \t\t\t\t#Cross sectional area of pipe in m**2\n",
"m = d1*A1*C1 \t\t\t\t#Mass flow rate in kg/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the pipe is %3.2f m \\\n",
"\\nB)Mass flow rate is %3.4f kg/s'%(L,m)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe is 3.26 m \n",
"B)Mass flow rate is 0.9363 kg/s\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.4 page : 13"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"C1 = 235. \t\t\t\t#Velocity at entrance in m/s\n",
"P1 = 13. \t\t\t\t#Static Pressure at entry in bar\n",
"P2 = 10. \t\t\t\t#Static Pressure at a point in duct in bar\n",
"T1 = 543. \t\t\t\t#Static temperature at entry in Kelvin\n",
"D = 0.15 \t\t\t\t#inner duct diameter in m\n",
"f = 0.005 \t\t\t\t#frictional factor\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
"M1 = C1/a1 \t\t\t\t#Mach number at entry\n",
"p1 = 2.138 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
"Pt = P1/p1 \t\t\t\t#Static critical pressure in bar\n",
"t1 = 1.143 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5) \n",
"Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
"c1 = 0.534 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"p2 = 1.644 \t\t\t\t#Pressure ratio from gas tables (fanno flow tables,k = 1.4)\n",
"M2 = 0.64 \t\t\t\t#Mach number from gas tables (fanno flow tables,k = 1.4,p2)\n",
"c2 = 0.674 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,p2)\n",
"C2 = Ct*c2 \t\t\t\t#Air velocity at P2 in m/s\n",
"t2 = 1.109 \t\t\t\t#Temperature ratio from gas tables (fanno flow tables,k = 1.4,p2)\n",
"T2 = t2*Tt \t\t\t\t#Satic temperature at P2 is K\n",
"X1 = 1.06922 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M1\n",
"X2 = 0.353 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2\n",
"X = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L = (X*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Temperature and velocity at section of the duct where the pressure has dropped to %3i bar \\\n",
"\\ndue to friction are %3.1f K and %3.2f m/s \\\n",
"\\nB)The Distance between two section is %3.3f m'%(P2,T2,C2,L)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Temperature and velocity at section of the duct where the pressure has dropped to 10 bar \n",
"due to friction are 526.8 K and 296.61 m/s \n",
"B)The Distance between two section is 5.372 m\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.5 page : 14"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"P1 = 120. \t\t\t\t#Static pressure at entrance in bar\n",
"T1 = 313. \t\t\t\t#Static temperature at entry in Kelvin\n",
"M1 = 2.5 \t\t\t\t#Mach number at entrance\n",
"M2 = 1.8 \t\t\t\t#Mach number at exit\n",
"D = 0.2 \t\t\t\t#inner pipe diameter in m\n",
"f = 0.01/4 \t\t\t\t#frictional factor\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
"C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
"p1 = 0.292 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 2.5)\n",
"Pt = P1/p1 \t\t\t\t#Static critical pressure in kPa\n",
"t1 = 0.533 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 2.5)\n",
"Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
"c1 = 1.826 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 2.5)\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"X1 = 0.432 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1 = 3\n",
"X2 = 0 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables @M2 = 1\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L1 = (X3*D)/(4*f) \t\t\t\t#Maximum length of the pipe in m\n",
"p2 = 0.474 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 1.8)\n",
"P2 = Pt*p2 \t\t\t\t#Static pressure in kPa\n",
"t2 = 0.728 \t\t\t\t#static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 1.8)\n",
"T2 = Tt*t2 \t\t\t\t#Static temperature in K\n",
"c2 = 1.536 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 1.8)\n",
"C2 = c2*Ct \t\t\t\t#Critical velocity in m/s\n",
"X4 = 0.242 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M = 1.8\n",
"X5 = X4-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L2 = (X5*D)/(4*f) \t\t\t\t#Length between sonic and oulet section\n",
"L = L1-L2 \t\t\t\t#Length of the pipe in m\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Maximum length of the pipe is %3.2f m \\\n",
"\\nB)Properties of air at sonic condition: \\\n",
"\\nPressure is %3i kPa \\\n",
"\\nTemperature is %3.2f K \\\n",
"\\nVelocity is %3.1f m/s \\\n",
"\\nC)Length of the pipe is %3.1f m \\\n",
"\\nD)Properties of air at M2 = %3.1f: \\\n",
"\\nPressure is %3i kPa \\\n",
"\\nTemperature is %3.2f K \\\n",
"\\nVelocity is %3.2f m/s'%(L1,Pt,Tt,Ct,L,M2,P2,T2,C2)\n",
"\n",
"# note : rounding off error."
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Maximum length of the pipe is 8.64 m \n",
"B)Properties of air at sonic condition: \n",
"Pressure is 410 kPa \n",
"Temperature is 587.24 K \n",
"Velocity is 485.5 m/s \n",
"C)Length of the pipe is 3.8 m \n",
"D)Properties of air at M2 = 1.8: \n",
"Pressure is 194 kPa \n",
"Temperature is 427.51 K \n",
"Velocity is 745.77 m/s\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.6 page : 15"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
"ds = 0.124 \t\t\t\t#Change in entropy in kJ/kg-K\n",
"P1 = 700. \t\t\t\t#Static pressure at entrance in bar\n",
"T1 = 333. \t\t\t\t#Static temperature at entry in Kelvin\n",
"D = 0.05 \t\t\t\t#inner pipe diameter in m\n",
"f = 0.006 \t\t\t\t#frictional factor\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"p1 = math.exp(ds/R) \t\t\t\t#Ratio of Stagnation pressure at inlet to outlet \n",
"t1 = 0.987 \t\t\t\t#Ratio of Static Temperature to Stagnation temperature at entry from gas tables @M1\n",
"To1 = T1/t1 \t\t\t\t#Stagnation temperature at entry in K\n",
"p2 = 0.957 \t\t\t\t#Ratio of Static pressure to Stagnation pressure at entry from gas tables @M1\n",
"Po1 = P1/p2 \t\t\t\t#Stagnation pressure at entry in kPa\n",
"Po2 = Po1/p1 \t\t\t\t#Stagnation pressure at exit in kPa\n",
"a1 = math.sqrt(k*R*10**3*T1) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
"C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
"p3 = 4.3615 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.25)\n",
"Pt = P1/p3 \t\t\t\t#Static critical pressure in kPa\n",
"t1 = 1.185 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.25)\n",
"Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
"c1 = 0.272 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.25)\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"p4 = 2.4065 \t\t\t\t#Pressure ratio at entry from gas tables @M1,k\n",
"Pot = Po1/p4 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
"X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k\n",
"p5 = Po2/Pot \t\t\t\t#Pressure ratio \n",
"M2 = 0.41 \t\t\t\t#Mach number at exit from gas tables @p5\n",
"p6 = 2.629 \t\t\t\t#Pressure ratio at exit from gas tables @p5\n",
"P2 = Pt*p6 \t\t\t\t#Exit pressure in kPa\n",
"t2 = 1.161 \t\t\t\t#Temperature ratio at exit from gas tables @p5\n",
"T2 = Tt*t2 \t\t\t\t#Exit temperature in K\n",
"c2 = 0.4415 \t\t\t\t#Velocity ratio at exit from gas tables @p5\n",
"C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
"X2 = 2.141 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Mach number at exitsection 2) is %3.2f \\\n",
"\\nB)Properties at exitsection 2): \\\n",
"\\nPressure is %3.2f kPa \\\n",
"\\nTemperature is %3i K \\\n",
"\\nVelocity is %3.3f m/s \\\n",
"\\nC)Length of the duct is %3.3f m'%(M2,P2,T2,C2,L)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Mach number at exitsection 2) is 0.41 \n",
"B)Properties at exitsection 2): \n",
"Pressure is 421.94 kPa \n",
"Temperature is 326 K \n",
"Velocity is 148.432 m/s \n",
"C)Length of the duct is 13.325 m\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.7 page : 17"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"M1 = 0.25 \t\t\t\t#Initial Mach number \n",
"M2 = 0.75 \t\t\t\t#Final mach number \n",
"P1 = 1.5 \t\t\t\t#Inlet pressure in bar\n",
"T1 = 300. \t\t\t\t#Inlet temperature in K\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"a1 = math.sqrt(k*R*10**3*T1) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
"C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
"p1 = 4.3615 \t\t\t\t#Pressure ratio at entry from gas tables @M1,k\n",
"Pt = P1/p1 \t\t\t\t#Static critical pressure in kPa\n",
"c1 = 0.272 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M1)\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"p2 = 1.385 \t\t\t\t#Pressure ratio at exit from gas tables @M2,k\n",
"P2 = Pt*p2 \t\t\t\t#Exit pressure in bar\n",
"c2 = 0.779 \t\t\t\t#Velocity ratio at exit from gas tables @M2,k\n",
"C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'Final pressure and velocity are %3.4f bar and %3.2f m/s'%(P2,C2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Final pressure and velocity are 0.4763 bar and 248.58 m/s\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.8 page : 17"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"T1 = 333. \t\t\t\t#Inlet temperature in K\n",
"D = 0.05 \t\t\t\t#inner duct diameter in m\n",
"f = 0.005/4 \t\t\t\t#frictional factor\n",
"L = 5. \t\t\t\t#Length of the pipe in m\n",
"Pt = 101. \t\t\t\t#Exit pressure in kPa, Pt = P2 Since flow is choked \n",
"M2 = 1. \t\t\t\t#Mach number at exit math.since pipe is choked \n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"X = (4*f*L)/D \t\t\t\t#frictional consmath.tant fanno parameter \n",
"M1 = 0.6 \t\t\t\t#Inlet mach number \n",
"t1 = 1.119 \t\t\t\t#Temperature ratio at entry from fanno flow gas tables @M1,k\n",
"Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
"at = math.sqrt(k*R*10**3*Tt) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
"Ct = at \t\t\t\t#air velocity in m/s\n",
"d_t = Pt/(R*Tt) \t\t\t\t#Density at exit in kg/m**3\n",
"At = math.pi*D**2/4 \t\t\t\t#Critical area in m**2\n",
"m = d_t*At*Ct \t\t\t\t#Mass flow rate in kg/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Mach number at inlet is %3.1f \\\n",
"\\nB)Mass flow rate is %3.5f kg/s \\\n",
"\\nC)Exit temperature is %3.3f K'%(M1,m,Tt)\n",
"\n",
"# note : rouding off error."
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Mach number at inlet is 0.6 \n",
"B)Mass flow rate is 0.80291 kg/s \n",
"C)Exit temperature is 297.587 K\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.9 page : 18"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"m = 8.25 \t\t\t\t#Mass flow rate in kg/s\n",
"M1 = 0.15 \t\t\t\t#Mach number at entrance\n",
"M2 = 0.5 \t\t\t\t#Mach number at exit\n",
"P1 = 345. \t\t\t\t#Static pressure at entrance in kPa\n",
"T1 = 38.+273 \t\t\t\t#Static temperature at entry in Kelvin\n",
"f = 0.005 \t\t\t\t#frictional factor\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 0.287 \t\t\t\t#Gas consmath.tant in kJ/kg-K\n",
"\n",
"#calculation\n",
"d1 = (P1*10**3)/(R*10**3*T1) \t\t\t\t#Density of air in kg/m**3, P1 in Pa\n",
"a1 = math.sqrt(k*R*10**3*T1) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
"C1 = a1*M1 \t\t\t\t#air velocity in m/s\n",
"A1 = m/(d1*C1) \t\t\t\t#Inlet area in m**2\n",
"D = (math.sqrt((4*A1)/(math.pi)))*10**3 \t\t\t\t#inner duct diameter in mm\n",
"p1 = 7.3195 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
"Pt = P1/p1 \t\t\t\t#Static critical pressure in kPa\n",
"t1 = 1.1945 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
"Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
"c1 = 0.164 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"p2 = 0.984 \t\t\t\t#Pressure ratio at entry from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
"Po1 = P1/p2 \t\t\t\t#Stagnation pressure at entry in kPa\n",
"p3 = 3.928 \t\t\t\t#Stagnation pressure ratio at entry from gas tables (fanno flow tables,k = 1.4,M = 0.15)\n",
"Pot = Po1/p3 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
"X1 = 28.354 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k\n",
"p5 = 2.138 \t\t\t\t#Pressure ratio at exit from gas tables (fanno flow tables,k = 1.4,M2)\n",
"P2 = Pt*p5 \t\t\t\t#Exit pressure in kPa\n",
"t2 = 1.143 \t\t\t\t#Temperature ratio at exit from gas tables (fanno flow tables,k = 1.4,M2)\n",
"T2 = Tt*t2 \t\t\t\t#Exit temperature in K\n",
"c2 = 0.534 \t\t\t\t#Velocity ratio at exit from gas tables (fanno flow tables,k = 1.4,M2) \n",
"C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
"p6 = 1.34 \t\t\t\t#Stagnation pressure ratio at exit from gas tables (fanno flow tables,k = 1.4,M2)\n",
"Po2 = Pot*p6 \t\t\t\t#Stagnation pressure at exit in kPa\n",
"SPL = Po1-Po2 \t\t\t\t#Stagnation Pressure lose in kPa\n",
"X2 = 1.069 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L = (X3*D*10**-3)/(4*f) \t\t\t\t#Length of the duct in m\n",
"\n",
"\t\t\t\t#verification\n",
"a2 = math.sqrt(k*R*10**3*T2) \t\t\t\t#Sound velocity in m/s, R in J/kg\n",
"M2_v = C2/a2 \t\t\t\t#air velocity in m/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the duct is %3.2f m \\\n",
"\\nB)Diameter of the duct is %3i mm \\\n",
"\\nC)Pressure and diameter at exit are %3.2f kPa, and %3i mm respectively \\\n",
"\\nD)Stagnation Pressure lose is %3i kPa \\\n",
"\\nE)using exit velocity %3.2f m/s, \\\n",
"\\ntemperature %3.2f K \\\n",
"\\nMach number is found to be %3.2f'%(L,D,P2,D,SPL,C2,T2,M2_v)\n",
"\n",
"# note : rouding off error."
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the duct is 308.85 m \n",
"B)Diameter of the duct is 226 mm \n",
"C)Pressure and diameter at exit are 100.77 kPa, and 226 mm respectively \n",
"D)Stagnation Pressure lose is 231 kPa \n",
"E)using exit velocity 172.65 m/s, \n",
"temperature 297.59 K \n",
"Mach number is found to be 0.50\n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.10 page : 19"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
"f = 0.01/4 \t\t\t\t#frictional factor\n",
"D = 0.15 \t\t\t\t#inner pipe diameter in m\n",
"p1 = 0.8 \t\t\t\t#Stagnation pressure ratio at exit to entry when loss in stagnation pressure is 20%\n",
"M3 = 0.8 \t\t\t\t#Mach number at a section\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"p2 = 2.4065 \t\t\t\t#Ratio of Stagnation pressure at entry from gas tables @M1,k = 1.4\n",
"X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1\n",
"p3 = p1*p2 \t\t\t\t#Ratio of Stagnation pressure at exit\n",
"M2 = 0.32 \t\t\t\t#Exit mach number at p1 = 0.8\n",
"X2 = 4.447 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2\n",
"L1 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"L2 = (X2*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"L = L1-L2 \t\t\t\t#Overall length of the duct in m\n",
"p4 = 1.038 \t\t\t\t#Stagnation pressure ratio from M = 1 to M3\n",
"PL = (1-(p4/p2))*100 \t\t\t\t#Percentage of stagnation pressure from inlet to section at which M3 in percent\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the pipe is %3.2f m \\\n",
"\\nB)Mach number at this exit is %3.2f \\\n",
"\\nC)Percentage of stagnation pressure from inlet to section at which M = %3.1f is %3.2f percent \\\n",
"\\nD)Maximum length to reach choking condition is %3.3f m'%(L,M2,M3,PL,L1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe is 61.35 m \n",
"B)Mach number at this exit is 0.32 \n",
"C)Percentage of stagnation pressure from inlet to section at which M = 0.8 is 56.87 percent \n",
"D)Maximum length to reach choking condition is 128.055 m\n"
]
}
],
"prompt_number": 20
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.11 page : 20"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D = 0.3 \t\t\t\t#inner duct diameter in m\n",
"P1 = 10. \t\t\t\t#Static pressure at entrance in bar\n",
"T1 = 400. \t\t\t\t#Static temperature at entry in Kelvin\n",
"M1 = 3. \t\t\t\t#Mach number at entrance\n",
"M2 = 1. \t\t\t\t#Mach number at exit\n",
"k = 1.3 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Specific Gas consmath.tant in J/kg-K, wrong printing in question\n",
"f = 0.002 \t\t\t\t#frictional factor\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"p1 = 0.233 \t\t\t\t#Pressure ratio from gas tables (M = 3,k = 1.4,isentropic)\n",
"Pt = P1/p1 \t\t\t\t#Static pressure at entrance in bar\n",
"t1 = 0.489 \t\t\t\t#Temperature ratio from gas tables (M = 3,k = 1.4,isentropic)\n",
"Tt = T1/t1 \t\t\t\t#Static temperature at entrance in K\n",
"X1 = 0.628 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.3\n",
"L1 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"d_t = (Pt*10**5)/(R*Tt) \t\t\t\t#Density at critical state in kg/m**3, Pt in Pa\n",
"at = math.sqrt(k*R*Tt) \t\t\t\t#Sound velocity in m/s, R in J/kg \n",
"Ct = at \t\t\t\t#air velocity in m/s\n",
"At = (math.pi*D**2)/4 \t\t\t\t#Critical area in m**2\n",
"m = d_t*At*Ct \t\t\t\t#Mass flow rate in kg/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the pipe is %3.2f m \\\n",
"\\nB)Mass flow rate is %3.3f kg/s'%(L1,m)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe is 23.55 m \n",
"B)Mass flow rate is 713.891 kg/s\n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.12 page : 21"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"M1 = 0.25 \t\t\t\t#Mach number at entrance\n",
"f = 0.04/4 \t\t\t\t#frictional factor\n",
"D = 0.15 \t\t\t\t#inner duct diameter in m\n",
"p1 = 0.9 \t\t\t\t#Stagnation pressure ratio at exit to entry when loss in stagnation pressure is 10%\n",
"ds = 190 \t\t\t\t#/Change in entropy in J/kg-K\n",
"k = 1.3 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287 \t\t\t\t#Specific Gas consmath.tant in J/kg-K, wrong printing in question\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"p2 = 2.4064 \t\t\t\t#Ratio of stagnation pressures at inlet to critical state from gas tables fanno flow tables @M1,k = 1.3\n",
"X1 = 8.537 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.3\n",
"p3 = p1*p2 \t\t\t\t#Ratio of stagnation pressures at exit to critical state from gas tables fanno flow tables @M1,k = 1.3\n",
"M2 = 0.28 \t\t\t\t#Mach number at p1 = 0.9 from gas tables @p3\n",
"X2 = 6.357 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.3\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"p4 = math.exp(ds/R) \t\t\t\t#Ratio of Stagnation pressure at entry to Stagnation pressure where ds = 190 \n",
"p5 = p1/p4 \t\t\t\t#Ratio of Stagnation pressures where ds = 190 to critical state\n",
"M3 = 0.56 \t\t\t\t#Mach number where ds = 190\n",
"X4 = 0.674 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M3,k = 1.3\n",
"X5 = X1-X4 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L2 = (X5*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the pipe is %3.3f m \\\n",
"\\nB)Length of the pipe would require to rise entropy by %3i J/kg-K is %3.5f m \\\n",
"\\nC)Mach number is %3.2f'%(L1,ds,L2,M3)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe is 8.175 m \n",
"B)Length of the pipe would require to rise entropy by 190 J/kg-K is 29.48625 m \n",
"C)Mach number is 0.56\n"
]
}
],
"prompt_number": 23
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.13 page : 22"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"Po1 = 200. \t\t\t\t#Stagantion pressure at inlet in kPa\n",
"To1 = 303. \t\t\t\t#Stagnation temperature at inlet in K\n",
"M1 = 0.2 \t\t\t\t#Inlet Mach number from diagram\n",
"D = 0.025 \t\t\t\t#inner tude diameter in m(mismath.sing data)\n",
"M2 = 0.8 \t\t\t\t#Outlet Mach number \n",
"f = 0.005/4 \t\t\t\t#frictional factor\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"t1 = 0.992 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"T1 = To1*t1 \t\t\t\t#Static temperature in K\n",
"p1 = 0.973 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"P1 = Po1*p1 \t\t\t\t#Static pressure in kPa\n",
"p2 = 2.964 \t\t\t\t#Stagnation pressure ratio at inlet to critical state from gas tables (M1,k = 1.4,fanno flow)\n",
"Pot = Po1/p2 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
"X1 = 14.533 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"p3 = 1.038 \t\t\t\t#Stagnation pressure ratio at outlet to critical state from gas tables (M1,k = 1.4,fanno flow)\n",
"Po2 = Pot*p3 \t\t\t\t#Stagnation pressure at exit in kPa\n",
"X2 = 0.073 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"SPL = (1-(p3/p2))*100 \t\t\t\t#Percentage decrease in stagnation pressure in percent\n",
"ds = R*math.log(Po1/Po2) \t\t\t\t#Change of entropy in kJ/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the pipe is %3.1f m \\\n",
"\\nB)Percentage decrease in stagnation pressure is %3.2f percent \\\n",
"\\nC)Change of entropy is %3.3f kJ/kg-K'%(L1,SPL,ds)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the pipe is 72.3 m \n",
"B)Percentage decrease in stagnation pressure is 64.98 percent \n",
"C)Change of entropy is 301.133 kJ/kg-K\n"
]
}
],
"prompt_number": 25
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.14 page : 23"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D1 = 0.03 \t\t\t\t#Inlet duct diameter in m\n",
"D2 = 0.015 \t\t\t\t#Throat diameter of duct in m \n",
"Po1 = 750. \t\t\t\t#Stagantion pressure at inlet in kPa\n",
"To1 = 450. \t\t\t\t#Stagnation temperature at inlet in K\n",
"f = 0.02/4 \t\t\t\t#frictional factor\n",
"L = 0.25 \t\t\t\t#Length of the duct in m\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"ar = (D1/D2)**2 \t\t\t\t#Ratio of areas\n",
"M1 = 2.94 \t\t\t\t#Mach number at inlet from gas tables (ar,k = 1.4,isentropic)\n",
"p1 = 0.0298 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"P1 = Po1*p1 \t\t\t\t#Static pressure at inlet in kPa\n",
"t1 = 0.367 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"T1 = To1*t1 \t\t\t\t#Static temperature at inlet in K\n",
"a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
"C1 = a1*M1 \t\t\t\t#Air velocity at inlet in m/s\n",
"X1 = 0.513 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"p2 = 0.226 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"Pt = P1/p2 \t\t\t\t#Critical pressure in kPa\n",
"c1 = 1.949 \t\t\t\t#Static to Critical velocity ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"t2 = 0.439 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"Tt = T1/t2 \t\t\t\t#Critical temperature in K\n",
"L1 = (X1*D1)/(4*f) \t\t\t\t#Length of the pipe from inlet to critical state in m\n",
"L2 = L1-L \t\t\t\t#Length of the pipe from required point to critical state in m\n",
"X2 = (4*f*L2)/D2 \t\t\t\t#frictional consmath.tant fanno parameter\n",
"M2 = 2.14 \t\t\t\t#Mach number at inlet from gas tables (X2,k = 1.4,fanno flow)\n",
"p3 = 0.369 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"P2 = Pt*p3 \t\t\t\t#Exit pressure in kPa\n",
"c2 = 1.694 \t\t\t\t#Static to Critical velocity ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
"t3 = 0.623 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"T2 = t3*Tt \t\t\t\t#Exit temperature in K\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Maximum length of the pipe is %3.4f m \\\n",
"\\nB)Condition of air at exit: \\\n",
"\\nPressure is %3.2f kPa \\\n",
"\\nVelocity is %3.2f m/s \\\n",
"\\nTemperature is %3.2f K'%(L1,P2,C2,T2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Maximum length of the pipe is 0.7695 m \n",
"B)Condition of air at exit: \n",
"Pressure is 36.49 kPa \n",
"Velocity is 658.25 m/s \n",
"Temperature is 234.37 K\n"
]
}
],
"prompt_number": 27
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.15 page : 25"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"f = 0.002 \t\t\t\t#frictional factor\n",
"C1 = 130. \t\t\t\t#Air velocity at inlet in m/s\n",
"T1 = 400. \t\t\t\t#Inlet temperature at inlet in K\n",
"P1 = 250. \t\t\t\t#Inlet pressure at inlet in kPa\n",
"D = 0.16 \t\t\t\t#Inlet duct diameter in m\n",
"p1 = 0.8 \t\t\t\t#Stagnation pressure ratio at exit to entry when loss in stagnation pressure is 20%\n",
"L1 = 35. \t\t\t\t#Length of duct from inlet to required section\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity in m/s\n",
"M1 = C1/a1 \t\t\t\t#Mach number at inlet\n",
"p2 = 0.9295 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"Po1 = P1/p2 \t\t\t\t#Stagantion pressure at inlet in kPa\n",
"Po2 = 0.8*Po1 \t\t\t\t#Stagantion pressure at outlet in kPa\n",
"p3 = 1.89725 \t\t\t\t#Stagnation pressure ratio at inlet to critical state from gas tables (M1,k = 1.4,fanno flow)\n",
"Pot = Po1/p3 \t\t\t\t#Stagnation pressure at critical state in kPa\n",
"X1 = 4.273 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"p4 = 3.33725 \t\t\t\t#Static Pressure ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
"Pt = P1/p4 \t\t\t\t#Static critical pressure in kPa\n",
"t1 = 1.175 \t\t\t\t#Static temperature ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5) \n",
"Tt = T1/t1 \t\t\t\t#Static critical temperature in K\n",
"c1 = 0.347 \t\t\t\t#Velocity ratio from gas tables (fanno flow tables,k = 1.4,M = 0.5)\n",
"Ct = C1/c1 \t\t\t\t#Critical velocity in m/s\n",
"p5 = Po2/Pot \t\t\t\t#Pressure ratio\n",
"M2 = 0.43 \t\t\t\t#Mach number at p1 = 0.8\n",
"X2 = 1.833 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L2 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m, (from required section to critical state) \n",
"L3 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m, (from required inlet to critical state) \n",
"L4 = L3-L1 \t\t\t\t#Length of the pipe in m\n",
"X4 = (4*f*L3)/D \t\t\t\t#frictional consmath.tant fanno parameter\n",
"M3 = 0.39 \t\t\t\t#Mach number at L1 = 35m\n",
"p6 = 2.767 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M3,k = 1.4\n",
"P2 = Pt*p6 \t\t\t\t#Exit pressure in kPa\n",
"t2 = 1.1645 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M3,k = 1.4\n",
"T2 = Tt*t2 \t\t\t\t#Exit temperature in K\n",
"c2 = 0.42087 \t\t\t\t#Static to Critical velocity ratio at outlet from gas tables,fanno flow tables @M3,k = 1.4\n",
"C2 = Ct*c2 \t\t\t\t#Exit velocity in m/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of pipe required for p = %3.1f m is %3.3f m \\\n",
"\\nB)Properties of air at section %3i from inlet: \\\n",
"\\nTemperature is %3.3f K \\\n",
"\\nPressure is %3.2f kPa \\\n",
"\\nVelocity is %3.1f m/s \\\n",
"\\nC)Maximum length of the pipe is %3.2f m'%(p1,L2,L1,T2,P2,C2,L3)\n",
"\n",
"# rounding off error."
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of pipe required for p = 0.8 m is 48.800 m \n",
"B)Properties of air at section 35 from inlet: \n",
"Temperature is 396.426 K \n",
"Pressure is 207.28 kPa \n",
"Velocity is 157.7 m/s \n",
"C)Maximum length of the pipe is 85.46 m\n"
]
}
],
"prompt_number": 30
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.16 page : 26"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D = 0.3 \t\t\t\t#inner pipe diameter in m\n",
"Q = 1000. \t\t\t\t#Discharge in m**3/min\n",
"P2 = 150. \t\t\t\t#Exit pressure in kPa\n",
"T2 = 293. \t\t\t\t#Exit temperature in K\n",
"L1 = 50. \t\t\t\t#Length of the pipe in m\n",
"f = 0.005 \t\t\t\t#frictional factor\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"A = math.pi*D**2/4 \t\t\t\t#Area of duct in m**2 \n",
"C2 = Q/(A*60) \t\t\t\t#Exit air velocity in m/s\n",
"a2 = math.sqrt(k*R*T2) \t\t\t\t#Sound velocity in m/s\n",
"M2 = C2/a2 \t\t\t\t#Exit mach number \n",
"p1 = 1.54 \t\t\t\t#\t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"Pt = P2/p1 \t\t\t\t#Critical pressure in kPa\n",
"t1 = 1.10 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"Tt = T2/t1 \t\t\t\t#Critical temperature in K\n",
"X1 = 0.228 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
"L2 = (X1*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"L2 = L1+L2 \t\t\t\t#Overall length of pipe from inlet to critical state in m\n",
"X2 = (4*f*L2)/D \t\t\t\t#frictional consmath.tant fanno parameter for M1\n",
"M1 = 0.345 \t\t\t\t#Inlet Mach number from gas tables fanno flow tables @X2,k = 1.4\n",
"p2 = 3.14 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"P1 = Pt*p2 \t\t\t\t#Static pressure at inlet in kPa\n",
"t2 = 1.17 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"T1 = Tt*t2 \t\t\t\t#Static temperature at inlet in K\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Mach number at the exit is %3.3f \\\n",
"\\nB)Inlet pressure and temperature are %3.3f kPa and %3.2f K'%(M2,P1,T1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Mach number at the exit is 0.687 \n",
"B)Inlet pressure and temperature are 305.844 kPa and 311.65 K\n"
]
}
],
"prompt_number": 32
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.17 page : 27"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D = 0.0254 \t\t\t\t#inner pipe diameter in m\n",
"f = 0.003 \t\t\t\t#frictional factor\n",
"M1 = 2.5 \t\t\t\t#Inlet Mach number \n",
"To1 = 310. \t\t\t\t#Stagnation temperature at inlet in K\n",
"P1 = 0.507 \t\t\t\t#Static pressure at inlet in kPa\n",
"M2 = 1.2 \t\t\t\t#Exit mach number \n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"t1 = 0.4444 \t\t\t\t#Static to Stagnation temperature ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"T1 = To1*t1 \t\t\t\t#Static temperature at inlet in K\n",
"p1 = 0.05853 \t\t\t\t#Static to Stagnation pressure ratio at entry from gas tables (M1,k = 1.4,isentropic)\n",
"Po1 = P1/p1 \t\t\t\t#Stagantion pressure at inlet in kPa\n",
"a1 = math.sqrt(k*R*T1) \t\t\t\t#Sound velocity at inlet in m/s, R in J/kg\n",
"C1 = a1*M1 \t\t\t\t#air velocity at inlet in m/s\n",
"c1 = 2.95804 \t\t\t\t#Static to Critical velocity ratio at inlet from gas tables,isothermal tables @M1,k = 1.4\n",
"Ctt = C1/c1 \t\t\t\t#Critical velocity at isothermal state in m/s\n",
"p2 = 0.33806 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,isothermal @M1,k = 1.4\n",
"Ptt = P1/p2 \t\t\t\t#Critical pressure at isothermal state in bar\n",
"p3 = 3.61691 \t\t\t\t#Stagnation pressure ratio at inlet to isothermal state from gas tables,isothermal tables @M1,k = 1.4\n",
"Pott = Po1/p3 \t\t\t\t#Critical pressure at isothermal state in K\n",
"t2 = 1.968748 \t\t\t\t#Stagnation temperature ratio at inlet to isothermal state from gas tables,isothermal tables @M1,k = 1.4\n",
"Tott = To1/t2 \t\t\t\t#Critical temperature at isothermal state in K\n",
"X1 = 1.28334 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"c2 = 1.4186 \t\t\t\t#Static to Critical velocity ratio at exit from gas tables,isothermal tables @M2,k = 1.4\n",
"C2 = Ctt*c2 \t\t\t\t#Exit velocity in m/s\n",
"p4 = 0.7043 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,isothermal @M2,k = 1.4\n",
"P2 = Ptt*p4 \t\t\t\t#Exit pressure in bar\n",
"p5 = 1.07026 \t\t\t\t#Stagnation pressure ratio at inlet to isothermal state from gas tables,isothermal tables @M2,k = 1.4\n",
"Po2 = Pott*p5 \t\t\t\t#Stagnation pressure at exit in bar \n",
"t3 = 1.127 \t\t\t\t#Stagnation temperature ratio at inlet to isothermal state from gas tables,isothermal tables @M2,k = 1.4\n",
"To2 = Tott*t3 \t\t\t\t#Stagnation temperature at exit in bar\n",
"T2 = T1 \t\t\t\t#Exit temperature in K, Since isothermal flow\n",
"X2 = 0.19715 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
"X3 = X1-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter\n",
"L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"d1 = (P1*10**5)/(R*T1) \t\t\t\t#Density of air in kg/m**3, P1 in Pa\n",
"A1 = (math.pi*D**2)/4 \t\t\t\t#Cross sectional area of pipe in m**2\n",
"m = d1*A1*C1 \t\t\t\t#Mass flow rate in kg/s\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'At M = %3.1f : A)Static pressure and static temperature are %3.5f bar and %3.3f K respectively \\\n",
"\\nB)Stagnation pressure and temperature are %3.4f bar and %3.3f K respectively \\\n",
"\\nC)Velocity of air is %3.3f m/s \\\n",
"\\nD)Distance of the section from innlet is %3.3f m \\\n",
"\\nE)Mass flow rate is %3.5f kg/s'%(M2,P2,T2,Po2,To2,C2,L1,m)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"At M = 1.2 : A)Static pressure and static temperature are 1.05626 bar and 137.764 K respectively \n",
"B)Stagnation pressure and temperature are 2.5632 bar and 177.458 K respectively \n",
"C)Velocity of air is 282.078 m/s \n",
"D)Distance of the section from innlet is 2.299 m \n",
"E)Mass flow rate is 0.38217 kg/s\n"
]
}
],
"prompt_number": 34
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.18 page : 29"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D = 0.12 \t\t\t\t#inner duct diameter in m\n",
"f = 0.004 \t\t\t\t#frictional factor\n",
"M1 = 0.4 \t\t\t\t#Inlet Mach number \n",
"P1 = 300. \t\t\t\t#Static pressure at inlet in kPa\n",
"T1 = 310. \t\t\t\t#Static temperature at inlet in K\n",
"M2 = 0.6 \t\t\t\t#Exit mach number\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"p1 = 2.118 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"Pt = P1/p1 \t\t\t\t#Critical pressure in kPa\n",
"X1 = 1.968 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"p2 = 1.408 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"P2 = Pt*p2 \t\t\t\t#Exit pressure in kPa\n",
"X2 = 0.299 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
"X3 = X1-X2 \t\t\t\t#Overall frictional consmath.tant fanno parameter\n",
"L1 = (X3*D)/(4*f) \t\t\t\t#Length of the pipe in m\n",
"T2 = T1 \t\t\t\t#Exit temperature in K, Since isothermal flow\n",
"Ttt = T1 \t\t\t\t#Critical temperature at critical state, Since isothermal flow \n",
"Mtt = 1/math.sqrt(k) \t\t\t\t#Limiting Mach number\n",
"L2 = (X1*D)/(4*f) \t\t\t\t#Length of the duct required to attain limiting mach number in m\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Length of the duct required to chnage the mach number to %3.1f is %3.4f m \\\n",
"\\nB)Pressure and temperature at M = %3.1f is %.f kPa and %3i K respectively \\\n",
"\\nC)Length of the duct required to attain limiting mach number is %3.3f m \\\n",
"\\nD)State of air at limiting mach number %3.3f is subsonic'%(M2,L1,M2,P2,T2,L2,Mtt)\n",
"\n",
"# rounding off error."
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Length of the duct required to chnage the mach number to 0.6 is 12.5175 m \n",
"B)Pressure and temperature at M = 0.6 is 199 kPa and 310 K respectively \n",
"C)Length of the duct required to attain limiting mach number is 14.760 m \n",
"D)State of air at limiting mach number 0.845 is subsonic\n"
]
}
],
"prompt_number": 38
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.19 page : 29"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"from numpy import roots\n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"m = 0.32 \t\t\t\t#Mass flow rate in kg/s\n",
"L = 140. \t\t\t\t#Length of the pipe in m\n",
"P1 = 800. \t\t\t\t#Inlet pressure in N/m**2, wrong units in textbook\n",
"T1 = 288. \t\t\t\t#Inlet temperature in K\n",
"P2 = 600. \t\t\t\t#Outlet pressure in N/m**2, wrong units in textbook\n",
"f = 0.006 \t\t\t\t#frictional factor\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"\t\t\t\t#Umath.sing Adiabatic Equation d = 1/((((((math.pi*(d/2)**2)**2)/(2*m**2*R*T))*(P1**2-P2**2))-(math.log(P1/P2)))/(2*f*L)) and converting into 5th degree polynomial of d\n",
"a = (math.pi**2*(P1**2-P2**2))/(32*m**2*R*T1) \t\t\t\t#Coefficient of power 5\n",
"b = math.log(P1/P2) \t\t\t\t#Coefficient of power 1\n",
"c = 2*f*L \t\t\t\t#Coefficient of consmath.tant\n",
"#p5 = poly([-c -b 0 0 0 a],'d','coeff') \t\t\t\t#Solving polynomial of degree 5\n",
"d = roots([a,0,0,0,-b, -c]) \t\t\t\t#Command to find roots\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print (\"Possible values for diameter of pipe are:\") \t\t\t\t#Displays whatever within paranthesis \n",
"print (d) \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#To print lay roots\n",
"print 'Therefore Diameter of the pipe is : %.1f m'%d[0].real\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Possible values for diameter of pipe are:\n",
"[ 0.71338855+0.j 0.20228465+0.67301992j 0.20228465-0.67301992j\n",
" -0.55897893+0.39355091j -0.55897893-0.39355091j]\n",
"Therefore Diameter of the pipe is : 0.7 m\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.20 page: 30"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"Q = 225./60 \t\t\t\t#Discharge in m**3/s\n",
"T2 = 293. \t\t\t\t#Exit temperature in K\n",
"P2 = 1.25 \t\t\t\t#Exit pressure in bar\n",
"L1 = 30. \t\t\t\t#Length of the pipe in m\n",
"D = 0.15 \t\t\t\t#Duct diameter in m\n",
"f = 0.02/4 \t\t\t\t#frictional factor\n",
"k = 1.4 \t\t\t\t#Adiabatic consmath.tant\n",
"R = 287. \t\t\t\t#Gas consmath.tant in J/kg-K\n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"A = math.pi*D**2/4 \t\t\t\t#area in m**2\n",
"C2 = Q/A \t\t\t\t#Exit air velocity in m/s\n",
"a2 = math.sqrt(k*R*T2) \t\t\t\t#Exit sound velocity in m/s \n",
"M2 = C2/a2 \t\t\t\t#Exit mach number \n",
"p1 = 1.703 \t\t\t\t#Static to Critical pressure ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"Pt = P2/p1 \t\t\t\t#Critical pressure in bar\n",
"c1 = 0.654 \t\t\t\t#Static to Critical velocity ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"Ct = C2/c1 \t\t\t\t#Critical velocity in m/s\n",
"t1 = 1.114 \t\t\t\t#Static to Critical temperature ratio at outlet from gas tables,fanno flow tables @M2,k = 1.4\n",
"Tt = T2/t1 \t\t\t\t#Critical temperature in K\n",
"X1 = 0.417 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"X2 = (4*f*L1)/D \t\t\t\t#frictional consmath.tant fanno parameter\n",
"X3 = X1+X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"M1 = 0.32 \t\t\t\t#Mach number at entrance\n",
"p2 = 3.385 \t\t\t\t#Static to Critical pressure ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"P1 = Pt*p2 \t\t\t\t#Static pressure at inlet in bar\n",
"c2 = 0.347 \t\t\t\t#Static to Critical velocity ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"C1 = Ct*c2 \t\t\t\t#Air velocity at inlet in m/s\n",
"t2 = 1.176 \t\t\t\t#Static to Critical temperature ratio at inlet from gas tables,fanno flow tables @M1,k = 1.4\n",
"T1 = Tt*t2 \t\t\t\t#Static temperature at inlet in K\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'Required Inlet Condition: \\\n",
"\\nPressure is %3.4f bar \\\n",
"\\nVelocity is %3.3f m/s \\\n",
"\\nTemperature is %3.1f K'%(P1,C1,T1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Required Inlet Condition: \n",
"Pressure is 2.4846 bar \n",
"Velocity is 112.593 m/s \n",
"Temperature is 309.3 K\n"
]
}
],
"prompt_number": 43
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3.21 page : 31"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math \n",
"\n",
"\t\t\t\t\n",
"#Input data\n",
"D1 = 0.134 \t\t\t\t#Inlet duct diameter in m\n",
"Po1 = 7 \t\t\t\t#Stagnation pressure at inlet in bar\n",
"P1 = 0.245 \t\t\t\t#Static pressure at 5*D1 i.e. L1 in bar\n",
"P2 = 0.5 \t\t\t\t#Static pressure at 33*D1 i.e. L2 in bar\n",
"D2 = 0.0646 \t\t\t\t#throat diameter in m \n",
"L1 = 5*D1 \t\t\t\t#Length of nozzle till section-1 in m\n",
"L2 = 33*D1 \t\t\t\t#Length of nozzle till section-2 in m \n",
"\n",
"\t\t\t\t\n",
"#Calculation\n",
"ar = (D1/D2)**2 \t\t\t\t#Ratio of areas\n",
"p1 = P1/Po1 \t\t\t\t#Pressure ratio\n",
"APR1 = p1*ar \t\t\t\t#Area Pressure ratio i.e. (A1*P1)/(At*Po1)\n",
"M1 = 2.54 \t\t\t\t#Mach number at inlet from isentropic gas tables @APR1 \n",
"X1 = 0.44 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M1,k = 1.4\n",
"APR2 = 0.3073 \t\t\t\t#Area Pressure ratio i.e. (A2*P2)/(At*Po1)\n",
"M2 = 1.54 \t\t\t\t#Exit mach number\n",
"X2 = 0.151 \t\t\t\t#frictional consmath.tant fanno parameter from gas tables,fanno flow tables @M2,k = 1.4\n",
"X3 = X1-X2 \t\t\t\t#overall frictional consmath.tant fanno parameter\n",
"L3 = L2-L1 \t\t\t\t#Length of the nozzle (Section-1 to Section-2) in m \n",
"f = (X3*D1)/(4*L3) \t\t\t\t#frictional factor\n",
"\n",
"\t\t\t\t\n",
"#Output\n",
"print 'A)Mach number at %3.3f m and %3.3f m are %3.2f and %3.2f respectively \\\n",
"\\nB)Mean value of friction between two sections is %3.5f'%(L1,L2,M1,M2,f)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"A)Mach number at 0.670 m and 4.422 m are 2.54 and 1.54 respectively \n",
"B)Mean value of friction between two sections is 0.00258\n"
]
}
],
"prompt_number": 44
}
],
"metadata": {}
}
]
}
|