summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics/Chapter_25.ipynb
blob: 9b08e6f3028f1cd35e64515a5ca8e187b94422a6 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:2bebadfad4a18ede042a136ada8984e181f57290a23ad4ed8003a1f83445a447"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 25: Machine\u2013Network Interactions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 25.4, Page 893"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      " #Initializing  the  variables\n",
      "Pa_P1  =  -200;                                                      #  From  previous  Question\n",
      "Q  =  1.4311  ;                                                        #  From  previous  questions.\n",
      "\n",
      " #Calculations\n",
      "DpSys  =  Pa_P1  +  98.9*Q**2;\n",
      "print \"System Operating point (m^3/s):\",round(DpSys,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "System Operating point (m^3/s): 2.55\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 25.7, Page 906"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "import sympy\n",
      "from sympy import solve,symbols\n",
      "   \n",
      "\n",
      " #Initializing  the  variables\n",
      "Vo  =  25.3;                                                            #Outlet  velocity\n",
      "D  =  10  ;                                                                #  Mean  hydraulic  diameter\n",
      "f  =  0.008;                                                            #  friction  factor\n",
      "X  =  1000;                                                              #  Length  of  road\n",
      "P  =  12600;                                                            #  Absorbing  power\n",
      "Va  =  300;                                                              #  Tunnel  air  flow\n",
      "K1  =  0.96;\n",
      "K2  =  0.9;\n",
      "T  =  590;                                                                #Thrust\n",
      "rho  =  1.2;                                                            #  Air  density  \n",
      "\n",
      " #Calculations\n",
      "alpha  =  (1/D)**2;\n",
      "A  =  math.pi*D**2/4;                                                    #  Area  of  tunnel\n",
      "Vt  =  Va/A;\n",
      "W  =  Vo/Vt;                                                            #Omega\n",
      "E  =  (1-alpha*W);\n",
      "C  =  (1-alpha*W)*(1-E)**2  +  E**2  -  1;\n",
      " #  Manipulating  equation  25.20;\n",
      "LHS  =  f*X*(E+1)**2/D  +  C  +  1  ;\n",
      "\n",
      "n1  =  symbols('n1')\n",
      "result=solve(K1*(2*((alpha*W**2 + (1-alpha)*E**2-1)+(n1-1)*(alpha*W*(W-1)-C/2)))-LHS)\n",
      "\n",
      "n=result[0]\n",
      "\n",
      "\n",
      " #  Alternative  approach  using  equation  25.22\n",
      "n2  =  (rho*((4*f*X*Vt**2)/(2*D)    +  1.5*Vt**2/2))*A/(K1*K2*T);  \n",
      "Pt  =  round(n2)*P;\n",
      "\n",
      "print \"Number of fans required    :\",round(n2)\n",
      "print \"Total  power consumed (KW) :\",Pt/1000"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of fans required    : 6.0\n",
        "Total  power consumed (KW) : 75.6\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 25.8, Page 907"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "import sympy\n",
      "from sympy import solve,symbols\n",
      " #Initializing  the  variables\n",
      "f  =  0.008;\n",
      "T  =  290;\n",
      "L  =  750;\n",
      "Dt  =  9;                                                                  #  Diameter  Tunnel\n",
      "Df  =  0.63;                                                            #  Diameter  fan\n",
      "K1  =  0.98;\n",
      "K2  =  0.92;\n",
      "Vo  =  27.9;\n",
      "n  =  10;\n",
      "A=math.pi*Dt**2/4\n",
      "rho=1.2\n",
      "X=750\n",
      " #Calculations\n",
      "alpha  =  (Df/Dt)**2;\n",
      " #  equation  25.20  becomes  when  E  =  1  nad  C  =  0\n",
      "W=symbols('W')\n",
      "omega  =  solve(2*K1*  (alpha*W**2  +(n-1)*alpha*W*(W-1))  -  4*f*L/Dt  -1)\n",
      "  \n",
      "\n",
      "for i in range(1,len(omega)):  #  since  omega  is  always  positive  and  real\n",
      "    if omega[i]>0:\n",
      "        w  =  round(omega[i],1);\n",
      "Vt  =  Vo/w;\n",
      "\n",
      "# by equation 25.22\n",
      "VT=(n*(K1*K2*T)/(A*(rho*((4*f*X)/(2*Dt)    +  1.5/2))))**0.5\n",
      "print \"Tunnel Velocity  (m/s) :\",round(VT,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tunnel Velocity  (m/s) : 4.05\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 25.9, Page 914"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      " #Initializing  the  variables\n",
      "Ws  =  0.45;\n",
      "Ks  =  3.2;\n",
      "H  =  152;\n",
      "h  =  0;\n",
      "Hatm  =  10.3;\n",
      "Pv  =  350;                             #vapour  pressure\n",
      "g  =  9.81;\n",
      "rho  =  1000;\n",
      "     \n",
      " #Calculations\n",
      "Ht1  =  152*(Ws/Ks)**(4/3);     # the value of Ht1 is 11.12 and in book it is taken as 11.2 so there will be a difference in final answer\n",
      "Hvap  = round(Pv/(rho*g),3);\n",
      "Z  =  Hatm  -h  -Hvap  -Ht1;\n",
      "print \"Elevation of pump (m):\",round(Z,3)\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Elevation of pump (m): -0.851\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 25.11, Page 927"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "import sympy\n",
      "from sympy import symbols,solve\n",
      "import numpy as np\n",
      "   \n",
      "\n",
      " #Initializing  the  variables\n",
      "Co  =  0;\n",
      "Qc  =  0.0024;\n",
      "V  =  5400;\n",
      "c  =  10;\n",
      " #Calculations\n",
      "#####--------------------PART(A)-----------------#######\n",
      "n1=symbols('n1')\n",
      "def partA(n1):\n",
      "    Ci = 10;\n",
      "    # t = infinity so e^(-nt) = 0\n",
      "    Q=10000*Qc/(c-Co)\n",
      "    n1 = Q*3600/V;    \n",
      "    return n1\n",
      "ans=partA(n1)\n",
      "\n",
      "print \"Part(A) : number of air changes per hour if the garage is in continuous use and the maximum permissible concentration of carbon monoxide is 0.1 per cent. :\",ans,\"\\n\"\n",
      "\n",
      "#####--------------------PART(B)-----------------#######\n",
      "n=symbols('n')\n",
      "def   partB(n):\n",
      "    Ci  =  0;         \n",
      "    n=[1.5,1.2,0.9,1.0]    \n",
      "    t=1      #  time  in  hours\n",
      "    error=[]\n",
      "    mini=100\n",
      "    ans=0\n",
      "    for i in range(4):    \n",
      "        Q  =  V/3600;           \n",
      "        A  =   10000*Qc/Q;                                                            # as Co=0 \n",
      "        error.append(abs((A*(1-math.e**(-n[i]*t))/c)-n[i]));\n",
      "        if(error[i]<mini):\n",
      "            mini=error[i]\n",
      "            ans=n[i]\n",
      "    return ans       \n",
      "ans=partB(n)\n",
      "print \"Part(B) : number of air changes per hour if this maximum level is reached after 1 hour and the garage is out of use :\",ans,'\\n'\n",
      "  \n",
      "#####--------------------PART(C)-----------------#######\n",
      "c=symbols('c')\n",
      "def   partC(c):\n",
      "    Ci  =  0;\n",
      "    n  =  1;   \n",
      "    t = 0.333333                         #  20  minutes  in  hours\n",
      "    Q  =  V*n/3600;\n",
      "    y  =    (Co  +  10000*Qc/Q)*(1-math.e**(-n*t)) + Ci*math.e**(-n*t) ;  \n",
      "    return y\n",
      "ans=partC(c)\n",
      "print \"Part(C) :the concentration after 20 minutes (Parts per 10000) :\",round(ans,3),'\\n'\n",
      "#####--------------------PART(D)-----------------#######\n",
      "t=symbols('t')\n",
      "def   partD(t):\n",
      "    Ci  =  10;\n",
      "    n  =  1;  \n",
      "    c  =  0.1;\n",
      "    t=np.log(100) \n",
      "    return round(t,2)\n",
      "ans=partD(t)    \n",
      "print \"Part(D) : time necessary to run the ventilation system at the rate calculated in (b) to reduce the concentration to 0.001 per cent (in hours) :\",ans,\"hours\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part(A) : number of air changes per hour if the garage is in continuous use and the maximum permissible concentration of carbon monoxide is 0.1 per cent. : 1.6 \n",
        "\n",
        "Part(B) : number of air changes per hour if this maximum level is reached after 1 hour and the garage is out of use : 1.0 \n",
        "\n",
        "Part(C) :the concentration after 20 minutes (Parts per 10000) : 4.535 \n",
        "\n",
        "Part(D) : time necessary to run the ventilation system at the rate calculated in (b) to reduce the concentration to 0.001 per cent (in hours) : 4.61 hours\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}