summaryrefslogtreecommitdiff
path: root/Transport_Phenomena:_A_Unified_Approach/ch2.ipynb
blob: ba2a6451f09427f0d4f4a8ca70979e8d25ea61a4 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 : Molecular transport mechanisms"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.1 - Page No :28\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "deltax = 0.1;  \t\t\t #[m] - thickness of copper block\n",
      "T2 = 100.;  \t\t\t #[degC] - temp on one side of copper block\n",
      "T1 = 0.;  \t\t\t #[degC] - temp on other side of the copper block\n",
      "k = 380.;  \t\t\t #[W/mK] - thermal conductivity\n",
      "\n",
      "# Calculations\n",
      "# using the formula (q/A)*deltax = -k*(T2-T1)\n",
      "g = -k*(T2-T1)/deltax;\n",
      "g1 = (g/(4.184*10000));\n",
      "\n",
      "# Results\n",
      "print \" The steady state heat flux across the copper block is q/A = %.1e W/m**2 \\\n",
      "\\n or in alternate units is  q/A = %.1f cal/cm*sec\"%(g,g1);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The steady state heat flux across the copper block is q/A = -3.8e+05 W/m**2 \n",
        " or in alternate units is  q/A = -9.1 cal/cm*sec\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.2 - Page No :29\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "dely = 0.1;  \t\t\t #[m] - distance between two parralel plates\n",
      "delUx = 0.3;  \t\t\t #[m/sec] - velocity of a plate\n",
      "mu = 0.001;  \t\t\t #[kg/m*sec] - viscosity\n",
      "\n",
      "# Calculations\n",
      "# using the formula tauyx = F/A = -mu*(delUx/dely)\n",
      "tauyx = -mu*(delUx/dely);\n",
      "\n",
      "# Results\n",
      "print \"The momentum flux and the the force per unit area, \\nwhich are the same thing \\\n",
      " is tauyx = F/A = %.3f N/m**2\"%(tauyx);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The momentum flux and the the force per unit area, \n",
        "which are the same thing  is tauyx = F/A = -0.003 N/m**2\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.3 - Page No :30\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "tauyx = -0.003;  \t\t #[N/m**2] - momentum flux\n",
      "dely = 0.1;  \t\t\t #[m] - distance between two parallel plates\n",
      "mu = 0.01;  \t\t\t #[kg/m*sec] - viscosity\n",
      "\n",
      "# Calculations\n",
      "# using the formula tauyx = F/A = -mu*(delUx/dely)\n",
      "delUx = -((tauyx*dely)/mu)*100;\n",
      "\n",
      "# Results\n",
      "print \" Velocity of the top plate is  deltaUx = %d cm/sec\"%(delUx);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the top plate is  deltaUx = 3 cm/sec\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.5 - Page No :31\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "d = 0.0013;  \t\t\t #[m] - diameter of the tube\n",
      "delx = 1.;  \t\t\t #[m] - length of the glass tube\n",
      "T2 = 110.6;  \t\t\t #[degC] - temperature on one end of the rod\n",
      "T1 = 0.;      \t\t\t #[degC] - temperature on other side of the rod\n",
      "k = 0.86;  \t    \t\t #[W/m*K] - thermal conductivity\n",
      "Hf = 333.5;  \t\t\t #[J/g] - heat of fusion of ice\n",
      "\n",
      "# Calculations\n",
      "# (a)using the equation (q/A) = -k*(delt/delx)\n",
      "A = (math.pi*d**2)/4;\n",
      "q = A*(-k*(T2-T1)/delx);\n",
      "\n",
      "# Results\n",
      "print \"a) the heat flow is  q = %.2e J/sec\"%(q);\n",
      "\n",
      "# (b) dividing the total heat transfer in 30minutes by the amount of heat required to melt 1g of ice\n",
      "a = abs((q*30*60)/333.5);\n",
      "print \"b) the amount or grams of ice melted in 30 minutes is %.1e g\"%(a);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) the heat flow is  q = -1.26e-04 J/sec\n",
        "b) the amount or grams of ice melted in 30 minutes is 6.8e-04 g\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.6 - Page No :36\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "d = 1.2*10**-2;  \t\t #[m] - diameter of the hole\n",
      "Ca1 = 0.083;  \t\t\t #[kmol/m**3]\n",
      "Ca2 = 0.;  \t\t\t     #[kmol/m**3]\n",
      "L = 0.04;  \t\t\t     #[m] - thickness of the iron piece \n",
      "Dab = 1.56*10**-3;  \t #[m**2/sec] - diffusion coefficient of CO2\n",
      "A = (math.pi*d**2)/4;  \t #area\n",
      "\n",
      "# Calculations\n",
      "# (a)using the formula (Na/)A = (Ja/A) = -Dab(delCa/delx)\n",
      "def f0(Ca): \n",
      "\t return 1\n",
      "\n",
      "intdCa =  quad(f0,Ca2,Ca1)[0]\n",
      "\n",
      "def f1(x): \n",
      "\t return 1\n",
      "\n",
      "intdx =  quad(f1,0,0.04)[0]\n",
      "\n",
      "g = (intdCa/intdx)*Dab;\n",
      "\n",
      "# Results\n",
      "print \"a) The molar flux with respect to stationary coordinates is Na/A) = %.3e kmol/m**2*sec\"%(g);\n",
      "\n",
      "# using the formula na/A = (Na/A)*Ma\n",
      "Ma = 44.01;  \t\t\t #[kg/mol] - molcular weight of co2\n",
      "na = (intdCa/intdx)*Dab*Ma*A*(3600/0.4539);\n",
      "print \"b) The mass flow rate is %.3f lb/hr\"%(na);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The molar flux with respect to stationary coordinates is Na/A) = 3.237e-03 kmol/m**2*sec\n",
        "b) The mass flow rate is 0.128 lb/hr\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.7 - Page No :38\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T = 30+273.15;  \t\t\t #[K] temperature\n",
      "pA = 3.;          \t\t\t #[atm] partial pressure of the component A\n",
      "R = 0.082057;  \t    \t\t #[atm*m**3*/kmol*K] gas constant\n",
      "\n",
      "# Calculation and Results\n",
      "# (a) using the equation Ca = n/V = pA/(R*T)\n",
      "Cco2 = pA/(R*T);\n",
      "Cco2 = Cco2*(44.01);\n",
      "print \" a) The concentarion of Co2 entering is %.2f kg/m**3\"%(Cco2);\n",
      "\n",
      "# (b) using the same equation as above\n",
      "pN2 = (0.79)*3;  \t\t\t #[atm] partial pressure of mitrogen(as nitrogen is 79% in air)\n",
      "R = 0.7302;  \t\t    \t #[atm*ft**3*lb/mol*R] - gas constant\n",
      "T = T*(1.8);  \t\t\t     #[R] temperature\n",
      "CN2 = pN2/(R*T);\n",
      "print \" b) The concentration of N2 entering is %.2e lb mol/ft**3\"%(CN2);\n",
      "\n",
      "# (c) using the same equation as above\n",
      "nt = 6.;\n",
      "nCo2 = 4.;\n",
      "nO2 = 2.*(0.21);\n",
      "nN2 = 2.*(0.79);\n",
      "yCo2 = nCo2/nt;\n",
      "yO2 = nO2/nt;\n",
      "yN2 = nN2/nt;\n",
      "R = 82.057;       \t\t\t #[atm*cm**3/mol*K] - gas constant\n",
      "T = 30+273.15;  \t\t\t #[K] - temperature\n",
      "pCo2 = 3*yCo2;\n",
      "Cco2 = pCo2/(R*T);\n",
      "print \" c) The concentartion of Co2 in the exit is %.2e mol/cm**3\"%(Cco2);\n",
      "\n",
      "# (d) using the same equation as above\n",
      "R = 8.3143;               \t\t\t #[kPa*m**3/kmol*K] - gas constant\n",
      "pO2 = 3*(yO2)*(101.325);  \t\t\t #[kPa] - partial pressure\n",
      "CO2 = pO2/(R*T);\n",
      "print \" d) The concentration of O2 in the exit stream is %.2e kmol/m**3\"%(CO2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a) The concentarion of Co2 entering is 5.31 kg/m**3\n",
        " b) The concentration of N2 entering is 5.95e-03 lb mol/ft**3\n",
        " c) The concentartion of Co2 in the exit is 8.04e-05 mol/cm**3\n",
        " d) The concentration of O2 in the exit stream is 8.44e-03 kmol/m**3\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.8 - Page No :39\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "# Variables\n",
      "delx = 0.3-0;     \t    \t\t #[m] - length\n",
      "d = 0.05-0;  \t    \t    \t #[m] - diameter\n",
      "A = (math.pi*d**2)/4;  \t\t\t #[m**2] - area;\n",
      "R = 8.314*10**3;  \t\t\t     #[N*m/kmol*K] - gas constant\n",
      "xco1 = 0.15;  \t\t\t        # mole prcent of co in one tank\n",
      "xco2 = 0.;            \t\t\t # mole percent of co in other tank\n",
      "p2 = 1.;  \t\t            \t #[atm] - pressure in one tank\n",
      "p1 = p2;              \t\t\t #[atm] - pressure in other tank\n",
      "D = 0.164*10**-4;  \t    \t\t #[m**2/sec] - diffusion coefficient\n",
      "T = 298.15;  \t\t\t         #[K] - temperature\n",
      "\n",
      "# Calculations\n",
      "# using the formula (Na/A) = (Ja/A) = -D*(delca/delx) = -(D/R*T)*(delpa/delx);\n",
      "delpa = (p2*xco2-p1*xco1)*10**5;  \t\t\t #[N/m**2] - pressure difference\n",
      "Na = -((D*A)/(R*T))*(delpa/delx);\n",
      "\n",
      "# Results\n",
      "print \"The initial rate of mass transfer of co2 is %.1e kmol/sec\"%(Na);\n",
      "print \"In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite\\\n",
      " direction \\nand equal to %.1e kmol/sec\"%(Na);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The initial rate of mass transfer of co2 is 6.5e-10 kmol/sec\n",
        "In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite direction \n",
        "and equal to 6.5e-10 kmol/sec\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.9 - Page No :44\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "# given\n",
      "A = 5.;  \t\t\t     #[m**2] - area of the plates\n",
      "Ft = 0.083  \t\t\t #[N] - force on the top plate\n",
      "Fb = -0.027;  \t\t\t #[N] - force on the bottom plate\n",
      "ut = -0.3;  \t\t\t #[m/sec] - velocity of the top plate\n",
      "ub = 0.1;  \t\t\t     #[m/sec] - velocity of the bottom plate\n",
      "dely = 0.01;  \t\t\t #[m]\n",
      "delux = ut-ub;  \t\t #[m/sec]\n",
      "\n",
      "# Calculations\n",
      "# using the formula tauyx = F/A = -mu(delux/dely)\n",
      "tauyx = (Ft-Fb)/A;\n",
      "mu = tauyx/(-delux/dely);  \t\t\t #[Ns/m**2]\n",
      "mu = mu*10**3;  \t\t\t #[cP]\n",
      "\n",
      "# Results\n",
      "print \" The viscosity of toulene in centipose is %.2f cP\"%(mu);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The viscosity of toulene in centipose is 0.55 cP\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.11 - Page No :51\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "po = 1.;          \t\t\t #[atm] - pressure\n",
      "p = 2.;  \t\t        \t #[atm] - pressure\n",
      "To = 0+273.15;  \t\t\t #[K] - temperature\n",
      "T = 75+273.15;  \t\t\t #[K] - temperature\n",
      "Do = 0.219*10**-4;  \t     #[m**2/sec];\n",
      "n = 1.75;\n",
      "\n",
      "# Calculations\n",
      "# usin the formula D = Do*(po/p)*(T/To)**n\n",
      "D = Do*(po/p)*(T/To)**n;\n",
      "\n",
      "# Results\n",
      "print \"The diffusion coefficient of water vapour in air at %d atm and %d degC is  \\nD \\\n",
      " = %.3e m**2/sec\"%(p,T-273.15,D);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion coefficient of water vapour in air at 2 atm and 75 degC is  \n",
        "D  = 1.674e-05 m**2/sec\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.12 - Page No :52\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables\n",
      "# given\n",
      "T = 53+273.15;  \t\t\t #[K] - temperature\n",
      "mu1 = 1.91*10**-5;\n",
      "mu2 = 2.10*10**-5;\n",
      "T1 = 313.15;  \t\t\t #[K] - temperature \n",
      "T2 = 347.15;  \t\t\t #[K] - temperature\n",
      "\n",
      "# Calculations\n",
      "# for air\n",
      "# using linear interpolation of the values in table 2.2\n",
      "def f(a):\n",
      "    return  math.log(mu1/a)/math.log(T1);\n",
      "\n",
      "def g(a):\n",
      "    return math.log(mu2)-math.log(a)-f(a)*math.log(T2);\n",
      "\n",
      "a1 = 10**-7;\n",
      "A = fsolve(g,a1)\n",
      "B = f(A);\n",
      "\n",
      "# using the formula ln(mu) = lnA+Bln(t)\n",
      "mu = math.e**(math.log(A)+B*math.log(T))*10**3;  \t\t\t #[cP]\n",
      "\n",
      "# Results\n",
      "print \" the viscosity of air at %d degC is %.4f cP\"%(T-273.15,mu);\n",
      "\n",
      "# similarly for water\n",
      "BdivR = 1646;\n",
      "A = 3.336*10**-8;\n",
      "mu = A*math.e**(BdivR/T)*10**5 \t\t\t #[cP]\n",
      "print \" the viscosity of water at %d degC is %.3f cP\"%(T-273.15,mu);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the viscosity of air at 53 degC is 0.0198 cP\n",
        " the viscosity of water at 53 degC is 0.519 cP\n"
       ]
      }
     ],
     "prompt_number": 23
    }
   ],
   "metadata": {}
  }
 ]
}