Chapter 6:Diffusion

Example 6.1 Page 151

In [1]:
#initiation of variable
Ca=1.2 #Concentration at A in  kg/m^3
Cb=0.8 #Concentration at B in  kg/m^3
xa=5.0*10**-3#Position 1 in m
xb=10.0*10**-3#Position 2 in m
D=3.0*10**-11 #Diffusion coefficient in m^2/s

#calcualtion
J=-D*(Ca-Cb)/(xa-xb)

#result
print" Diffusion flux is %.1e kg/m^2-s" %J
 Diffusion flux is 2.4e-09 kg/m^2-s

Example 6.2 Page 153

In [3]:
#initiation of variable
from math import sqrt
x=5*10**-4     #Position in m
D=1.6*10**-11  #Diffusion coefficient  in m^2/s
Co=0.25#Initial Concentration in wt%
Cs=1.2 #Surface concentration in wt%
Cx=0.8 #Concentration at any x  in wt%
z1 = 0.35 # tabular data
z2 = 0.4 # tabular data
erf_z1 = 0.3794 # tabular data
erf_z2 = 0.4284 # tabular data

#calcualtion
C=1-((Cx-Co)/(Cs-Co))
z = (C-erf_z1)/(erf_z2-erf_z1) * (z2-z1) + z1 #  Calculation by interpolation
t= ((x/(2*sqrt(D)))/z)**2 # calculation of time

#result
print" Time required is %d" %t,"s or %.2f h" %(t/3600);
print "Answer in book is 25400 sec or 7.1 h. It is because of considering different number of significant figure"
 Time required is 25355 s or 7.04 h
Answer in book is 25400 sec or 7.1 h. It is because of considering different number of significant figure

Example 6.3 Page 154

In [4]:
#initiation of variable
D_500=4.8*10**-14 #Diffusion coefficient at 500 C
D_600=5.3*10**-13 #Diffusion coefficient at 600 C
t_600=10.0 #Time in hours to diffuse

#calculation
t_500=D_600*t_600/D_500

#result
print" Time to diffuse at 500 degree Celsius is %.1f h" %(t_500)
 Time to diffuse at 500 degree Celsius is 110.4 h

Example 6.4 Page 157

In [6]:
#initiation of variable
from math import exp
T=550+273.0 # temperature of aluminium in K
D_0=1.2*10**-4 #Temperature independent preexponential in m^2/s
Q_d=131000.0 #Activation energy in J/mol-K
R=8.31  #Universal Gas constant

#calculation
D=D_0*exp(-Q_d/(R*T));

#result
print" Diffusion coefficient is %.1e m^2/s" %D;
 Diffusion coefficient is 5.8e-13 m^2/s

Example 6.5 Page 157

In [9]:
#initiation of variable
#From graph log D ad 1/T are deducted
inv_T1=0.8*10**-3 #Reciprocal of temp.  in K^-1
inv_T2=1.1*10**-3 #Reciprocal of temp.  in K^-1
logD1=-12.4
logD2=-15.45
R=8.31 #Gas law Constant in J/mol-K

#calculation
Q_d=-2.3*R*(logD1-logD2)/(inv_T1-inv_T2)
D_0=10**(logD2+(Q_d*inv_T2/(2.3*R)))#For calculating Preexponential factor

#result
print" Activation energy is %d kJ/mol" %(Q_d/1000)
print" Preexponential factor D_0 is %.1e m^2/s" %D_0
print "Answer in book is 5.2e-5 m^2/s. It is because of consideration of different number of significant figures"
 Activation energy is 194 kJ/mol
 Preexponential factor D_0 is 5.4e-05 m^2/s
Answer in book is 5.2e-5 m^2/s. It is because of consideration of different number of significant figures

Example 6.6 (Design Problem 6.1), Page 158

In [13]:
#initiation of variable
P_m = 2.3e-14 # permissibility coefficient of CO2 through PET
P_1 = 400.0 # Pressure inside bottle in KPa
P_2 = 0.4 # Pressure outside bottle in KPa
A = 500.0 # Surface area of bottle in cm^2
x = 0.05 # wall thickness of bottle in cm
V = 750.0 # volume in cm^3

#part A
#calculation
J = -P_m*(P_2-P_1)*1e3/x # calculation of diffusion flux

print" Diffusion flux is %0.1e cm^3 STP/(cm^2-s)" %J

#partB
V_co2 = J*A 
t = V/V_co2 # calculation of self life
print" Self life for bottle of pop is %d" %(t/(60.0*60*24)),  "days (or about %d months)." %(t/(60*60*24*30))
print "Answer in book is 97 days. It is because of considering different number of significant figure"
 Diffusion flux is 1.8e-07 cm^3 STP/(cm^2-s)
 Self life for bottle of pop is 94 days (or about 3 months).
Answer in book is 97 days. It is because of considering different number of significant figure