summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics_by_John_F._Douglas/Chapter_10.ipynb
blob: 510f6babc25e3d348f7799c23eca13271ac14fe9 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:03b40b6d5c44ff714aac13480905f296c46afa917e2740a687e8aa66bb21b428"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10: Laminar and Turbulent Flows in Bounded System"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.1, Page 329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "import sympy\n",
      "from sympy import symbols,diff,solve\n",
      "\n",
      " #Initializing  the  variables\n",
      "mu  =  0.9;\n",
      "rho  =  1260;\n",
      "g  =  9.81;\n",
      "x  =  45;                                                                  #theta  in  degrees\n",
      "P1  =  250  *  10**3;\n",
      "P2  =  80*  10**3;\n",
      "Z1  =  1;\n",
      "Z2  =  0;                                                                  #  datum\n",
      "U  =  -1.5;\n",
      "Y  =  0.01;\n",
      "\n",
      " #Calculations\n",
      "gradP1  =  P1+  rho*g*Z1;\n",
      "gradP2  =  P2+  rho*g*Z2;\n",
      "DPstar  =  (gradP1-gradP2)*math.sin(math.radians(x))/(Z1-Z2);\n",
      "A  =  U/Y;                                                                #  Coefficient  U/Y  for  equation  10.6\n",
      "B  =  DPstar/(2*mu)                                              #  Coefficient  dp*/dx  X(1/2mu)  for  equation  10.6\n",
      "y  =  symbols('y')\n",
      "v  =  round((A  +  B*Y),1)*y  -round(B)*y**2\n",
      "duBYdy  =  diff(v,y);\n",
      "tau  =  0.9*duBYdy;\n",
      "stagPnts = solve(duBYdy,y)\n",
      "ymax=stagPnts[0]                                      #value  of  y  where  derivative  vanishes.;\n",
      "umax  =  (A + B*Y)*ymax  +  B*ymax**2;              #  Check  the  value  there  is  slight  mistake  in  books  answer\n",
      "def  u(y):\n",
      "    z  =  (A + B*Y)*y -B*y**2;\n",
      "    return diff(z,y)\n",
      "def dif(y):\n",
      "    return round((A + B*Y)) -2*round(B)*y\n",
      "\n",
      "taumax=abs(mu*dif(Y))\n",
      "\n",
      "print \"velocity distribution         :\",v\n",
      "print \"shear stress distribution     :\",mu*dif(y)\n",
      "print \"maximum flow velocity (m/s)   :\",round(umax,2)\n",
      "print \"Maximum Shear Stress  (kN/m^2):\",(round(taumax)/1000)\n",
      "  \n",
      "\n",
      "print "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "velocity distribution         : -71638.0*y**2 + 566.4*y\n",
        "shear stress distribution     : -128948.4*y + 509.4\n",
        "maximum flow velocity (m/s)   : 3.36\n",
        "Maximum Shear Stress  (kN/m^2): 0.78\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.2, Page 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "mu  =  0.9;\n",
      "rho  =  1260;\n",
      "d  =  0.01;\n",
      "Q  =  1.8/60*10**-3;                                              #Flow  in  m**3  per  second\n",
      "l  =  6.5;\n",
      "ReCrit  =  2000;\n",
      " #Calculations\n",
      "A  =  (math.pi*d**2)/4;\n",
      "MeanVel  =  Q/A;\n",
      "Re  =  rho*MeanVel*d/mu/10;                                    #  Check  properly  the  answer  in  book  there  is  something  wrong\n",
      "Dp  =  128*mu*l*Q/(math.pi*d**4)\n",
      "Qcrit  =  Q*ReCrit/Re*10**3;\n",
      "\n",
      "print \"Pressure Loss        (kN/m2) :\",round(Dp/1000,0)\n",
      "print \"Maximum Flow rate (litres/s) :\",round(Qcrit,0)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure Loss        (kN/m2) : 715.0\n",
        "Maximum Flow rate (litres/s) : 112.0\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.3, Page 341"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "mu  =  1.14*10**-3;\n",
      "rho  =  1000;\n",
      "d  =  0.04;\n",
      "Q  =  4*10**-3/60;                                    #Flow  in  m**3  per  second\n",
      "l  =  750;\n",
      "ReCrit  =  2000;\n",
      "g  =  9.81;\n",
      "k  =  0.00008;                                       #  Absolute  Roughness\n",
      "\n",
      " #Calculations\n",
      "A  =  (math.pi*d**2)/4;\n",
      "MeanVel  =  Q/A;\n",
      "Re  =  rho*MeanVel*d/mu;\n",
      "Dp  =  128*mu*l*Q/(math.pi*d**4);\n",
      "hL  =  Dp/(rho*g);\n",
      "f  =  16/Re;\n",
      "hlDa  =  4*f*l*MeanVel**2/(2*d*g);                   #  By  Darcy  Equation\n",
      "Pa  =  rho*g*hlDa*Q;\n",
      "\n",
      " #Part(b)\n",
      "Q  =  30*10**-3/60;                                  #Flow  in  m**3  per  second\n",
      "MeanVel  =  Q/A;\n",
      "Re  =  rho*MeanVel*d/mu;\n",
      "RR  =  k/d;                                          #  relative  roughness\n",
      "f  =  0.008                                          #by  Moody  diagram  for  Re  =    1.4  x  10**4    and  relative  roughness  =  0.002\n",
      "hlDb  =  4*f*l*MeanVel**2/(2*d*g);                   #  By  Darcy  Equation\n",
      "Pb  =  rho*g*hlDb*Q;\n",
      "\n",
      "\n",
      "print \"!---- Case (a) ----!\\n\",\"Head Loss(mm)      :\",round(hlDa*1000,1)\n",
      "print \"Power Required (W) :\",round(Pa,4)\n",
      "print \"\\n!---- Case (b) ----!\\n\",\"Head Loss(m)       :\",round(hlDb,2)\n",
      "print \"Power Required (W) :\",round(Pb,0)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "!---- Case (a) ----!\n",
        "Head Loss(mm)      : 92.5\n",
        "Power Required (W) : 0.0605\n",
        "\n",
        "!---- Case (b) ----!\n",
        "Head Loss(m)       : 4.84\n",
        "Power Required (W) : 24.0\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.4, Page 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "w  =  4.5;\n",
      "d  =  1.2  ;\n",
      "C  =  49;\n",
      "i  =  1/800;\n",
      "\n",
      " #Calculations\n",
      "A  =  d*w;\n",
      "P  =  2*d  +  w;\n",
      "m  =  A/P;\n",
      "v  =  C*(m*i)**0.5;\n",
      "Q  =  v*A;\n",
      "\n",
      "print \"Mean Velocity (m/s):\",round(v,2)\n",
      "print \"Discharge (m3/s)   :\",round(Q,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mean Velocity (m/s): 1.53\n",
        "Discharge (m3/s)   : 8.28\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.5, Page 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import sympy\n",
      "from sympy import symbols\n",
      "\n",
      " #Initializing  the  variables\n",
      "r,R = symbols('r R')\n",
      "\n",
      "#Calculations\n",
      "rbyR=round((1-(49/60)**7),3)\n",
      "r = (rbyR)*R \n",
      "\n",
      "#Result\n",
      "print \"radius at which actual velocity is equal to mean velocity is\",r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "radius at which actual velocity is equal to mean velocity is 0.758*R\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10.7, Page 355"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "d1  =  0.140;\n",
      "d2  =  0.250;\n",
      "DpF_DpR  =  0.6;                                       #Difference  in  head  loss  when  in  forward  and  in  reverse  direction\n",
      "K  =  0.33                                             #From  table\n",
      "g  =  9.81;\n",
      " #Calculations\n",
      "ratA  =  (d1/d2)**2;\n",
      "v =(DpF_DpR*2*g/((1-ratA)**2-K))**0.5;\n",
      "\n",
      "print \"Velocity (m/s):\",round(v,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity (m/s): 9.13\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}