summaryrefslogtreecommitdiff
path: root/mechanics_of_fluid/Chapter10.ipynb
blob: 9502b2933265fd0f4a2a308c91a172e99dd940c9 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:0abcc423492072a54fb770a61520bf727ac4ace788fa5f2dbb0a6db0caff8ec2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter10-Flow with free surfaces"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg436"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate The depth of the water under the brigde and the depth of water upstream\n",
      "Q=400.; ## m^3/s\n",
      "b2=20.; ## m\n",
      "g=9.81; ## m/s^2\n",
      "b1=25.; ## m\n",
      "\n",
      "h2=(Q/b2/math.sqrt(g))**(2./3.);\n",
      "## Since energy is conserved\n",
      "## h1 + u1^2/2g = h2 +u2^2/2g = h2 + h2/2 = 3h2/2\n",
      "\n",
      "## h1 + 1/2*g*(Q/(b1h1))^2 = 3*h2/2;\n",
      "\n",
      "## h1^3-5.16*h1^2+13.05 = 0;\n",
      "\n",
      "## By solving this cubic equation\n",
      "\n",
      "h1=4.52; ## m\n",
      "\n",
      "print'%s %.1f %s'%(\" The depth of the water under the brigde =\",h2,\"m\")\n",
      "\n",
      "\n",
      "print'%s %.2f %s'%(\" the depth of water upstream =\",h1,\"m\")\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The depth of the water under the brigde = 3.4 m\n",
        " the depth of water upstream = 4.52 m\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg447"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate Rate of flow \n",
      "w=0.04; ## thickness of block in m\n",
      "d=0.07; ## depth of liquid in m\n",
      "b=0.4; ## m\n",
      "g=9.81; ## m/s^2\n",
      "\n",
      "H=d-w; \n",
      "\n",
      "Q=1.705*b*H**(3/2.);\n",
      "\n",
      "u1=Q/d/b;\n",
      "h=u1**2/(2.*g);\n",
      "\n",
      "H1=H+h;\n",
      "\n",
      "Q1=1.705*b*H1**(3/2.);\n",
      "\n",
      "print'%s %.4f %s'%(\"Rate of flow =\",Q1,\" m^3/s\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of flow = 0.0037  m^3/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg455"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate depth of water at the throat and the new flow rate and the Froude number at the throat and flow rate\n",
      "h1=0.45; ## m\n",
      "g=9.81; ## m/s^2\n",
      "b1=0.8; ## m\n",
      "h2=0.35; ## m\n",
      "b2=0.3; ## m\n",
      "print(\"the flow rate\")\n",
      "Q=math.sqrt((h1-h2)*2*g/(-(1./(h1*b1)**2)+(1./(h2*b2)**2)));\n",
      "print'%s %.3f %s'%(\"Flow rate =\",Q,\"m^3/s\")\n",
      "\n",
      "\n",
      "print(\" the Froude number at the throat\")\n",
      "Fr2=Q/(math.sqrt(g)*b2*h2**(3/2.));\n",
      "print'%s %.3f %s'%(\"The Froude number at the throat =\",Fr2,\"\")\n",
      "\n",
      "\n",
      "print(\"the depth of water at the throat\")\n",
      "\n",
      "## (h1/h2)^(3) + 1/2*(b2/b1)^2 = 3/2*(h1/h2)^2\n",
      "\n",
      "## The solution for the above eqn is as follows\n",
      "## (h1/h2) = 0.5 + cos(2arcsin(b2/b1)/3)\n",
      "\n",
      "## h1/h2=1.467\n",
      "\n",
      "h2_new=h1/1.467;\n",
      "print'%s %.3f %s'%(\"Depth of water at the throat =\",h2_new,\"m\")\n",
      "\n",
      "print(\"the new flow rate\")\n",
      "w=math.sqrt(g)*b2*h2_new**(3/2.);\n",
      "print'%s %.3f %s'%(\"New flow rate =\",Q,\"m^3/s\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the flow rate\n",
        "Flow rate = 0.154 m^3/s\n",
        " the Froude number at the throat\n",
        "The Froude number at the throat = 0.790 \n",
        "the depth of water at the throat\n",
        "Depth of water at the throat = 0.307 m\n",
        "the new flow rate\n",
        "New flow rate = 0.154 m^3/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg460"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate depth\n",
      "Q=8.75; ## m^3/s\n",
      "w=5.; ## m\n",
      "n=0.0015; \n",
      "s=1./5000.;\n",
      "\n",
      "## Q/(w*h0) = u = m^(2/3)*i^(1/2)/n = 1/0.015*(w*h0/(w+2*h0))^(2/3)*sqrt(s);\n",
      "## Solution by trial gives h0\n",
      "h0=1.8; ## m\n",
      "\n",
      "q=1.75;\n",
      "g=9.81;\n",
      "hc=(q**2/g)**(1/3); ## critical depth\n",
      "\n",
      "print'%s %.1f %s'%(\"Depth =\",h0,\"m\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth = 1.8 m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg469"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate wave length\n",
      "g=9.81; ## m/s^2\n",
      "T=5.; ## s\n",
      "h=4.; ## m\n",
      "\n",
      "## lambda=g*T^2/(2*%pi)*tanh(2*%pi*h/lambda1);\n",
      "## by trial method , we get \n",
      "lambda1=28.04;\n",
      "\n",
      "D=g*T**2/(2*math.pi)*math.tanh(2*math.pi*h/lambda1);\n",
      "print'%s %.1f %s'%(\"Wavelength =\",D,\"m\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength = 27.9 m\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EX6-pg470"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#calculate phase velocity and wave length\n",
      "g=9.81; ## m/s^2\n",
      "T=12; ## s\n",
      "\n",
      "c=g*T/(2*math.pi);\n",
      "\n",
      "D=c*T;\n",
      "\n",
      "print\"%s %.1f %s\"%(\"Phase velocity =\",c,\"m/s\")\n",
      "\n",
      "\n",
      "print\"%s %.1f %s\"%(\"Wavelength =\",D,\"m\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Phase velocity = 18.7 m/s\n",
        "Wavelength = 224.8 m\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg476"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Estimate the time elapsed since the waves were generated in a storm occurring 800 km out to sea and Estimate the depth at which the waves begin to be significantly influenced by the sea bed as they approach the shore\n",
      "c=18.74; ## m/s\n",
      "lambd=225.; ## m\n",
      "\n",
      "print(\"Estimate the time elapsed since the waves were generated in a storm occurring 800 km out to sea. \")\n",
      "\n",
      "x=800.*10**3.; ## m\n",
      "cg=c/2.;\n",
      "\n",
      "t=x/cg;\n",
      "\n",
      "print\"%s %.1f %s\"%(\"time elapsed =\",t/3600.,\"hours\")\n",
      "\n",
      "\n",
      "print(\"Estimate the depth at which the waves begin to be significantly influenced by the sea bed as they approach the shore.\")\n",
      "\n",
      "h1=lambd/2.;\n",
      "\n",
      "h2=lambd/(2.*math.pi)*math.atanh(0.99);\n",
      "\n",
      "print\"%s %.1f %s %.1f %s\"%(\"The answers show that h lies in the range between about\",h2,\"m , \",h1, \"m\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Estimate the time elapsed since the waves were generated in a storm occurring 800 km out to sea. \n",
        "time elapsed = 23.7 hours\n",
        "Estimate the depth at which the waves begin to be significantly influenced by the sea bed as they approach the shore.\n",
        "The answers show that h lies in the range between about 94.8 m ,  112.5 m\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}