summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_by_John_F_Douglas/Chapter_14.ipynb
blob: 2e55c7c8454e7a64a33fc832e794dba9ea5c84b8 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:75785fe7e68940de5df81a115443b8d5c78793053ae837735e58f86a072c05cc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14: Steady Incompressible Flow in Pipe and Duct System"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.1, Page 468"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "L1  =  5;\n",
      "L2  =  10;\n",
      "d  =  0.1;\n",
      "f  =  0.08;\n",
      "Za_Zc  =  4;                                                 #difference  in  height  between  A  and  C  \n",
      "g  =  9.81  ;\n",
      "Pa  =  0;\n",
      "Va  =  0;  \n",
      "Za_Zb  =  -1.5;\n",
      "V  =  1.26;\n",
      "rho  =  1000;\n",
      "\n",
      " #Calculations\n",
      "D  =  1.5  +  4*f*(L1+L2)/d  ;                               #  Denominator  in  case  of  v**2  \n",
      "v  =  (2*g*Za_Zc/D)**0.5;\n",
      "Pb  =  rho*g*Za_Zb  -  rho*V**2/2*(1.5+4*f*L1/d);\n",
      "print \"Pressure in the pipe at B (kN/m2):\",round(Pb/1000,2)\n",
      "print \"Mean Velocity at C    (m/s)      :\",round(v,2)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure in the pipe at B (kN/m2): -28.61\n",
        "Mean Velocity at C    (m/s)      : 1.26\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.3, Page 473"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from sympy import symbols,solve\n",
      "import sympy\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "Za_Zb  =  10;\n",
      "f  =  0.008;\n",
      "L  =  100;\n",
      "d1  =  0.05;\n",
      "g  =  9.81;\n",
      "d2  =  0.1;\n",
      "\n",
      " #Calculations\n",
      "\n",
      "def  flowRate(d):\n",
      "    D = 1.5 + 4*f*L/d ;                                     #  Denominator  in  case  of  v1**2\n",
      "    A  =  math.pi*d**2/4;\n",
      "    v  =  (2*g*Za_Zb/D)**0.5;\n",
      "    z  =  A*v;\n",
      "    return z     \n",
      "Q1  =  flowRate(d1);\n",
      "Q2  =  flowRate(d2);\n",
      "Q=round(Q1+Q2,4)\n",
      "\n",
      "\n",
      "D=symbols('D')\n",
      "roots=solve(241212*D**5  -3.2, D)\n",
      "dia=roots[0]\n",
      "\n",
      "print \"Rate flow for pipe 1            (m^3/s) :\",round(Q1,4)\n",
      "print \"Rate flow for pipe 2            (m^3/s) :\",round(Q2,4)\n",
      "print \"Combined Rate flow              (m^3/s) :\",round(Q,4)\n",
      "print \"Diameter of single equivalent pipe (mm) :\",round(dia,3)*1000\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate flow for pipe 1            (m^3/s) : 0.0034\n",
        "Rate flow for pipe 2            (m^3/s) : 0.019\n",
        "Combined Rate flow              (m^3/s) : 0.0224\n",
        "Diameter of single equivalent pipe (mm) : 106.0\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.4, Page 476"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "import sympy\n",
      "from sympy import solve,symbols\n",
      "\n",
      " #Initializing  the  variables\n",
      "Za_Zb  =  16;\n",
      "Za_Zc  =  24;\n",
      "f  =  0.01;\n",
      "l1  =  120;\n",
      "l2  =  60;\n",
      "l3  =  40;\n",
      "d1  =  0.12;\n",
      "d2  =  0.075;\n",
      "d3  =  0.060;\n",
      "g  =  9.81;\n",
      " #Calculations\n",
      "\n",
      "v1=symbols('v1')\n",
      "ash=solve(v1-0.3906*(g-1.25*v1**2)**0.5-0.25*(17.657-1.5*v1**2)**0.5,v1)\n",
      "v1=round(abs(ash[0]),2)\n",
      "Q1=math.pi/4*d1**2*v1\n",
      "\n",
      "v2=(g-1.25*v1**2)**0.5\n",
      "Q2=math.pi/4*d2**2*v2\n",
      "\n",
      "v3=(17.657-1.5*v1**2)**0.5\n",
      "Q3=math.pi/4*d3**2*v3\n",
      "\n",
      "print \"Flow rate in pipe 1 (m^3/s):\",round(Q1,4)\n",
      "print \"Flow rate in pipe 2 (m^3/s):\",round(Q2,4)\n",
      "print \"Flow rate in pipe 3 (m^3/s):\",round(Q3,4)\n",
      "print \"continuity condition satisfied as Q1=Q2+Q3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate in pipe 1 (m^3/s): 0.0206\n",
        "Flow rate in pipe 2 (m^3/s): 0.0105\n",
        "Flow rate in pipe 3 (m^3/s): 0.0101\n",
        "continuity condition satisfied as Q1=Q2+Q3\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.5, Page 480"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "D  =  0.3;\n",
      "Q  =  0.8;\n",
      "rho  =  1.2;\n",
      "f  =  0.008;\n",
      "L_entry  =  10;\n",
      "L_exit  =  30;\n",
      "Lt  =  20*D                              #Transition  may  be  represented  by  a  separation  loss  equivalent  length  of  20  *  the  approach  duct  diameter\n",
      "K_entry  =  4;\n",
      "K_exit  =  10\n",
      "l  =  0.4;                               #  length  of  cross  section\n",
      "b  =  0.2;                               #  width  of  cross  section\n",
      "\n",
      " #Calculations\n",
      "A  =  math.pi*D**2/4;\n",
      "Dp1  =  0.5*rho*Q**2/A**2*(K_entry  +  4*f*(L_entry+Lt)/D);\n",
      "area  =  l*b;\n",
      "perimeter  =2*(l+b);\n",
      "m  =  area/perimeter;\n",
      "Dp2  =  0.5*rho*Q**2/area**2*(K_exit  +  f*L_exit/m);\n",
      "Dfan  =    Dp1+Dp2;\n",
      "\n",
      "print \"fan Pressure input (N/m2) :\",round(Dfan,1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fan Pressure input (N/m2) : 1254.6\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.6, Page 482"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "D  =  [0.15 , 0.3];\n",
      "rho  =  1.2;\n",
      "f  =  0.008;\n",
      "L_entry  =  10;\n",
      "L_exit  =  20;\n",
      "Lt  =  20*D[1]              \n",
      "K  =  4;\n",
      "Q1  =  0.2;\n",
      "\n",
      " #Calculations\n",
      "Q2  =  4*Q1;\n",
      "A=[0.0,0.0]\n",
      "A[0]  =  math.pi*D[0]**2/4;\n",
      "A[1]  =  math.pi*D[1]**2/4;\n",
      "Dp1  =  0.5*rho*Q1**2/A[0]**2*(K  +  4*f*L_entry/D[0]);\n",
      "Dp2  =  0.5*rho*Q2**2/A[1]**2*(4*f*(L_exit  +  Lt)/D[1]);\n",
      "Dfan  =    Dp1+Dp2;\n",
      "\n",
      "print \"fan Pressure input (N/m2) :\",round(Dfan,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fan Pressure input (N/m2) : 684.51\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.7, Page 487"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from scipy.optimize import fsolve\n",
      " \n",
      " \n",
      " \n",
      " #Initializing  the  variables\n",
      "d  =  [0.1 , 0.125,  0.15,  0.1,  0.1  ];                    #  Corrosponding  to  AA1B  AA2B  BC  CD  CF\n",
      "l  =  [30 , 30 , 60,  15,  30];                                      #  Corrosponding  to  AA1B  AA2B  BC  CD  CF\n",
      "rho   =  1.2;\n",
      "f     =  0.006;\n",
      "Ha    =  100;\n",
      "Hf    =  60;\n",
      "He    =  40;\n",
      "K = [0.0, 0.0, 0.0, 0.0, 0.0]\n",
      " #Calculations\n",
      "for i in range(0,len(l)):\n",
      "    K[i]  =  f*l[i]/(3*d[i]**5);\n",
      "\n",
      "\n",
      "K_ab  =  K[0]*K[1]/((K[0])**0.5+(K[1])**0.5)**2;\n",
      "K_ac  =  K_ab  +  K[2];\n",
      "Hc  =  (K_ac*Hf  +K[4]*Ha/4)/(K_ac+K[4]/4);\n",
      "Q  =  ((Ha  -  Hc)/K_ac)**0.5;\n",
      "\n",
      "def  f(n):\n",
      "    z  =  He  -  Hc  +  (0.5*Q)**2  *(K[3]+(4000/n)**2);\n",
      "    return z\n",
      "\n",
      "n  =  fsolve(f,1);\n",
      "\n",
      "print \"total Volume flow rate (m3/s):\",round(Q, 4)\n",
      "print \"Head at C (m)                :\",round(Hc,2) \n",
      "print \"Percentage valve opening (%) :\",round(n,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "total Volume flow rate (m3/s): 0.1016\n",
        "Head at C (m)                : 75.48\n",
        "Percentage valve opening (%) : 38.58\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}