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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Diffusion Mass Transfer"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.1 Page 884"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"# Molar and mass fluxes of hydrogen and the relative values of the mass and thermal diffusivities for the three cases\n",
"\n",
"T = 293. \t \t\t\t\t;#[K] Temperature\n",
"Ma = 2 \t\t\t\t\t;#[kg/kmol] Molecular Mass\n",
"#Table A.8 Hydrogen-Air Properties at 298 K\n",
"Dab1 = .41*math.pow(10,-4); #[m^2/s] diffusion coefficient\n",
"#Table A.8 Hydrogen-Water Properties at 298 K\n",
"Dab2 = .63*math.pow(10,-8); #[m^2/s] diffusion coefficient\n",
"#Table A.8 Hydrogen-iron Properties at 293 K\n",
"Dab3 = .26*math.pow(10,-12); #[m^2/s] diffusion coefficient\n",
"#Table A.4 Air properties at 293 K\n",
"a1 = 21.6*math.pow(10,-6); #[m^2/s] Thermal Diffusivity\n",
"#Table A.6 Water properties at 293 K\n",
"k = .603 \t\t\t\t;#[W/m.K] conductivity\n",
"rho = 998 \t\t\t\t;#[kg/m^3] Density\n",
"cp = 4182 \t\t\t\t;#[J/kg] specific Heat\n",
"#Table A.1 Iron Properties at 300 K\n",
"a3 = 23.1 * math.pow(10,-6); #[m^2/s]\n",
"#calculations\n",
"\n",
"#Equation 14.14\n",
"#Hydrogen-air Mixture\n",
"DabT1 = Dab1*math.pow(T/298.,1.5);# [m^2/s] mass diffusivity\n",
"J1 = -DabT1*1; \t\t#[kmol/s.m^2] Total molar concentration\n",
"j1 = Ma*J1; \t\t#[kg/s.m^2] mass Flux of Hydrogen\n",
"Le1 = a1/DabT1; \t# Lewis Number Equation 6.50\n",
"\n",
"#Hydrogen-water Mixture\n",
"DabT2 = Dab2*math.pow(T/298.,1.5);# [m^2/s] mass diffusivity\n",
"a2 = k/(rho*cp) \t;#[m^2/s] thermal diffusivity \n",
"J2 = -DabT2*1 \t;#[kmol/s.m^2] Total molar concentration\n",
"j2 = Ma*J2 \t;#[kg/s.m^2] mass Flux of Hydrogen\n",
"Le2 = a2/DabT2 \t;# Lewis Number Equation 6.50\n",
"\n",
"#Hydrogen-iron Mixture\n",
"DabT3 = Dab3*math.pow(T/298.,1.5);# [m^2/s] mass diffusivity\n",
"J3 = -DabT3*1; \t#[kmol/s.m^2] Total molar concentration\n",
"j3 = Ma*J3; \t#[kg/s.m^2] mass Flux of Hydrogen\n",
"Le3 = a3/DabT3 \t;# Lewis Number Equation 6.50\n",
"#results\n",
"\n",
"print '%s %.1e' %('a (m^2/s) in 1 = ',a1)\n",
"print '%s %.1e' %('\\n a (m^2/s) in 2 = ',a2)\n",
"print '%s %.1e' %('\\na (m^2/s) in 3 = ',a3)\n",
"print '%s %.1e' %('\\nDab (m^2/s) in 1 = ',DabT1)\n",
"print '%s %.1e' %('\\n Dab (m^2/s) in 2 = ',DabT2)\n",
"print '%s %.1e' %('\\n Dab (m^2/s) in 3 = ',DabT3)\n",
"print '%s %.1e' %('\\n Le in 1 = ',Le1)\n",
"print '%s %.1e' %('\\n Le in 2 = ',Le2)\n",
"print '%s %.1e' %('\\n Le in 3 = ',Le3)\n",
"print '%s %.1e' %('\\n ja (kg/s.m^2) in 1 = ',j1)\n",
"print '%s %.1e' %('\\n ja (kg/s.m^2) in 2 = ',j2)\n",
"print '%s %.1e' %('\\n ja (kg/s.m^2) in 3 = ',j3)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"a (m^2/s) in 1 = 2.2e-05\n",
"\n",
" a (m^2/s) in 2 = 1.4e-07\n",
"\n",
"a (m^2/s) in 3 = 2.3e-05\n",
"\n",
"Dab (m^2/s) in 1 = 4.0e-05\n",
"\n",
" Dab (m^2/s) in 2 = 6.1e-09\n",
"\n",
" Dab (m^2/s) in 3 = 2.5e-13\n",
"\n",
" Le in 1 = 5.4e-01\n",
"\n",
" Le in 2 = 2.4e+01\n",
"\n",
" Le in 3 = 9.1e+07\n",
"\n",
" ja (kg/s.m^2) in 1 = -8.0e-05\n",
"\n",
" ja (kg/s.m^2) in 2 = -1.2e-08\n",
"\n",
" ja (kg/s.m^2) in 3 = -5.1e-13\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.2 Page 898"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"import numpy\n",
"from numpy import linalg\n",
"import matplotlib\n",
"from matplotlib import pyplot\n",
"# Evaporation rate through a single pore\n",
"\n",
"T = 298 \t\t\t;#[K] Temperature\n",
"D = 10*math.pow(10,-6) \t;#[m]\n",
"L = 100*math.pow(10,-6); #[m]\n",
"H = .5 \t\t\t;# Moist Air Humidity\n",
"p = 1.01325 \t\t\t;#[bar]\n",
"#Table A.6 Saturated Water vapor Properties at 298 K\n",
"psat = .03165; \t#[bar] saturated Pressure\n",
"#Table A.8 Water vapor-air Properties at 298 K\n",
"Dab = .26*math.pow(10,-4); #[m^2/s] diffusion coefficient\n",
"#calculations\n",
"\n",
"C = p/(8.314/100. *298) ;#Total Concentration\n",
"#From section 6.7.2, the mole fraction at x = 0 is\n",
"xa0 = psat/p;\n",
"#the mole fraction at x = L is\n",
"xaL = H*psat/p;\n",
"\n",
"#Evaporation rate per pore Using Equation 14.41 with advection\n",
"N = (math.pi*D*D)*C*Dab/(4*L)*2.303*math.log10((1-xaL)/(1-xa0)) ;#[kmol/s]\n",
"\n",
"#Neglecting effects of molar averaged velocity Equation 14.32\n",
"#Species transfer rate per pore\n",
"Nh = (math.pi*D*D)*C*Dab/(4*L)*(xa0-xaL) ;#[kmol/s]\n",
"#results\n",
"\n",
"print '%s %.2e %s' %('\\n Evaporation rate per pore Without advection effects',Nh,'kmol/s')\n",
"print '%s %.2e %s' %('and With Advection effects',N,'kmol/s')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" Evaporation rate per pore Without advection effects 1.30e-14 kmol/s\n",
"and With Advection effects 1.34e-14 kmol/s\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.3 Page 898"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"# Rate of water vapor molar diffusive ttansfer through the trough wall\n",
"\n",
"D = .005 \t\t\t\t\t\t;#[m] Diameter\n",
"L = 50*math.pow(10,-6); \t#[m] Length\n",
"h = .003 \t\t\t\t;#[m] Depth\n",
"Dab = 6*math.pow(10,-14) \t;#[m^2/s] Diffusion coefficient\n",
"Cas1 = 4.5*math.pow(10,-3) \t;#[kmol/m^3] Molar concentrations of water vapor at outer surface\n",
"Cas2 = 0.5*math.pow(10,-3) \t;#[kmol/m^3] Molar concentrations of water vapor at inner surface\n",
"#calculations\n",
"\n",
"#Transfer Rate through cylindrical wall Equation 14.54\n",
"Na = Dab/L*(math.pi*D*D/4. + math.pi*D*h)*(Cas1-Cas2); #[kmol/s]\n",
"#results\n",
"\n",
"print '%s %.2e %s' %('\\n Rate of water vapor molar diffusive ttansfer through the trough wall ',Na,'kmol/s');\n",
"#END"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" Rate of water vapor molar diffusive ttansfer through the trough wall 3.20e-16 kmol/s\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.4 Page 902"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"# The rate of change of the helium pressure dp/dt\n",
"\n",
"D = .2 \t\t\t;#[m] Diameter\n",
"L = 2*math.pow(10,-3) ;#[m] Thickness\n",
"p = 4 \t\t\t;#[bars] Helium Pressure\n",
"T = 20+273. \t\t\t;#[K] Temperature\n",
"#Table A.8 helium-fused silica (293K) Page 952\n",
"Dab = .4*math.pow(10,-13)\t;#[m^2/s] Diffusion coefficient\n",
"#Table A.10 helium-fused silica (293K)\n",
"S = .45*math.pow(10,-3)\t\t;#[kmol/m^3.bar] Solubility\n",
"#calculations\n",
"\n",
"# By applying the species conservation Equation 14.43 and 14.62\n",
"dpt = -6*(.08314)*T*(Dab)*S*p/(L*D);\n",
"\n",
"#results\n",
"print '%s %.2e %s' %('\\n The rate of change of the helium pressure dp/dt',dpt,' bar/s');\n",
"#END"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" The rate of change of the helium pressure dp/dt -2.63e-11 bar/s\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.5 Page 904"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"# The Hydrogen mass diffusive flux nA (kg/s.m^2)\n",
"#A -> Hydrogen\n",
"#B -> Plastic\n",
"\n",
"Dab = 8.7*math.pow(10,-8) ;#[m^2/s] Diffusion coefficient\n",
"Sab = 1.5*math.pow(10,-3) ;#[kmol/m^3.bar] Solubility\n",
"L = .0003 \t\t\t;#[m] thickness of bar\n",
"p1 = 3 \t\t\t;#[bar] pressure on one side\n",
"p2 = 1 \t\t\t;#[bar] pressure on other side\n",
"Ma = 2 \t\t\t;#[kg/mol] molecular mass of Hydrogen\n",
"#calculations\n",
"\n",
"#Surface molar concentrations of hydrogen from Equation 14.62\n",
"Ca1 = Sab*p1 \t\t\t\t; #[kmol/m^3]\n",
"Ca2 = Sab*p2 \t\t\t\t; #[kmol/m^3]\n",
"#From equation 14.42 to 14.53 for obtaining mass flux\n",
"N = Dab/L*(Ca1-Ca2) ; \t#[kmol/s.m^2]\n",
"n = Ma*N ; \t#[kg/s.m^2] on Mass basis\n",
"#results\n",
"\n",
"print '%s %.2e %s' %('\\n The Hydrogen mass diffusive flux n =',n,' (kg/s.m^2)');\n",
"#END"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" The Hydrogen mass diffusive flux n = 1.74e-06 (kg/s.m^2)\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.6 Page 909 "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"# Maximum Thickness of a bacteria laden biofilm, that may be siccessfully treated\n",
"\n",
"Dab = 2*math.pow(10,-12) \t;#[m^2/s] Diffusion coefficient\n",
"Ca0 = 4*math.pow(10,-3) \t\t;#[kmol/m^3] Fixed Concentration of medication\n",
"Na = -.2*math.pow(10,-3) \t\t;#[kmol/m^3.s] Minimum consumption rate of antibiotic\n",
"k1 = .1 \t\t\t\t\t;#[s^-1] Reaction Coefficient\n",
"#calculations\n",
"\n",
"#For firsst order kinetic reaction Equation 14.74\n",
"m = math.pow((k1/Dab),.5);\n",
"L = math.acosh(-k1*Ca0/Na) /m;\n",
"#results\n",
"\n",
"print '%s %.1f %s' %('\\n Maximum Thickness of a bacteria laden biofilm, that may be siccessfully treated is ',L*math.pow(10,6), 'mu-m');\n",
"#END"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" Maximum Thickness of a bacteria laden biofilm, that may be siccessfully treated is 5.9 mu-m\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 14.7 Page 913"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Initialization\n",
"\n",
"import math\n",
"# Total dosage of medicine delivered to the patient over a one-week time period, sensivity of the dosage to the mass duffusivity of the patch and skin\n",
"\n",
"Dap = .1*math.pow(10,-12) ;#[m^2/s] Diffusion coefficient of medication with patch\n",
"Das = .2*math.pow(10,-12) ;#[m^2/s] Diffusion coefficient of medication with skin\n",
"L = .05 \t\t\t;#[m] patch Length\n",
"rhop = 100 \t\t\t;#[kg/m^3] Density of medication on patch\n",
"rho2 = 0 \t\t\t;#[kg/m^3] Density of medication on skin\n",
"K = .5 \t\t\t;#Partition Coefficient\n",
"t = 3600*24*7 \t\t\t;#[s] Treatment time\n",
"#calculations\n",
"\n",
"#Applying Conservation of species equation 14.47b\n",
"#By analogy to equation 5.62, 5.26 and 5.58\n",
"D = 2*rhop*L*L/(math.sqrt(math.pi))*math.sqrt(Das*Dap*t)/(math.sqrt(Das)+math.sqrt(Dap)/K);\n",
"#results\n",
"\n",
"print '%s %.1f %s' %('\\n Total dosage of medicine delivered to the patient over a one-week time period is',D*math.pow(10,6) ,'mg');"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" Total dosage of medicine delivered to the patient over a one-week time period is 28.7 mg\n"
]
}
],
"prompt_number": 10
}
],
"metadata": {}
}
]
}
|