summaryrefslogtreecommitdiff
path: root/Transport_Phenomena/ch10.ipynb
blob: 4df43e2beb2a199f4f0d2d25bd113e9605062e70 (plain)
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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Fluid flow in ducts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.1 - Page No :405\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Compute the viscosity in CP.\n",
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "T = 30.;          \t\t\t #[degC] - temperature\n",
      "d = 8.265*10**-4;  \t\t\t #[m] - diameter of the capillary viscometer\n",
      "deltapbyL = -0.9364;  \t\t #[psi/ft] - pressure drop per unit length\n",
      "\n",
      "# Calculations\n",
      "deltapbyL = deltapbyL*(2.2631*10**4);  \t\t\t #[kg/m**2*sec**2] - pressure drop per unit length\n",
      "Q = 28.36*(10**-6)*(1./60);\n",
      "p = (0.88412-(0.92248*10**-3)*T)*10**3;  \t\t\t #[kg/m**3] - density\n",
      "s = (math.pi*(d**2))/4.;\n",
      "U = Q/s;\n",
      "tauw = (d/4.)*(-deltapbyL);\n",
      "shearrate = (8*U)/d;\n",
      "mu = tauw/(shearrate);\n",
      "\n",
      "# Results\n",
      "print \" The viscosity is  mu = %.3ef kg/m*sec = %.4f cP\"%(mu,mu*10**3);\n",
      "print \" Finally, it is important to check the reynolds number to make sure the above equation applies\"\n",
      "Nre = (d*U*p)/(mu);\n",
      "print \" Nre = %d\"%Nre\n",
      "print \" The flow is well within the laminar region and therefore the above equation applies\";\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The viscosity is  mu = 5.135e-04f kg/m*sec = 0.5135 cP\n",
        " Finally, it is important to check the reynolds number to make sure the above equation applies\n",
        " Nre = 1214\n",
        " The flow is well within the laminar region and therefore the above equation applies\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.2 - Page No :407\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Compute the pressure drop for the same 0.032%in \n",
      "\n",
      "# Variables\n",
      "Nreold = 1214.;\n",
      "Uold = 0.8810;\n",
      "Nre = 13700.;\n",
      "U = Uold*(Nre/Nreold);\n",
      "Lbyd = 744.;\n",
      "T = 30.; \n",
      "\n",
      "# Calculations\n",
      "# umath.sing the newton raphson method to calculate the value of f from the equation - 1/(f**(1/2)) = 4*math.log(Nre*(f**(1/2)))-0.4\n",
      "f = 0.007119;\n",
      "p = (0.88412-(0.92248*10**-3)*T)*10**3;  \t\t\t #[kg/m**3] - density\n",
      "tauw = (1./2)*p*(U**2)*f;\n",
      "deltap = tauw*(4.)*(Lbyd);\n",
      "d = 0.03254/12;  \t\t\t #[ft]\n",
      "L = Lbyd*d;\n",
      "\n",
      "# Results\n",
      "print \" Pressure drop is  -deltap = %.3e N/m**2 = %.1f kpa = 130 psi\"%(deltap,deltap*10**-3);  \n",
      "print \" A pressure drop of 130 psi on a tube of length of %.3f ft is high and \\\n",
      "\\nshows the impracticality of flows at high reynolds number in smaller tubes\"%(L);\n",
      "\n",
      "# Answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure drop is  -deltap = 8.968e+05 N/m**2 = 896.8 kpa = 130 psi\n",
        " A pressure drop of 130 psi on a tube of length of 2.017 ft is high and \n",
        "shows the impracticality of flows at high reynolds number in smaller tubes\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.3 - Page No :414\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the pressure drop in a pipe of 6-cm inside diameter for water flowing\n",
      "\n",
      "# Variables\n",
      "u = 1./60;  \t\t\t #[m/sec] - velocity\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "mu = 1*10.**-3;  \t\t #[kg/m*sec] - vismath.cosity\n",
      "d = 6*10.**-2;  \t\t #[m] - insid_e diameter of tube\n",
      "L = 300.;  \t\t\t     #[m] - length of the tube\n",
      "\n",
      "# Calculations\n",
      "Nre = (d*u*p)/(mu);\n",
      "f = 16./Nre;\n",
      "deltap = (4.*f)*(L/d)*((p*(u**2))/2.);\n",
      "\n",
      "# Results\n",
      "print \"Nre = \",Nre,\"therefore the flow is laminar\"\n",
      "print \"f = \" , f\n",
      "print \"Pressure drop -delta P = %.2f N/m**2  =  %.4f kPa  =  %.3e psi\"%(deltap,deltap*10**-3,deltap*1.453*10**-4);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nre =  1000.0 therefore the flow is laminar\n",
        "f =  0.016\n",
        "Pressure drop -delta P = 44.44 N/m**2  =  0.0444 kPa  =  6.458e-03 psi\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.4 - Page No :415\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "Repeat the previous example for Reynolds numbers of 10 000 and\n",
      "100 000. Contrast smooth pipe with commercial steel pipe and cast iron pipe.\n",
      "'''\n",
      "\n",
      "from numpy import *\n",
      "\n",
      "# Variables\n",
      "# given\n",
      "d = 6.*10**-2;  \t\t\t #[m] - insid_e diameter of tube\n",
      "p = 1000.;        \t\t\t #[kg/m**3] - density\n",
      "# for smooth pipe\n",
      "Nre = array([10**4, 10**5]);\n",
      "f = array([0.0076, 0.0045]);\n",
      "mu = 10.**-3;     \t\t\t #[kg/m**2*s]\n",
      "U = (Nre*mu)/(d*p);\n",
      "L = 300.;  \t\t\t #[m] - length of the tube\n",
      "\n",
      "# Calculations\n",
      "deltap = zeros(2)\n",
      "for i in range(2):\n",
      "    deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2.);\n",
      "\n",
      "\n",
      "# Results\n",
      "print \"for smooth pipe\"\n",
      "print \"   Nre      f         -deltap\";\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[0],f[0],deltap[0])\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[1],f[1],deltap[1])\n",
      "\n",
      "# for commercial steel\n",
      "Nre = array([10**4, 10**5]);\n",
      "f = array([0.008 ,0.0053]);\n",
      "U = (Nre*mu)/(d*p);\n",
      "L = 300.;  \t\t\t #[m] - length of the tube\n",
      "for i in range(2):\n",
      "    deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);\n",
      "\n",
      "print \"\\nfor commercial steel pipe\"\n",
      "print \"   Nre      f         -deltap\";\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[0],f[0],deltap[0])\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[1],f[1],deltap[1])\n",
      "\n",
      "# for cast iron pipe\n",
      "Nre = array([10**4 ,10**5]);\n",
      "f = array([0.009 ,0.0073]);\n",
      "U = (Nre*mu)/(d*p);\n",
      "L = 300.;  \t\t\t #[m] - length of the tube\n",
      "for i in range(2):\n",
      "    deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);\n",
      "\n",
      "print \"\\nfor cast iron pipe\"\n",
      "print \"   Nre      f         -deltap\";\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[0],f[0],deltap[0])\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[1],f[1],deltap[1])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for smooth pipe\n",
        "   Nre      f         -deltap\n",
        "  10000    0.0076     2111.111\n",
        " 100000    0.0045     125000.000\n",
        "\n",
        "for commercial steel pipe\n",
        "   Nre      f         -deltap\n",
        "  10000    0.0080     2222.222\n",
        " 100000    0.0053     147222.222\n",
        "\n",
        "for cast iron pipe\n",
        "   Nre      f         -deltap\n",
        "  10000    0.0090     2500.000\n",
        " 100000    0.0073     202777.778\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.5 - Page No :417\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Find, the maximum flow velocity by trial and error.\n",
      "\n",
      "# Variables\n",
      "L = 300.;  \t\t\t #[m] - length of pipe\n",
      "d = 0.06;  \t\t\t #[m] - insid_e diameter\n",
      "deltap = 147.*10**3;  \t\t #[Pa] - pressure the pump can supply\n",
      "ebyd = 0.000762;  \t\t\t # relative roughness\n",
      "p = 1000.;  \t\t\t     #[kg/m**3] - density\n",
      "mu = 1.*10**-3;  \t\t\t #[kg/m*sec] - viscosity\n",
      "tauw = (d*(deltap))/(4.*L);\n",
      "\n",
      "# using the hit and trial method for estimation of flow velocity\n",
      "# Calculations\n",
      "# let \n",
      "f = 0.005;\n",
      "U = ((2*tauw)/(p*f))**(1./2);\n",
      "Nre = (d*U*p)/mu;\n",
      "\n",
      "# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n",
      "f = 0.0054;\n",
      "U = ((2*tauw)/(p*f))**(1./2);\n",
      "Nre = (d*U*p)/mu;\n",
      "\t\t\t # from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n",
      "f = 0.0053;\n",
      "U = ((2*tauw)/(p*f))**(1./2);\n",
      "Nre = (d*U*p)/mu;\n",
      "\n",
      "# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n",
      "f = 0.0053;\n",
      "# At this point the value of f is deemed unchanged from the last iteration .Hence, the values obtained after the third iteration are the converged values\n",
      "\n",
      "# Results\n",
      "print \" The maximum flow velocity is  U = %f m/sec\"%(U);\n",
      "\n",
      "# Answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The maximum flow velocity is  U = 1.665408 m/sec\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.6 - Page No :419\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Repeat Example 10.5 using the von Karman plot, Fig. 10.5.\n",
      "\n",
      "# Variables\n",
      "L = 300.;  \t\t\t #[m] - length of pipe\n",
      "d = 0.06;  \t\t\t #[m] - insid_e diameter\n",
      "deltap = 147.*10**3;  \t #[Pa] - pressure the pump can supply\n",
      "ebyd = 0.000762;  \t\t # relative roughness\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "\n",
      "# Calculations\n",
      "mu = 1*10**-3;  \t\t\t #[kg/m*sec] - viscosity\n",
      "Nvk = ((d*p)/mu)*((d*(deltap))/(2*L*p))**(1./2);\n",
      "\n",
      "# From the fig  at given von karman no and relative roughness the value of f is-\n",
      "f = 0.0055;\n",
      "Nre = Nvk/(f**(1./2))\n",
      "U = (Nre*mu)/(d*p);\n",
      "\n",
      "# Results\n",
      "print \"von karman no. %.0f\"%Nvk\n",
      "print \" Average velocity = %.2f m/sec\"%(U);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "von karman no. 7275\n",
        " Average velocity = 1.63 m/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.7 - Page No :422\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# estimate the pressure drop in a 0.06-m ID commercial steel pipe at Reynolds numbers of 104 and 16\n",
      "\n",
      "# Variables\n",
      "L = 300.;  \t\t\t #[m] - length of pipe\n",
      "d = 0.06;  \t\t\t #[m] - insid_e diameter\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "mu = 1.*10**-3;  \t\t\t #[kg/m*sec] - vismath.cosity\n",
      "\n",
      "# Calculations\n",
      "Nre = array([10.**4, 10.**5]);\n",
      "U = (Nre*mu)/(d*p);\n",
      "velocityhead = (U**2)/2.;\n",
      "N = (L/d)/45.;  \t\t\t # no of velocity heads\n",
      "deltap = p*N*(velocityhead);\n",
      "\n",
      "# Results\n",
      "for i in range(2):\n",
      "    print \"Nre = \",Nre[i]\n",
      "    print \" velocity head  = %.5f m**2/sec**2\"%(velocityhead[i]);\n",
      "    print \" -deltap  =  %.3f kPa  =  %.3f psi\"%(deltap[i]*10**-3,deltap[i]*1.453*10**-4);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nre =  10000.0\n",
        " velocity head  = 0.01389 m**2/sec**2\n",
        " -deltap  =  1.543 kPa  =  0.224 psi\n",
        "Nre =  100000.0\n",
        " velocity head  = 1.38889 m**2/sec**2\n",
        " -deltap  =  154.321 kPa  =  22.423 psi\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.8 - Page No :439\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Compute p, by (a) the equivalent length method and (b) the loss coefficient method.\n",
      "\n",
      "# Variables\n",
      "mu = 6.72*10**-4;  \t\t #[lb/ft*sec] - vismath.cosity\n",
      "p = 62.4;  \t\t\t     #[lb/ft**3] - density\n",
      "S = 0.03322;  \t\t\t #[ft**2] - flow area\n",
      "d = 0.206;  \t\t\t #[ft]\n",
      "e = 1.5*10**-4;  \t\t # absolute roughness for steel pipe\n",
      "ebyd = e/d;\n",
      "Nre = 10.**5;\n",
      "\n",
      "# friction factor as read from fig in book for the given reynolds no. and relative roughness is-\n",
      "f = 0.0053;\n",
      "U = (Nre*mu)/(p*d);\n",
      "Q = U*S;\n",
      "gc = 32.174;\n",
      "\n",
      "# Calculations\n",
      "# (a) equivalent length method\n",
      "deltapbyL = f*(4/d)*(p*(U**2))*(1/(2*gc))*(6.93*10**-3);\n",
      "\n",
      "# using L = Lpipe+Lfittings+Lloss;\n",
      "Lfittings = 2342.1*d;\n",
      "kc = 0.50;  \t\t\t #  due to contraction loss\n",
      "ke = 1.;  \t\t\t # due to enlargement loss\n",
      "Lloss = (kc+ke)*(1./(4*f))*d;\n",
      "Lpipe = 137.;\n",
      "L = Lpipe+Lfittings+Lloss;\n",
      "deltap = deltapbyL*L;\n",
      "patm = 14.696;  \t\t\t #[psi] - atmospheric pressure\n",
      "p1 = patm+deltap;\n",
      "print \" a)The inlet pressure is p1 = %.1f psi\"%(p1);\n",
      "\n",
      "# (b) loss coefficient method\n",
      "# using the equation deltap/p = -(Fpipe+Ffittings+Floss)\n",
      "L = 137.;\n",
      "kfittings = 52.39;\n",
      "sigmaF = ((4.*f*(L/d))+kc+ke+kfittings)*((U**2)/(2*gc));\n",
      "deltap = (p*sigmaF)/(144.);\n",
      "p1 = patm+deltap;\n",
      "\n",
      "# Results\n",
      "print \" b)The inlet pressure is  p1 = %.1f psi\"%(p1);\n",
      "print \" Computation of the pressure drop by the loss coefficient method differs from the equivalent length \\\n",
      " \\nmethod by less than 1 psi\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a)The inlet pressure is p1 = 26.7 psi\n",
        " b)The inlet pressure is  p1 = 27.2 psi\n",
        " Computation of the pressure drop by the loss coefficient method differs from the equivalent length  \n",
        "method by less than 1 psi\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.9 - Page No :443\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Determine the total flow rate of water through the pipe system.\n",
      "\n",
      "# Variables\n",
      "L1 = 50.;  \t\t\t #[m] - length of first pipe\n",
      "L2 = 150.;  \t\t\t #[m] - length of second pipe\n",
      "L3 = 100.;  \t\t\t #[m] - length of third pipe\n",
      "d1 = 0.04;  \t\t\t #[m] - diameter of first pipe\n",
      "d2 = 0.06;  \t\t\t #[m] - diameter of second pipe\n",
      "d3 = 0.08;  \t\t\t #[m] - diameter of third pipe\n",
      "deltap = -1.47*10**5;  \t\t\t #[kg/m*sec] - pressure drop\n",
      "mu = 1*10.**-3;  \t\t\t #[kg/m*sec] - vismath.cosity\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "\n",
      "# Calculation and Results\n",
      "# for branch 1\n",
      "S = (math.pi*(d1**2))/4;\n",
      "Nvk = ((d1*p)/mu)*(-(d1*deltap)/(2*L1*p))**(1./2);\n",
      "f = (1./(4*math.log10(Nvk)-0.4))**2;\n",
      "U = (((-deltap)/p)*(d1/L1)*(2./4)*(1./f))**(1./2);\n",
      "w1 = p*U*S;\n",
      "print \" For first branch w1 = %.2f kg/sec\"%(w1);\n",
      "\t\t\t # for branch 2\n",
      "S = (math.pi*(d2**2))/4;\n",
      "Nvk = ((d2*p)/mu)*(-(d2*deltap)/(2*L2*p))**(1./2);\n",
      "f = (1./(4*math.log10(Nvk)-0.4))**2;\n",
      "U = (((-deltap)/p)*(d2/L2)*(2./4)*(1./f))**(1./2);\n",
      "w2 = p*U*S;\n",
      "print \" For second branch w2 = %.2f kg/sec\"%(w2);\n",
      "\t\t\t # for branch 3\n",
      "S = (math.pi*(d3**2))/4;\n",
      "Nvk = ((d3*p)/mu)*(-(d3*deltap)/(2*L3*p))**(1./2);\n",
      "f = (1./(4*math.log10(Nvk)-0.4))**2;\n",
      "U = (((-deltap)/p)*(d3/L3)*(2./4)*(1./f))**(1./2);\n",
      "w3 = p*U*S;\n",
      "print \" For third branch w3 = %.2f kg/sec\"%(w3);\n",
      "\n",
      "# total flow rate w = w1+w2+w3\n",
      "w = w1+w2+w3;\n",
      "print \" total flow rate is w = %.1f kg/sec\"%(w);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " For first branch w1 = 4.74 kg/sec\n",
        " For second branch w2 = 7.59 kg/sec\n",
        " For third branch w3 = 20.42 kg/sec\n",
        " total flow rate is w = 32.7 kg/sec\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.10 Page no : 445"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find flow rate\n",
      "\n",
      "import math\n",
      "\n",
      "# Note : all variables values are taken from 10.9\n",
      "# variables  \n",
      "w1 = 4.74       #kg/sec\n",
      "w2 = 7.59       #kg/sec\n",
      "w3 = 20.42      #kg/sec\n",
      "w = 32.7        #kg/sec\n",
      "d = .04\n",
      "\n",
      "S1 = math.pi*d**2/4\n",
      "S2 = .002827\n",
      "S3 = .005027\n",
      "deltaP = 1.47 * 10**5      #kpa\n",
      "deltaP1 = 1.583* 10**6     #f1w**2\n",
      "deltaP2 = 6.254* 10**5     #f1w**2\n",
      "deltaP3 = 9.895* 10**4     #f1w**2\n",
      "Nre1 = 3.183 * 10**4       #w\n",
      "Nre2 = 2.122 * 10**4       #w\n",
      "Nre3 = 1.592 * 10**4       #w\n",
      "\n",
      "\n",
      "###  age plz tu kar dena muje kuchh samaj nahi aa raha he...\n",
      "### Thanks in advance..... nahi to ye delete kar dena... mere se nahi hota. plz.\n",
      "print S1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.00125663706144\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.11 - Page No : 447\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "Determine the pump size necessary to maintain a spray\n",
      "velocity of 15 ft s-\u2019 and a flow rate of 400 gpm if the pump is 60 percent efficient.\n",
      "'''\n",
      "\n",
      "# Variables\n",
      "sp = 1.1;\n",
      "p = sp*62.4;  \t\t\t #[lb/ft**3] - density\n",
      "mu = 2*6.72*10**-4;  \t #[lb/ft*sec] - viscosity\n",
      "Q = 400.;  \t\t\t     #[gpm] - volumetric flow rate\n",
      "e = 1.5*10**4;  \t\t #roughness of steel pipe\n",
      "gc = 32.174;\n",
      "kexit = 1.;\n",
      "kentrance = 0.5;\n",
      "\n",
      "# Calculations\n",
      "# 4 in schedule pipe\n",
      "d = 4.026/12;  \t\t\t #[ft]\n",
      "U4 = Q/39.6;  \t\t\t #[ft/sec]\n",
      "Lgv = 13.08;\n",
      "Lglv = 114.1;\n",
      "Le = 40.26;\n",
      "Lpipe_4 = 22.;\n",
      "Lfittings_4 = Lgv+Lglv+Le;\n",
      "Lloss = 0;\n",
      "L_4 = Lpipe_4+Lfittings_4+Lloss;\n",
      "Nre_4 = (d*U4*p)/mu;\n",
      "f = 0.00475;\n",
      "Fpipe_4 = ((4*f*L_4)/d)*(U4**2)*(1/(2*gc));\n",
      "Floss_4 = ((kentrance+0)*(U4**2))/(2*gc);\n",
      "\n",
      "# 5 in schedule pipe\n",
      "d = 5.047/12;\n",
      "U5 = Q/62.3;\n",
      "Lgv = 10.94;\n",
      "Le = 75.71;\n",
      "Lpipe_5 = 100.;\n",
      "Lfittings_5 = Lgv+Le;\n",
      "Lloss = 0.;\n",
      "L_5 = Lpipe_5+Lfittings_5+Lloss;\n",
      "Nre = (d*U5*p)/mu;\n",
      "f = 0.00470;\n",
      "Fpipe_5 = ((4*f*L_5)/d)*(U5**2)*(1./(2*gc));\n",
      "Floss_5 = ((kexit+0)*(U5**2))/(2*gc);\n",
      "\n",
      "# 6 in schedule pipe\n",
      "d = 6.065/12;\n",
      "U6 = Q/90.;\n",
      "Lgv = 6.570;\n",
      "Le = 30.36;\n",
      "Lpipe_6 = 4.;\n",
      "Lfittings_6 = Lgv+Le;\n",
      "Lloss = 0.;\n",
      "L_6 = Lpipe_6+Lfittings_6+Lloss;\n",
      "Nre = (d*U6*p)/mu;\n",
      "f = 0.00487;\n",
      "Fpipe_6 = ((4*f*L_6)/d)*(U6**2)*(1./(2*gc));\n",
      "kc = 0.50;\n",
      "Floss_6 = kc*((U6**2)/(2*gc));\n",
      "Ffittings = 0.;\n",
      "deltap_6 = p*(Fpipe_6+Ffittings+Floss_6);\n",
      "\n",
      "# 3/4 in 18 gauge tube\n",
      "d = 0.652112/12;\n",
      "L_3by4 = 15.;\n",
      "U_3by4 = (Q*0.962)/100.;\n",
      "Floss_3by4 = 100.*(kexit+kentrance)*((U_3by4**2.)/2.);\n",
      "Nre = d*U_3by4*p*(1./mu);\n",
      "f = 0.08*((Nre)**(-1./4))+0.012*((d)**(1./2));\n",
      "deltap_3by4 = ((4*f*p*L_3by4)/d)*((U_3by4**2)/(2*gc));\n",
      "Fpipe_3by4 = 100.*((4.*f*L_3by4)/d)*((U_3by4**2.)/(2.*gc));\n",
      "deltap_spraysystem = 25.; \t\t\t #[psi]\n",
      "Fspraysystem = (deltap_spraysystem/p)*(144.);\n",
      "delta_p = (p*(kexit+kentrance))*((U_3by4**2.)/(2.*gc))\n",
      "Fpipe = Fpipe_4+Fpipe_5+Fpipe_6;\n",
      "Floss = Floss_4+Floss_5+Floss_6+Floss_3by4;\n",
      "ws = 0. + (((15.**2)-0)/(2*gc))+38.9+382.5;\n",
      "w = (Q*p)/(7.48);\n",
      "Ws = (ws*w)/(33000.);\n",
      "efficiency = 0.6;\n",
      "Ws_actual = Ws/efficiency\n",
      "\n",
      "# Results\n",
      "print \" The power supplied to the pump is  %.1f hp\"%(Ws_actual);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The power supplied to the pump is  78.8 hp\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.12 - Page No :454\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Estimate the power required in the previous problem by using the velocity head approximation\n",
      "\n",
      "# Variables\n",
      "kexit = 1.;\n",
      "kentrance = 0.5;\n",
      "Q = 400.;  \t\t\t #[gpm] - volumetric flow rate\n",
      "gc = 32.174;\n",
      "\n",
      "# for 4 inch pipe\n",
      "d = 4.026;  \t\t #[inch]\n",
      "L = 22.;  \t\t\t #[ft]\n",
      "Lbyd = (L*12)/(d);\n",
      "\n",
      "# Calculation and Results\n",
      "# adding the contributions due to fittings \n",
      "Lbyd = Lbyd+3*13+340+4*30;\n",
      "N = Lbyd/45.;\n",
      "N = N+kentrance+0;\n",
      "U4 = Q/39.6;  \t\t\t #[ft/sec]\n",
      "Fpipe_4 = (N*(U4**2))/(2*gc);\n",
      "print \" F4 in.pipes  =  %.2f ft*lbf/lbm\"%(Fpipe_4);\n",
      "\n",
      "# for 5 inch pipe\n",
      "L = 100.;  \t\t\t     #[ft]\n",
      "d = 5.047;  \t\t\t #[inch]\n",
      "Lbyd = (L*12.)/(d);\n",
      "\n",
      "# valves contributes 26 diameters and six elbows contribute 30 diameters ecah;therefore\n",
      "Lbyd = Lbyd+26+6*30;\n",
      "N = Lbyd/45.;  \t\t\t # no. of velocity heads\n",
      "N = N+kexit+kentrance;\n",
      "U5 = Q/62.3;\n",
      "Fpipe_5 = (N*(U5**2))/(2*gc);\n",
      "print \" F5 in.pipes  =  %.2f ft*lbf/lbm\"%(Fpipe_5);\n",
      "\n",
      "# for 6 inch pipe\n",
      "d = 6.065;  \t\t #[inch]\n",
      "L = 5.;  \t\t\t #[ft]\n",
      "Lbyd = (L*12.)/(d);\n",
      "\n",
      "# adding the contributions due to fittings \n",
      "Lbyd = Lbyd+1*13+2*30;\n",
      "N = Lbyd/45;\n",
      "N = N+0+kentrance;\n",
      "U6 = Q/90.;\n",
      "Fpipe_6 = (N*(U6**2))/(2*gc);\n",
      "print \" F6 in.pipes  =  %.3f ft*lbf/lbm\"%(Fpipe_6);\n",
      "F_largepipes = Fpipe_4+Fpipe_5+Fpipe_6;\n",
      "print \" Flarge pipes  =  %.2f ft*lbf/lbm\"%(F_largepipes);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " F4 in.pipes  =  20.69 ft*lbf/lbm\n",
        " F5 in.pipes  =  7.28 ft*lbf/lbm\n",
        " F6 in.pipes  =  0.719 ft*lbf/lbm\n",
        " Flarge pipes  =  28.68 ft*lbf/lbm\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.14 - Page No :459\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Determine the pressure drop over a length of 300 m if the flow velocity is 1.667 m\n",
      "\n",
      "\n",
      "# Variables\n",
      "l = 0.09238;\n",
      "rh = 0.1624*l;\n",
      "L = 300.;\n",
      "de = 4.*rh;\n",
      "p = 1000.;  \t\t\t #[kg/m**3]\n",
      "mu = 10.**-3;  \t\t\t #[kg/m*sec]\n",
      "Uavg = 1.667;\n",
      "\n",
      "# Calculations\n",
      "Nre = (de*Uavg*p)/mu;\n",
      "f = 0.0053;\n",
      "deltap = ((4.*f*L)/de)*(p*(Uavg**2)*(1./2));\n",
      "\n",
      "# Results\n",
      "print \" Pressure drop -deltap  =  %.3e kg/m*s  =  %.3e N/m**2  =  %.1f kPa\"%(deltap,deltap,deltap*10**-3);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure drop -deltap  =  1.473e+05 kg/m*s  =  1.473e+05 N/m**2  =  147.3 kPa\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.15 - Page No :466\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "'''\n",
      "Size a sharp-edged, corner-tap orifice meter for the 4-in. leg in\n",
      "Fig. 10.17 if the flow rate and fluid are unchanged from Example 10.11.\n",
      "'''\n",
      "\n",
      "# Variables\n",
      "Q = 400.;         \t\t\t #[gpm]\n",
      "p = 1.1*62.4;  \t    \t\t #[lbm/ft**3]\n",
      "mu = 2.*(6.72*10**-4);  \t #[lb/ft*sec]\n",
      "e = 1.5*10**4;\n",
      "\n",
      "# Calculations\n",
      "# 4 inch schedule pipe\n",
      "d = 0.3355;\n",
      "S = (math.pi*(d**2))/4;\n",
      "U4 = Q/39.6;\n",
      "ebyd = e/d;\n",
      "w = 3671./60;\n",
      "pm = 13.45*62.4;\n",
      "g = 32.1;\n",
      "gc = 32.174;\n",
      "deltaz = 2.5;\n",
      "deltap = (g/gc)*(pm-p)*(deltaz);\n",
      "betaa = ((1.)/(1.+((2*p*gc)*(deltap))*(((0.61*S)/w)**2)))**(1./4);\n",
      "d2 = betaa*d;\n",
      "Nre2 = (4*w)/(math.pi*d2*mu);\n",
      "a = (1./30)*4.026;\n",
      "b = (1./4)*(2.013-1.21);\n",
      "c = (1./8)*(2.42);\n",
      "if a<b :\n",
      "    if a<c :\n",
      "        opt = a;\n",
      "    else:\n",
      "        opt = c;\n",
      "else:\n",
      "    if b<c:\n",
      "        opt = b;\n",
      "    else:\n",
      "        opt = c;\n",
      "\n",
      "# Results\n",
      "print \" The pertinent orifice details are  orifice diameter  =  %.3f in  corner taps, \\\n",
      " \\n square edge orifice plate not over %.3f in thick\"%(d2*12,opt);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pertinent orifice details are  orifice diameter  =  2.425 in  corner taps,  \n",
        " square edge orifice plate not over 0.134 in thick\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.16 - Page No :470\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Size a venturi meter for the application cited in Example 10.15\n",
      "\n",
      "# Variables\n",
      "Q = 400.;     \t    \t\t        #[gpm]\n",
      "p = 1.1*62.4;     \t\t\t        #[lbm/ft**3]\n",
      "mu = 2*(6.72*10**-4);  \t\t\t    #[lb/ft*sec]\n",
      "e = 1.5*10**4;\n",
      "\n",
      "# Calculations\n",
      "# 4 inch schedule pipe\n",
      "d = 0.3355;\n",
      "S = (math.pi*(d**2))/4;\n",
      "U4 = Q/39.6;\n",
      "ebyd = e/d;\n",
      "w = 3671./60;\n",
      "pm = 13.45*62.4;\n",
      "g = 32.1;\n",
      "gc = 32.174;\n",
      "Nre = (d*U4*p)/mu;\n",
      "if Nre>10**4:\n",
      "    c = 0.98;\n",
      "\n",
      "deltaz = 2.5;\n",
      "deltap = (g/gc)*(pm-p)*(deltaz);\n",
      "betaa = ((1.)/(1+((2*p*gc)*(deltap))*(((c*S)/w)**2)))**(1./4);\n",
      "d2 = betaa*d;\n",
      "\n",
      "# Results\n",
      "print \" The pertinentr details of the venturi design are Throat diameter  =  %.2f inch \\\n",
      "\\n Approach angle   =  25 Divergence angle  =  7\"%(d2*12);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pertinentr details of the venturi design are Throat diameter  =  1.95 inch \n",
        " Approach angle   =  25 Divergence angle  =  7\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.17 - Page No :477\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Then compute the average velocity by Eq. (10.88) and compare with the 2.778 ft s-l as given.\n",
      "\n",
      "# Variables\n",
      "Uzmax = 3.455;  \t\t\t #[ft/sec]\n",
      "m = 32;\n",
      "a1 = -0.3527;\n",
      "a2 = -0.6473;\n",
      "rbyro = 0.880;\n",
      "\n",
      "# Calculations\n",
      "UzbyUzmax = 1+a1*(rbyro**2)+a2*(rbyro**(2*m));\n",
      "Uz = Uzmax*(UzbyUzmax);\n",
      "Uzavg = (4./9)*Uzmax+(5./18)*(Uz+Uz);\n",
      "\n",
      "# Results\n",
      "print \" the average velocity is  Uzavg  =  %.2f ft/sec  \\\n",
      "\\n Thus, in this Example  there is an  inherent error of 5.5 percent, even before any experimental errors are introduced\"%(Uzavg);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the average velocity is  Uzavg  =  2.93 ft/sec  \n",
        " Thus, in this Example  there is an  inherent error of 5.5 percent, even before any experimental errors are introduced\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}