summaryrefslogtreecommitdiff
path: root/Fluid_Mechanics/Chapter1.ipynb
blob: 2869f3845771bc33c7277af194106a59fd5b2f35 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:5a200234453d213b93dc5d138f72ecdaaca8b6177244c9440288df8fe014829f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Chapter 1 : Fluid Properties"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.1 Page no 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "Mw = 29.0                   # Molecular weight of air\n",
      "\n",
      "R = 8323/Mw                 # Universal gas constant\n",
      "\n",
      "T = 273 + 20                # temperature in K\n",
      "\n",
      "p = 50*144*47.88            # Pressure in N/m**2\n",
      "\n",
      "\n",
      "rho = p/(R*T)               # from the state law\n",
      "\n",
      "print \"Desnity of air at 20 deg C and 50 psia = \",round(rho,2),\"kg/m**3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Desnity of air at 20 deg C and 50 psia =  4.1 kg/m**3"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.2 Page no 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "dP = 10**6                # Pressure drop in N/m**2\n",
      "\n",
      "V = 1                      # Volume in m**3\n",
      "\n",
      "bta = 2.2*10**9            # Bulk modulus of elasticity in N/m**2\n",
      "\n",
      "\n",
      "dV = -dP*V/bta             # Change in volume in m**3\n",
      "\n",
      "v = -dV*100\n",
      "\n",
      "print \"Reduction in volume = \",round(v,3),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reduction in volume =  0.045 %\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.3 Page no 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "bta1 = 2.28*10**9            # Bulk modulus of elasticity at 20 deg C and 103.4 N/m**2\n",
      "\n",
      "bta2 = 2.94*10**9            # Bulk modulus of elasticity at 20 deg C and 1034 N/m**2\n",
      "\n",
      "p1 = 103.4                   # Pressure in N/m**2\n",
      "\n",
      "p2 = 1034                    # Pressure in N/m**2\n",
      "\n",
      "\n",
      "bavg = (bta1+bta2)/2         # bulk modulus average in N/m**2\n",
      "\n",
      "dP = p2-p1                   # pressure drop in N/m**2\n",
      "\n",
      "V = 10                       # Volume in m**3\n",
      "\n",
      "dV = dP*V/bavg               # Change in volume in m**3\n",
      "\n",
      "v = -dV\n",
      "\n",
      "print \"Volume reduction = \",round(v,8),\"m**3\"\n",
      "\n",
      "print \"Negative sign indicates the volume has reduced\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume reduction =  -3.57e-06 m**3\n",
        "Negative sign indicates the volume has reduced"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.4 Page no 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "patm = 14.6                  # Atmospheric pressure in psia\n",
      "\n",
      "p1 = 100                     # gauge pressure at point 1 in psia\n",
      "\n",
      "p2 = 102                     # gauge pressure at point 2 in psia\n",
      "\n",
      "V = 1                        # volume in m**3\n",
      "\n",
      "p = p1+patm                  # absolute pressure in psia\n",
      "\n",
      "b = p                        # for isothermal air\n",
      "\n",
      "p1 = p2+patm                 # absolute pressure in psia\n",
      "\n",
      "b1 = p1                      # for isothermal air\n",
      "\n",
      "dP = p1 - p                  # change in pressure\n",
      "\n",
      "bavg = (b1+b)/2              # average bulk modulus of elasticity in N/m**2\n",
      "\n",
      "dV = dP*V/bavg\n",
      "\n",
      "v = -dV\n",
      "\n",
      "print \"An increase in pressure by 2 psia will result in a volume reduction of\",round(v,4),\"ft**3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "An increase in pressure by 2 psia will result in a volume reduction of -0.0173 ft**3\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.5 Page no 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "\n",
      "k = 1.4                       # gas constant\n",
      "\n",
      "R = 1716                      # Universal gas constant in ft.lb/slug^oR\n",
      "\n",
      "T = 68+460                    # temperature in *oR\n",
      "\n",
      "\n",
      "c = sqrt(k*R*T)\n",
      "\n",
      "print \"Sonic velocity in air at 68 deg F = \",round(c,0),\"ft/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Sonic velocity in air at 68 deg F =  1126.0 ft/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6 Page no 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "\n",
      "d = 0.05                        # diameter of cylinder 1 in m\n",
      "\n",
      "l = 0.2                         # length of the cylinder in meters\n",
      "\n",
      "d1 = 0.052                      # diameter of cylinder in m\n",
      "\n",
      "mu = 0.09                       # Viscosity of oil in Ns/m**2\n",
      "\n",
      "U = 1                           # velocity in m/s\n",
      "\n",
      "Y = (d1-d)/2                        # clearance between the two cylinders in m\n",
      "\n",
      "A = pi*l*d                 # area in m**2\n",
      "\n",
      "\n",
      "tau = mu*U/Y                    # Shear stress in N/m**2\n",
      "\n",
      "F = tau*A                        # Shear foce in N\n",
      "\n",
      "print \"Force required to move the piston by 1 m/s = \",round(F,2),\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force required to move the piston by 1 m/s =  2.83 N\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.7 Page no 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "from sympy import *\n",
      "\n",
      "\n",
      "mu = 1.005*10**-3                 # Viscosity of water in Ns/m**2\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "Y = 0.01                        # Distance between the walls\n",
      "\n",
      "Y1 = Y*100\n",
      "\n",
      "print \" (a) Distance between the walls = \",round(Y1,1),\"cm\"\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "y = Symbol('y')\n",
      "\n",
      "u = 10*(0.01*y-y**2)\n",
      "\n",
      "uprime = u.diff(y)\n",
      "\n",
      "y = 0\n",
      "\n",
      "U = uprime\n",
      "\n",
      "\n",
      "U1 = 0.01          # from U\n",
      "\n",
      "tau = mu*10*U1                     # shear stress in N/m**2\n",
      "\n",
      "print \" (b) Shear stress = \",round(tau,9),\"N/m**2\"\n",
      "\n",
      "\n",
      "\n",
      "tau1 = mu*10*(0.01-2*20*10**-6)        # using the equation of U and y = 20*10**-6 calc shear stress in N/m**2\n",
      "\n",
      "print \" (c) Shear Stress at 20 um from the plate = \",round(tau1,9),\"N/m**2\"\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "y1 = 0.01/2                           # shear stress location\n",
      "\n",
      "print \" (d) Location of maximum velocity = \",round(y1,3),\"m\"\n",
      "\n",
      "print \"Above calculation indicates that the zero shear stress and the maximum velocity occurs at the same location which is half way between the plate\",\"\\n\",\"This  also is in conformity with the fact that , in a flowing fluid, the velocity is maximum where shear stress is zero\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (a) Distance between the walls =  1.0 cm\n",
        " (b) Shear stress =  0.0001005 N/m**2\n",
        " (c) Shear Stress at 20 um from the plate =  0.000100098 N/m**2\n",
        " (d) Location of maximum velocity =  0.005 m\n",
        "Above calculation indicates that the zero shear stress and the maximum velocity occurs at the same location which is half way between the plate \n",
        "This  also is in conformity with the fact that , in a flowing fluid, the velocity is maximum where shear stress is zero\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.8 Page 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "d = 0.1                                # diameter of shaft in m\n",
      "\n",
      "l = 0.2                                # length of the shaft in m\n",
      "\n",
      "t = 0.00002                            # thickness in m\n",
      "\n",
      "N = 30                                 # RPM of shaft\n",
      "\n",
      "U = pi*d*30/60                    # velocity in m/s\n",
      "\n",
      "r1 = d/2\n",
      "\n",
      "r2 = r1 + t                            # radius of bearing in m\n",
      "\n",
      "mu = 0.44                              # Viscosity of SAE-30 oil in Ns/m**2\n",
      "\n",
      "\n",
      "\n",
      "F = 2*pi*r1*l*mu*U/t\n",
      "\n",
      "T =F*r1\n",
      "\n",
      "print \" (a) For linear distribution of velocity , shaft torque = \",round(T,2),\"m.N\"\n",
      "\n",
      "\n",
      "F1 = 2*pi*l*mu*U/log(r2/r1)\n",
      "\n",
      "\n",
      "T1 =F1*r1\n",
      "\n",
      "print \" (b) For non-linear distribution of velocity , shaft torque = \",round(T1,2),\"m.N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (a) For linear distribution of velocity , shaft torque =  10.86 m.N\n",
        " (b) For non-linear distribution of velocity , shaft torque =  10.86 m.N\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.9 Page 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "mu = 0.44                               # viscosity of the oil in Ns/m**2\n",
      "\n",
      "N = 300                                 # RPM of the shaft\n",
      "\n",
      "t = 0.00025                             # thickness of the film oil in m\n",
      "\n",
      "r1 = 0.15                               # radius in m\n",
      "\n",
      "r2 = 0.1                                # radius in m\n",
      "\n",
      "T = pi**2*mu*N*(r1**4-r2**4)/(60*t)\n",
      "\n",
      "P = T*2*pi*N/60\n",
      "\n",
      "print \"Watts of energy lost in overcoming friction at 300 RPM = \",round(P,0),\"Watts\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Watts of energy lost in overcoming friction at 300 RPM =  1108.0 Watts\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.10 Page no 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "d = 0.01                                 # diameter in m\n",
      "\n",
      "sigma = 0.073                            # surface tension in N/m\n",
      "\n",
      "\n",
      "dP = 4*sigma/d                           # pressure excessive\n",
      "\n",
      "print \"Excessive pressure inside the droplet = \",round(dP,2),\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Excessive pressure inside the droplet =  29.2 N"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.11 Page no 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "sigma = 0.022                            # surface tension in N/m\n",
      "\n",
      "gma = 9789                               #  specific weight\n",
      "\n",
      "S = 0.79                                 # specific gravity\n",
      "\n",
      "d = 0.002                                # diameter in m\n",
      "\n",
      "\n",
      "\n",
      "h =4*sigma*1000/(gma*S*d)                     # capillary height in m\n",
      "\n",
      "print \"The alcohol will rise to a height of\",round(h,1),\"mm in the glass tube\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The alcohol will rise to a height of 5.7 mm in the glass tube"
       ]
      }
     ],
     "prompt_number": 50
    }
   ],
   "metadata": {}
  }
 ]
}