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
|
{
"metadata": {
"name": "",
"signature": "sha256:65f02fae284344ccd8037c2004c0386b9cc4ee681cfc1240a77e3be2fe2aff5e"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 1: Introductory Concepts"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 1.1, Page number 23"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Express absolute viscosity of fluids in SI units and calculate the kinematic viscosity\n",
"\n",
"# Import required modules\n",
"\n",
"import numpy as np\n",
"from prettytable import PrettyTable\n",
"\n",
"# Given\n",
"\n",
"mu = np.array([1,0.018,100]) # Absolute viscosities in centipoise\n",
"mu_poise = np.array([1,0.018,100])/100 # Absolute viscosities in poise\n",
"rho = np.array([1.0,0.0012,0.930]) # Densities in gm/cm^3\n",
"mu_SI = mu/1000 # Absolute viscosities in SI units\n",
"rho_SI = rho*1000 # Densities in SI units\n",
"nu = mu_poise/rho # Kinematic viscosities in Stokes\n",
"nu_SI = mu_SI/rho_SI # Kinematic viscosities in SI units\n",
"\n",
"# Tabulate results\n",
"\n",
"table = PrettyTable([\"Property\", \"Water\", \"Air\", \"Lube Oil\"])\n",
"table.add_row(['Absolute Viscosity mu',' ',' ',' '])\n",
"table.add_row([\"centipoise cP\",mu[0],mu[1],mu[2]])\n",
"table.add_row([\"SI units (Ns/m^2)\",mu_SI[0],mu_SI[1],mu_SI[2]])\n",
"table.add_row([' ',' ',' ',' '])\n",
"table.add_row(['Mass Density rho',' ',' ',' '])\n",
"table.add_row([\"g/cm^3\",rho[0],rho[1],rho[2]])\n",
"table.add_row([\"SI units (kg/m^3)\",rho_SI[0],rho_SI[1],rho_SI[2]])\n",
"table.add_row([' ',' ',' ',' '])\n",
"table.add_row(['Kinematic Viscosity nu',' ',' ',' '])\n",
"table.add_row([\"St\",nu[0],nu[1],round(nu[2],2)])\n",
"table.add_row([\"SI units (m^2/s)\",nu_SI[0],nu_SI[1],\"{:.2e}\".format(nu_SI[2])])\n",
"print table"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"+------------------------+--------+---------+----------+\n",
"| Property | Water | Air | Lube Oil |\n",
"+------------------------+--------+---------+----------+\n",
"| Absolute Viscosity mu | | | |\n",
"| centipoise cP | 1.0 | 0.018 | 100.0 |\n",
"| SI units (Ns/m^2) | 0.001 | 1.8e-05 | 0.1 |\n",
"| | | | |\n",
"| Mass Density rho | | | |\n",
"| g/cm^3 | 1.0 | 0.0012 | 0.93 |\n",
"| SI units (kg/m^3) | 1000.0 | 1.2 | 930.0 |\n",
"| | | | |\n",
"| Kinematic Viscosity nu | | | |\n",
"| St | 0.01 | 0.15 | 1.08 |\n",
"| SI units (m^2/s) | 1e-06 | 1.5e-05 | 1.08e-04 |\n",
"+------------------------+--------+---------+----------+\n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 1.2, Page number 23"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Calculate the force and power required to maintain the velocity\n",
"\n",
"# Given\n",
"A = 0.1 # Area of the flat plate (m^2)\n",
"U = 0.3 # Velocity of the flat plate (m/s)\n",
"mu = 0.001 # viscosity of the fluid separating the plates (m)\n",
"du = U - 0 # relative velocity between the plates\n",
"dy = 0.0001 # relative distance between the plates\n",
"\n",
"tau = mu*du/dy # Shear stress (N/m^2)\n",
"F = tau * A # Shear force (N)\n",
"Power = F * U # Power required (W)\n",
"print(\"The force required to maintain the velocity is %.2f N.\" %F)\n",
"print(\"The power required is %.2f W.\" %Power)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The force required to maintain the velocity is 0.30 N.\n",
"The power required is 0.09 W.\n"
]
}
],
"prompt_number": 23
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.3, Page number 24"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Determine the torque and power\n",
"\n",
"# Import required modules\n",
"\n",
"import math \n",
"import sympy\n",
"\n",
"# Given\n",
"l = 0.10 # length of the shaft (m)\n",
"d = 0.05 # diameter of the shaft (m)\n",
"D = 0.051 # diameter of the concentric bearing (m)\n",
"N = 500 # Rotational speed of the shaft (rpm)\n",
"mu = 0.1 # Viscosity of the lubricating oil (Ns/m^2)\n",
"theta = sympy.Symbol('theta')\n",
"\n",
"u = round(math.pi*d*N/60,2) # Peripheral speed of the shaft (m/s)\n",
"du = u - 0 \n",
"dy = (D-d)/2\n",
"tau = round(mu*du/dy,0) # Shear stress (N/m^2)\n",
"T = sympy.integrate(tau*d/2*d/2*l,(theta,0,2*math.pi)) # Torque required to turn the shaft (Nm)\n",
"omega = u/(d/2) # Angular speed of the shaft\n",
"Power = round(T,3)*omega # Power required to turn the shaft (W)\n",
"\n",
"print(\"The power required to turn the shaft is %1.3f W.\" %Power)\n",
"# Wrong rounding-off of Torque T in textbook. Hence, the difference in value of power. Textbook answer Power = 5.387 W"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power required to turn the shaft is 5.397 W.\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.4, Page number 25"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# The power dissipated in the bearing\n",
"\n",
"# Import required modules\n",
"import sympy\n",
"\n",
"# Given\n",
"R = 0.1/2 # Radius of the bearing (m)\n",
"mu = 0.08 # Viscosity of oil film (Ns/m^2)\n",
"dy = 0.0015 # separation distance (m)\n",
"N = 100 # Rotational speed of the bearing (rpm)\n",
"r = sympy.Symbol('r')\n",
"theta = sympy.Symbol('theta')\n",
"\n",
"omega = round(2*math.pi*100/60,2) # Angular velocity of the bearing (rad/s)\n",
"u = r*omega # Linear velocity of the bearing (m/s)\n",
"du = u - 0 # Relative velocity \n",
"tau = mu * du/dy # Shear stress (N/m^2)\n",
"T = sympy.integrate(tau*r*r,(theta,0,2*math.pi),(r,0,R)) # Total torque on the shaft (Nm)\n",
"Power = round(T,5)*omega # Power dissipated (W)\n",
"print(\"The power dissipated by the bearing is %.4f W.\" %Power)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The power dissipated by the bearing is 0.0574 W.\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.5, Page number 26"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Determine shear stress for r/R ratios and calculate drag force per meter length of the pipe\n",
"\n",
"# Import required modules\n",
"import sympy\n",
"import math\n",
"from tabulate import tabulate\n",
"\n",
"# Given\n",
"r = sympy.Symbol('r') # Radial distance for the point\n",
"R = sympy.Symbol('R') # Radial distance for the wall\n",
"U = 10 # Centreline velocity (m/s)\n",
"mu = 0.002 # Viscosity (Ns/m^2)\n",
"r_R = [0.0,0.2,0.5,0.8,1.0] # r/R ratios\n",
"u = U*(1-(r/R)**2) # Expression for velocity in a pipe-flow\n",
"y = R-r # Distance from the wall\n",
"\n",
"du = sympy.diff(u,r) # Derivative of 'u' expression\n",
"dy = sympy.diff(y,r) \n",
"tau = mu*du/dy # Newton's law of viscosity (N/m^2)\n",
"F = 2*math.pi*R*tau # Drag force (N)\n",
"\n",
"# Substitution of r/R ratios\n",
"table = []\n",
"for i, r_R in enumerate(r_R): \n",
" table.append([r_R,round(tau.subs([(R,1.0/2.0),(r,r_R*1.0/2.0)]),4),\n",
" round(F.subs([(R,1.0/2.0),(r,r_R*1.0/2.0)]),4)])\n",
"print tabulate(table, headers=['r/R', 'Shear stress, tau (N/m^2)', 'Drag force, F (N)'],tablefmt='grid',numalign=\"center\")\n",
"# The Drag force printed in the textbook for the r/R = 0.8 is wrong"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"+-------+-----------------------------+---------------------+\n",
"| r/R | Shear stress, tau (N/m^2) | Drag force, F (N) |\n",
"+=======+=============================+=====================+\n",
"| 0 | 0 | 0 |\n",
"+-------+-----------------------------+---------------------+\n",
"| 0.2 | 0.016 | 0.0503 |\n",
"+-------+-----------------------------+---------------------+\n",
"| 0.5 | 0.04 | 0.1257 |\n",
"+-------+-----------------------------+---------------------+\n",
"| 0.8 | 0.064 | 0.2011 |\n",
"+-------+-----------------------------+---------------------+\n",
"| 1 | 0.08 | 0.2513 |\n",
"+-------+-----------------------------+---------------------+\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.6, Page number 27"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Determine average thickness of the film\n",
"\n",
"# Import required modules\n",
"import sympy\n",
"\n",
"# Given\n",
"n = 800 # Normal reaction by the ice on the skater (N)\n",
"f = 0.02 # Coefficient of friction between the skates and the ice \n",
"u = 54*1000/3600 # Speed of the skater (m/s)\n",
"A = 10e-4 # Skating area (m^2)\n",
"mu = 0.001 # Viscosity of water (Ns/m^2)\n",
"h = sympy.Symbol('h') # average thickness of the film\n",
"\n",
"F = f*n # Frictional reaction (N)\n",
"du_dy = (u-0)/h # Velocity gradient\n",
"tau = mu*du_dy # Shear stress (N/m^2)\n",
"print('The average thickness of the film is %.3e m.'\n",
" %sympy.solve(sympy.Eq(tau*A,F),h)[0]) # Solve for h by equating drag force to frictional reaction"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The average thickness of the film is 9.375e-07 m.\n"
]
}
],
"prompt_number": 23
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.7, Page number 30"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Determine necessary increase of pressure\n",
"\n",
"# Given\n",
"K = 2.07e6 # Bulk modulus of water (kN/m^2)\n",
"gamma = 1.4 # Specific heat ratio\n",
"p = 101.324 # Atmospheric pressure (kN/m^2)\n",
"vol_red = 0.01 # Volume reduction \n",
"\n",
"# (a) At same temperature\n",
"dp = vol_red * K # increase in pressure (kN/m^2)\n",
"print('The increase in pressure required for water is %d kN/m^2.' %dp)\n",
"# (b) isentropic compression of air\n",
"K = gamma * p # Bulk modulus of air (kN/m^2)\n",
"dp = vol_red * K # increase in pressure (kN/m^2)\n",
"print('The increase in pressure required for air is %.2f kN/m^2.' %dp)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The increase in pressure required for water is 20700 kN/m^2.\n",
"The increase in pressure required for air is 1.42 kN/m^2.\n"
]
}
],
"prompt_number": 25
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.7, Page number 34"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Height of capillary rise\n",
"\n",
"# Import required modules\n",
"import math\n",
"\n",
"# Given\n",
"sigma = 0.0736 # Surface tension between water and glass (N/m)\n",
"theta = 0 # Angle of contact\n",
"d = 2e-3 # Diameter of the glass tube (m)\n",
"g = 9.81 # Acceleration due to gravity (m/s^2)\n",
"rho = 1000 # Density of water (kg/m^3)\n",
"\n",
"h = 4*sigma*math.cos(theta)/(rho*g*d) # height of capillary rise (m)\n",
"print('The water in the glass tube rises through a height of %0.3f m'%h)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The water in the glass tube rises through a height of 0.015 m\n"
]
}
],
"prompt_number": 28
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.8, Page number 34"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Gauge pressure and absolute pressure within a droplet and a jet\n",
"\n",
"# Given\n",
"d_droplet = 0.004 # Diamter of the droplet (m)\n",
"d_jet = 0.004 # Diameter of the jet (m)\n",
"sigma = 0.073 # Viscosity of water (Ns/m^2)\n",
"P_atm = 101300 # Atmospheric pressure (N/m^2)\n",
"\n",
"# (a) For the droplet\n",
"P_gauge = 4*sigma/d_droplet # Gauge pressure for droplet (N/m^2)\n",
"P_abs = P_atm + P_gauge # Absolute pressure (N/m^2)\n",
"print('The gauge pressure and absolute pressure within a droplet is %d N/m^2 and %.3f kN/m^2 respectively.' %(P_gauge,P_abs/1000))\n",
"\n",
"# (a) For the jet\n",
"P_gauge = 2*sigma/d_jet # Gauge pressure for jet (N/m^2)\n",
"P_abs = P_atm + P_gauge # Absolute pressure (N/m^2)\n",
"print('The gauge pressure and absolute pressure within a jet is %.1f N/m^2 and %.2f kN/m^2 respectively.' %(P_gauge,P_abs/1000))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The gauge pressure and absolute pressure within a droplet is 73 N/m^2 and 101.373 kN/m^2 respectively.\n",
"The gauge pressure and absolute pressure within a jet is 36.5 N/m^2 and 101.34 kN/m^2 respectively.\n"
]
}
],
"prompt_number": 38
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.9, Page number 34"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Difference in level of the miniscii\n",
"\n",
"# Import required modules\n",
"import sympy\n",
"\n",
"# Given\n",
"d_1 = 1.0e-3 # Diameter of capillary (m)\n",
"d_2 = 1.5e-3 # Diameter of another capillary (m)\n",
"sigma = 0.0075 # Surface tension of water (Ns/m^2)\n",
"g = 9.81 # Acceleration due to gravity (m/s^2)\n",
"rho = 1000 # Density of water (kg/m^3)\n",
"h = sympy.Symbol('h') # Difference in level of the miniscii (m)\n",
"\n",
"h = sympy.solve(sympy.Eq(math.pi*d_2*sigma-math.pi*d_1*sigma,math.pi*d_2**2*h*rho*g/4),h)[0]*1000 # Solve for h\n",
"print('The difference in level of the miniscii is %.2f mm' %h)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The difference in level of the miniscii is 0.68 mm\n"
]
}
],
"prompt_number": 51
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.10, Page number 38"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Shear stress calculation and estimate the viscosity\n",
"\n",
"# Import required modules\n",
"import sympy\n",
"\n",
"# Given\n",
"U_max = 0.2 # Maximum velocity (m/s)\n",
"h = 0.01 # film thickness (m)\n",
"mu = 0.5 # Viscosity of the non-Newtonian fluid (Ns/m^2)\n",
"y = sympy.Symbol('y') \n",
"u = sympy.Symbol('u') \n",
"u = U_max * (2*(y/h)-(y/h)**3/3) # Expression for velocity\n",
"\n",
"# (a) Shear stress calculation\n",
"du_dy = sympy.diff(u,y) # Velocity gradient\n",
"tau = mu*(round(du_dy.subs(y,h)))**1.3 # Shear stress of the non-Newtonian fluid (N/m^2)\n",
"print('The shear stress at the solid surface is %.2f N/m^2.' %tau)\n",
"\n",
"# (b) Estimation of the viscosity of the Newtonian fluid\n",
"mu = sympy.Symbol('mu')\n",
"mu = sympy.solve(sympy.Eq(round(tau,2),mu*round(du_dy.subs(y,h))))[0] # Solve for mu for the same shear stress using Newton's law of viscosity\n",
"print('The viscosity of a Newtonian fluid to induce the same shear stress is %.2f Ns/m^2.' %mu)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The shear stress at the solid surface is 24.56 N/m^2.\n",
"The viscosity of a Newtonian fluid to induce the same shear stress is 1.23 Ns/m^2.\n"
]
}
],
"prompt_number": 69
}
],
"metadata": {}
}
]
}
|