# Chapter 5 : Diffusion¶

### Example 5.1 Page No. 114¶

In :
Ca=1.2       #Concentration at A in  kg/m**3
Cb=0.8       #Concentration at B in  kg/m**3
xa=5*10**-3   #Position 1 in m
xb=10*10**-3  #Position 2 in m

D=3*10**-11   #Diffusion coefficient in m**2/s
J=-D*(Ca-Cb)/(xa-xb)

print"Diffusion flux is ",J,"kg/m**2-s"

Diffusion flux is  2.4e-09 kg/m**2-s


### Example 5.2 Page No. 117¶

In :
from scipy.optimize import fsolve
Co=0.25        #Initial Conc. in wt%
Cs=1.2         #Surface conc. in wt%
Cx=0.8         #Conc. at any x  in wt%
x=5*10**-4     #Position in m
D=1.6*10**-11  #Diffusion coeff in m**2/s

import math
C=1-((Cx-Co)/(Cs-Co))

def f(z):
return(0.4210-math.erf(z))
z=fsolve(f,1)
t=x**2/(4.0*D*z**2.0)

print"Time required is ",round(t/3600.0,1),"h"

Time required is  7.0 h


### Example 5.3 Page No. 118¶

In :
D500=4.8*10**-14     #Diffusion coefficient at 500 C
D600=5.3*10**-13     #Diffusion coefficient at 600 C
t600=10             #Time in hours to diffuse

t500=D600*t600/D500

print"Time to diffuse at 500 C is ",round(t500,1),"h"

Time to diffuse at 500 C is  110.4 h


### Example 5.4 Page No. 121¶

In :
T=550+273            #in K
D0=1.2*10**-4        #Temperature independent preexponential in m**2/s
Qd=131000            #Activation energy in J/mol-K
R=8.31               #Universal Gas constt

import math
D=D0*math.exp(-Qd/(R*T))

print"Diffusion coefficient is ",round(D,14),"m**2/s"

Diffusion coefficient is  5.8e-13 m**2/s


### Example 5.5 Page No.121¶

In :
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

Qd=-2.3*R*(logD1-logD2)/(inv_T1-inv_T2)
print"Activation energy is",round(Qd/1000,0),"KJ"

D0=10**(logD2+(Qd*inv_T2/(2.3*R)))
print"Preexponential factor is",round(D0,6),"m**2/s"

Activation energy is 194.0 KJ
Preexponential factor is 5.4e-05 m**2/s


### Design Example 5.1, Page No.122¶

In :
C0=0.2           #Initial concentration in wt%
Cs=1             #Surface conc in wt%
Cx=0.6           #Conc at any position X in wt%
x=7.5*10**-4      #Position in m
D0=2.3*10**-5     #Preexponential factor in m**2/s
R=8.31           #Gas law constant in J/mol-K
Qd=148000        #Activation energy in J/mol

C=1-((Cx-C0)/(Cs-C0))
z=0.4747
Dt=(x/(2*z))**2

D=Dt/D0

T1=900.0
T2=950.0
T3=1000.0
T4=1050.0
t1=D/math.exp(-Qd/(R*(T1+273)))/3600.0
t2=D/math.exp(-Qd/(R*(T2+273)))/3600.0
t3=D/math.exp(-Qd/(R*(T3+273)))/3600.0
t4=D/math.exp(-Qd/(R*(T4+273)))/3600.0

print"Temperature in Celcius  are",T1,T2,T3,T4
print"Time is respectively ",round(t1,1),"h,",round(t2,1),"h,",round(t3,1),"h,",round(t4,1),"h"

Temperature in Celcius  are 900.0 950.0 1000.0 1050.0
Time is respectively  29.6 h, 15.9 h, 9.0 h, 5.3 h

In [ ]: