summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_by_Irfan_A._Khan/Chapter9.ipynb
blob: 279e480ab9d12ed078001347b7d9459dfbbc88e2 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 9 : Turbulent flow in Pipes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.1 Page no 308"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "It is a laminar flow\n",
      "(a) Head loss due to flow for glycerine = 17.1 m \n",
      "The flow is turbulent\n",
      "(a) Head loss due to flow for water = 5.42 m \n"
     ]
    }
   ],
   "source": [
    "# Determine Head loss\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "S = 1.26                # specific gravity\n",
    "\n",
    "mu = 0.826              # kinematic viscosity in Ns/m**2\n",
    "\n",
    "# for water\n",
    "\n",
    "rho = 998               # density of water in kg/m**3\n",
    "\n",
    "mu1 = 1.005*10**-3      # viscosity in Ns/m**2\n",
    "\n",
    "# for glycerine\n",
    "\n",
    "rho1 = S*rho            # density of glycerine in kg/m**3\n",
    "\n",
    "Q = 0.1                 # discharge in m**3/s\n",
    "\n",
    "d1 = 0.2                # diameter in m\n",
    "\n",
    "A = pi*d1**2/4          # area in m**2\n",
    "\n",
    "g = 9.81                # acceleration due to gravity in m/s**2\n",
    "\n",
    "l =100                  # length of the pipe\n",
    "\n",
    "# Solution\n",
    "\n",
    "V = Q/A\n",
    "\n",
    "R = rho1*V*d1/mu\n",
    "\n",
    "print \"It is a laminar flow\"\n",
    "\n",
    "f = 64/R               # friction factor\n",
    "\n",
    "Hf = f*l*V**2/(2*g*d1) # head loss due to friction\n",
    "\n",
    "print \"(a) Head loss due to flow for glycerine =\",round(Hf,1),\"m \"\n",
    "\n",
    "R1 = rho*V*d1/mu1\n",
    "\n",
    "print \"The flow is turbulent\"\n",
    "\n",
    "e = 0.025\n",
    "\n",
    "r = e/(d1*100)\n",
    "\n",
    "f = 0.021\n",
    "\n",
    "hf = f*l*V**2/(2*g*d1)\n",
    "\n",
    "print \"(a) Head loss due to flow for water =\",round(hf,2),\"m \"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.2 Page no 311"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.1853324563\n",
      "Discharge = 0.1 m**3/s\n"
     ]
    }
   ],
   "source": [
    "# Discharge of water\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "# for water\n",
    "\n",
    "nu = 1.007*10**-6            # viscosity in m**2/s\n",
    "\n",
    "e = 0.025                    # for cast iron in cm\n",
    "\n",
    "L = 100                      # length of the pipe in m\n",
    "\n",
    "D = 0.2                      # diameter in m\n",
    "\n",
    "hf = 5.43                    # head loss due to friction\n",
    "\n",
    "r = e/(D*100)\n",
    "\n",
    "g = 9.81                     # acceleration due to gravity in m/s**2\n",
    "\n",
    "# Solution\n",
    "\n",
    "A = sqrt(2*g*D*hf/L)\n",
    "\n",
    "B = D/nu\n",
    "\n",
    "f = 0.021                   # from moodys diagram\n",
    "\n",
    "V = A/sqrt(f)\n",
    "\n",
    "print V\n",
    "\n",
    "R = B*f\n",
    "\n",
    "A = pi*D**2/4\n",
    "\n",
    "Q = A*V\n",
    "\n",
    "print \"Discharge =\",round(Q,2),\"m**3/s\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.3 Page no 314"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hence the convergence is attained, D= 0.2 m\n"
     ]
    }
   ],
   "source": [
    "# Size of the case iron\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "Q =0.1                          # discharge in m**3/s\n",
    "\n",
    "hf = 5.43                       # friction loss head in m\n",
    "\n",
    "L = 100                         # length of pipe\n",
    "\n",
    "nu = 1.00*10**-6                # viscosity in m**2/s\n",
    "\n",
    "e = 0.025                       # for cast iron in cm\n",
    "\n",
    "g = 9.81                        # acceleration due to gravity in m/s**2\n",
    "\n",
    "# Solution\n",
    "\n",
    "A = 8*L*Q**2/(hf*g*pi**2)\n",
    "\n",
    "B = 4*Q/(pi*nu)\n",
    "\n",
    "# for D = 0.172 ; f=0.01\n",
    "D = 0.172\n",
    "\n",
    "r = e/D\n",
    "\n",
    "Re = B/D\n",
    "\n",
    "f = 0.022                       # for Re and r\n",
    "\n",
    "# for D1=0.199 ; f=0.021\n",
    "\n",
    "D1 = 0.199\n",
    "\n",
    "r1 = e/D1\n",
    "\n",
    "R = B/D1\n",
    "\n",
    "f = 0.021                       # for R and r\n",
    "\n",
    "print \"Hence the convergence is attained, D=\",round(D1,1),\"m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.4 Page no 318"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head loss = 2.0 ft\n"
     ]
    }
   ],
   "source": [
    "# Head loss \n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "L = 500                 # length of the pipe in ft\n",
    "\n",
    "D= 9*2.54/100           # diameter in cm\n",
    "\n",
    "C = 100                 # constant\n",
    "\n",
    "S = 0.004\n",
    "\n",
    "# Solution\n",
    "\n",
    "Hf = S*L\n",
    "\n",
    "print \"Head loss =\",round(Hf,0),\"ft\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.5 Page no 319"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head loss of water = 3.2 m\n"
     ]
    }
   ],
   "source": [
    "# Head loss of water\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "Q = 0.1                  # water flow rate in m**3/s\n",
    "\n",
    "d = 30                  # diameter in m\n",
    "\n",
    "l = 500                  # length in m\n",
    "\n",
    "e = 0.025                # for cast iron\n",
    "\n",
    "g = 9.81                 # acceleration due to gravity in m/s**2\n",
    "\n",
    "# Solution\n",
    "\n",
    "r = log(d/e,10)\n",
    "\n",
    "K = (pi/4)*sqrt(2*g)*(2*r+1.14)*(0.3)**(2.5)\n",
    " \n",
    "S = (Q/K)**2\n",
    "\n",
    "hf = S*l\n",
    "\n",
    "print \"Head loss of water =\",round(hf,1),\"m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.6 Page no 319"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head loss of water = 0.1 m**3/s\n"
     ]
    }
   ],
   "source": [
    "# Head loss by conveyance method\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "Q = 0.1                  # water flow rate in m**3/s\n",
    "\n",
    "d = 20                  # diameter in cm\n",
    "\n",
    "l = 500                  # length in m\n",
    "\n",
    "e = 0.025                # for cast iron\n",
    "\n",
    "g = 9.81                 # acceleration due to gravity in m/s**2\n",
    "\n",
    "S = 5.43 \n",
    "\n",
    "# Solution\n",
    "\n",
    "r = log(d/e,10)\n",
    "\n",
    "K = (pi/4)*sqrt(2*g)*(2*r+1.14)*(0.2)**2.5\n",
    "\n",
    "Q=K*sqrt(S/100)\n",
    "\n",
    "print \"Head loss of water =\",round(Q,2),\"m**3/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.7 Page no 320"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "K =  0.432  from trial and error\n"
     ]
    }
   ],
   "source": [
    "# Solve using the conveyence method\n",
    "\n",
    "from math import *\n",
    "\n",
    "# given\n",
    "\n",
    "eps = 0.025*10**-2           # for cast iron epsilon = 0.0025 cm\n",
    "\n",
    "# we get the value of K = 0.432 m**2/s\n",
    "# we need to do trial and error to find the value of D\n",
    "\n",
    "# we use the value of D = 0.2 m\n",
    "\n",
    "D = 0.2               # value in m\n",
    "\n",
    "g = 9.81\n",
    "\n",
    "# Solution\n",
    "\n",
    "K = (pi/4)*sqrt(2*g)*(2*log10(D/(eps))+1.14)*D**(2.5)\n",
    "\n",
    "print \"K = \",round(K,3),\" from trial and error\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.8 Page no 326"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total head loss = 83.7 m\n"
     ]
    }
   ],
   "source": [
    "# Determine head loss\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "d = 0.1                # diameter of the pipe\n",
    "\n",
    "Q= 0.075               # discharge in m**3/s\n",
    "\n",
    "L = 30                 # length in m\n",
    "\n",
    "A = pi*d**2/4\n",
    "\n",
    "g = 9.81               # acceleration due to gravity in m/s**2\n",
    "\n",
    "# for water\n",
    "\n",
    "nu = 1.007*10**-6       # viscosity in m**2/s\n",
    "\n",
    "e = 0.025\n",
    "\n",
    "r = e/(10*d)\n",
    "\n",
    "# Solution\n",
    "\n",
    "V = Q/A\n",
    "\n",
    "Re = V*d/nu\n",
    "\n",
    "f = 0.025              # firction factor from moodys diagram\n",
    "\n",
    "hf = f*L*V**2/(2*g*d)  \n",
    "\n",
    "K= 0.5                 # contraction constant\n",
    "\n",
    "hc = K*V**2/(2*g)     \n",
    "\n",
    "K1 =10                 # loss of the globe valve\n",
    "\n",
    "hg = K1*V**2/(2*g)\n",
    "\n",
    "Th = hf+hc+hg\n",
    "\n",
    "print \"Total head loss =\",round(Th,1),\"m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.9 Page no 328"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Discharge through the pipe = 0.067 m**3/s\n"
     ]
    }
   ],
   "source": [
    "# discharge through the pipe\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "# for water\n",
    "\n",
    "nu = 1.007*10**-6                # viscosity in m**2/s\n",
    "\n",
    "d1 = 0.3                         # diameter of pipe 1 in m\n",
    "\n",
    "d2 = 0.15                        # diameter of pipe 2 in m\n",
    "\n",
    "d3 = 0.08                        # diameter of pipe 3 in m\n",
    "\n",
    "g = 9.81                         # acclelration due to gravity in m/s**2\n",
    "\n",
    "e = 0.025                        # for cast iron\n",
    "\n",
    "f1 = 0.019                       # foe e/d1\n",
    "\n",
    "f2 = 0.022                       # foe e/d2\n",
    "\n",
    "# Solution\n",
    "\n",
    "V3 = sqrt(2*g*100/((8.4*(f1)+268.85*(f2)+4.85)))\n",
    "\n",
    "V1 = (d3/d1)**2*V3\n",
    "\n",
    "V2 = (d3/d2)**2*V3\n",
    "\n",
    "# reynolds number for pipe BC\n",
    "\n",
    "R1 = V1*d1/nu\n",
    "\n",
    "R2 = V2*d2/nu\n",
    "\n",
    "Q = V3*pi*d3**2/4\n",
    "\n",
    "print \"Discharge through the pipe =\",round(Q,3),\"m**3/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.10 Page no 332"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Replacement of the flow system = 94.3 m\n"
     ]
    }
   ],
   "source": [
    "# Replace the flow system\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "D = 0.2                      # diameter of pipe 1\n",
    "\n",
    "D1 = 0.15                    # diameter of pipe 2\n",
    "\n",
    "Q = 0.1                     # discharge in m**3/s\n",
    "\n",
    "nu = 1.007*10**-6           # viscosity in m**2/s\n",
    "\n",
    "e = 0.025                   # e for cast iron\n",
    "\n",
    "r = e/(100*D)                     \n",
    "\n",
    "# Solution\n",
    "\n",
    "V = Q/(pi*(0.2)**2/4)\n",
    "\n",
    "R = V*D/nu\n",
    "\n",
    "f = 0.021                 # from moodys law\n",
    "\n",
    "r2 = e/D1\n",
    "\n",
    "V1 = Q/(pi*D1**2/4)\n",
    "\n",
    "R1 = V*D1/nu\n",
    "\n",
    "f2 = 0.023                # from moodys law\n",
    "\n",
    "L2 = 28562*D1**5/f2\n",
    "\n",
    "print \"Replacement of the flow system =\",round(L2,2),\"m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.11 Page no 335"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Discharge through branch 1 = 1.35 m**3/s\n",
      "Discharge through branch 2 = 0.566 m**3/s\n",
      "Discharge through branch 3 = 0.082 m**3/s\n",
      "It is found that hf1=hf2=hf3 = 43.5 The distribution od discharge is correct\n"
     ]
    }
   ],
   "source": [
    "# Discharge through each branch\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "e = 0.025                # in cm\n",
    "\n",
    "nu = 1.007*10**-6        # viscosity in m**2/s\n",
    "\n",
    "Q1 = 0.5                 # discharge in m**3/s\n",
    "\n",
    "D1 = 50\n",
    "\n",
    "L1 = 500                 # length in m\n",
    "\n",
    "g = 9.81\n",
    "\n",
    "# Pipe 1\n",
    "\n",
    "r1 = e/D                 # r1 for pipe 1\n",
    "\n",
    "V1 = Q1/(pi*(0.5)**2/4)\n",
    "\n",
    "R = V*(0.5)/nu\n",
    "\n",
    "f1 = 0.018               # for the reynolds no\n",
    "\n",
    "hf1 = f*L1*V1**2/(2*g*D1)\n",
    "\n",
    "# pipe 2\n",
    "\n",
    "hf2 = hf1\n",
    "\n",
    "L2 =200                 # length in m\n",
    "\n",
    "D2 = 0.3                # diameter in m\n",
    "\n",
    "r2 = e/D2\n",
    "\n",
    "f2 =  0.02 \n",
    "\n",
    "V2 = 0.419/sqrt(f2) \n",
    "\n",
    "R2 = V2*D2/nu\n",
    "\n",
    "Q2 = V2*(pi*D2**2/4)\n",
    "\n",
    "#pipe 3\n",
    "\n",
    "hf3=hf1\n",
    "\n",
    "L3 = 300              # length of pipe 3 in m\n",
    "\n",
    "D3  =0.15             # diameter of pipe 3 in m\n",
    "\n",
    "r3 = e/D3         \n",
    "\n",
    "f = 0.022            # from moody's law\n",
    "\n",
    "V3 = 0.242/sqrt(f2)\n",
    "\n",
    "R3 = V3*D3/nu\n",
    "\n",
    "Q3 = V3*(pi*D3**2/4)\n",
    "\n",
    "Td = Q1+Q2+Q3\n",
    "\n",
    "q1 = Q1*(2.0/Td)\n",
    "\n",
    "q2 = Q2*(2.0/Td)\n",
    "\n",
    "q3 = Q3*(2.0/Td)\n",
    "\n",
    "print \"Discharge through branch 1 =\",round(q1,2),\"m**3/s\"\n",
    "\n",
    "print \"Discharge through branch 2 =\",round(q2,3),\"m**3/s\"\n",
    "\n",
    "print \"Discharge through branch 3 =\",round(q3,3),\"m**3/s\"\n",
    "\n",
    "# Actual head loss\n",
    "\n",
    "d = 0.5\n",
    "\n",
    "v1 = q1/(pi*(d)**2/4)\n",
    "\n",
    "R4 = v1*d/nu\n",
    "\n",
    "r4 = 0.0005                 # ratio of e/D\n",
    "\n",
    "f = 0.018\n",
    "\n",
    "Hf1 = f*L1*v1**2/(2*g*d)\n",
    "\n",
    "print \"It is found that hf1=hf2=hf3 =\",round(Hf1,1),\"The distribution od discharge is correct\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 9.14 Page no 349"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Minimum depth = 17.6 ft\n"
     ]
    }
   ],
   "source": [
    "# Find minimum depth below the ridge\n",
    "\n",
    "from math import *\n",
    "\n",
    "# Given\n",
    "\n",
    "e = 0.00015             # from moody's chart\n",
    "\n",
    "D = 2                   # depth in ft\n",
    "\n",
    "r = e/D\n",
    "\n",
    "z1 = 100                # elevation in ft\n",
    "\n",
    "mu = 1.084*10**-5       # viscosity in Ns/ft**2\n",
    "\n",
    "p1 = 34                 # pressure head in ft\n",
    "\n",
    "p2 = 10                 # pressure head in ft\n",
    "\n",
    "g = 32.2                # acclelration due to gravity in ft/s**2\n",
    "\n",
    "L = 1000                # length in ft\n",
    "\n",
    "# Solution\n",
    "\n",
    "f = 0.011           # assume\n",
    "\n",
    "V = sqrt(100/(10000/(2*2*g)))/sqrt(f)\n",
    "\n",
    "R = V*D/mu\n",
    "\n",
    "V1 = 10.15\n",
    "\n",
    "f1 = 0.0125\n",
    "\n",
    "Q = V1*pi*D**2/4\n",
    "\n",
    "x = p1-p2-(V1**2/(2*g))-(f1*L*V1**2/(2*g*D))\n",
    "\n",
    "Dp = 30 - x\n",
    "\n",
    "print \"Minimum depth =\",round(Dp,2),\"ft\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}