Chapter 2 : Molecular Diffusion

Example 2.1 pgno:10

In [1]:
#Calculation of average velocities

N2 = 0.05   #mole fraction of Nitrogen denoted as 1
H2 = 0.15   #mole fraction of Hydrogen denoted as 2
NH3 = 0.76  #mole fraction of Ammonia denoted as 3
Ar = 0.04   #mole fraction of Argon denoted as 4
u1 = 0.03
u2 = 0.035
u3 = 0.03
u4 = 0.02
#Calculating molar average velocity
U = N2*u1 + H2*u2 + NH3*u3 + Ar*u4
print 'Molar average velocity of gas mixture is: %.4f m/s'%U
#Calculating of mass average velocity
M1 = 28
M2 = 2
M3 = 17
M4 = 40
M = N2*M1 + H2*M2 + NH3*M3 + Ar*M4
u = (1/M)*(N2*M1*u1 + H2*M2*u2 + NH3*M3*u3 + Ar*M4*u4)
print 'Mass average velocity of gas mixture is: %.3f m/s'%u
Molar average velocity of gas mixture is: 0.0303 m/s
Mass average velocity of gas mixture is: 0.029 m/s

Example 2.2 pgno:16

In [2]:
#Diffusion of A through non-diffusing B

from math import log
from math import exp
import numpy as np

#Calcualtion for (a) part
#calculating vapor pressure of water at 301K
pv = exp(13.8573 - (5160.2/301))   #in bar
#wet-bulb temperature is 22.5 degree centigrade
#calculating mean air-film temperature
Tm = ((28+22.5)/2)+273  #in kelvin
#calculating diffusion coefficient
Dab = ((0.853*(30.48**2))*((298.2/273)**1.75))/(3600*10000)   #in m^2/s
l = 2.5e-3     #in m
P = 1.013      #in bar
R = 0.08317    #Gas constant
pAo = exp(13.8573 - (5160.2/295.2))    #vapor pressure of water at the wet-bulb temperature, 22.2C
pAl = 0.6*round(pv,4)
Na = (((round(Dab,7)*P)/(R*298.2*l))*log((P-pAl)/(P-round(pAo,3))))*18     #in kg/m^2s
#amount of water per m^2 of floor area is
thickness = 2e-3
Amount = thickness*1    #in m^3 
#density of water is 1000kg/m^3
#therefore in kg it is
amount = Amount*1000
Time_for_completion = amount/Na   #in seconds
Time_for_completion_hours = Time_for_completion/3600
print '(a) Time for complete evaporation is: %.2f'%Time_for_completion_hours,'hours'

#Calculation for (b) part
water_loss = 0.1   #in kg/m^2.h
water_loss_by_evaporation = Na*3600
total_water_loss = water_loss + water_loss_by_evaporation
time_for_disappearance = amount/total_water_loss
print '(b) Time for disappearance of water is: %0.2f'%time_for_disappearance,'hours'
#Answers may vary due to round off error
(a) Time for complete evaporation is: 15.93 hours
(b) Time for disappearance of water is: 8.87 hours

Example 2.3 pgno:17

In [4]:
#Calculation of flux and velocity

%matplotlib inline
from math import log
from math import exp
import numpy as np
from matplotlib import pyplot as plt
#calculation for (a) part
l = 1         #thickness of air in cm
pAo = 0.9     #in atm
pAl = 0.1     #in atm
Dab = 0.214   #in cm^2/s
T = 298       #in K
P = 1         #in atm
R = 82.1      #in (cm^3)(atm)/(K)(gmol)
#calculating molar flux of ammonia
Na = ((Dab*P)/(R*T*l))*log((P-pAl)/(P-pAo))
print '(a) The molar flux of Ammonia is:%0.3E'%Na,'gmol/cm^2.s'

#calculation for (b) and (c) part
Nb = 0        #air is non-diffusing
U = (Na/(P/(R*T)))     #molar average velocity
yA = pAo/P
yB = pAl/P
uA = U/yA           #
uB = 0              #since Nb=0
Ma = 17
Mb = 29
M = Ma*yA + Mb*yB
u = uA*yA*Ma/M      #since u =(uA*phoA + uB*phoB)/pho
print '(b) and (c)'
print 'Velocity of A is %0.3f'%uA,'cm/s'
print 'Velocity of B is %0.3f'%uB,'cm/s'
print 'Mass average velocity of A is %0.3f'%u,'cm/s'
print 'Molar average velocity of A is %0.2f'%U,'cm/s'

#calculation for (d) part
Ca = pAo/(R*T)
Ia = Ca*(uA - u)      #molar flux of NH3 relative to an observer moving
                      #with the mass average velocity 
print '(d) Molar flux of NH3 is %0.3E'%Ia,'gmol/cm^2.s'

z = []
pa =[]
for i in np.arange(0,1,0.01):
    z.append(i)
    
for i in range(0,len(z)):
    pa.append(1-(0.1*exp(2.197*z[i])))
    
from matplotlib.pyplot import plot
plot(z,pa);
plt.xlabel('z(cm)');
plt.ylabel('pA(atm)');
plt.title('Partial pressure distribution of A for diffusion of A through non-diffusing B \n',fontsize=14);
#Answers may vary due to round off error
(a) The molar flux of Ammonia is:1.922E-05 gmol/cm^2.s
(b) and (c)
Velocity of A is 0.522 cm/s
Velocity of B is 0.000 cm/s
Mass average velocity of A is 0.439 cm/s
Molar average velocity of A is 0.47 cm/s
(d) Molar flux of NH3 is 3.062E-06 gmol/cm^2.s
Out[4]:
<matplotlib.text.Text at 0x7fe6978>

Example 2.4 pgno:19

In [5]:
#Flux, velocity and pressure gradient

#calculation of (a) part
#given data
from math import log
from math import pi
from math import exp
import numpy as np
from matplotlib import pyplot as plt
T = 298              #in kelvin
P = 1.013            #in bar
pAl = 0              #partial pressure of oxygen(A) at liquid surface
pAo = 0.21*1.013     #partial pressure of oxygen at open mouth
l = 0.05             #length of diffusion path in m
Dab = 2.1e-5         #diffusivity in m^2/s
R = 0.08317          #in m^3.bar.kmol.K
Na = Dab*P*log((P-pAl)/(P-pAo))/(R*T*l)       #in kmol/m^2.s
area = (pi/4)*(0.015)**2
rate = area*Na
print '(a) Rate of diffusion of oxygen %0.3E'%rate,'kmol/s'
z = []
pa =[]
for i in np.arange(0,1,0.01):
    z.append(i)
    
for i in range(0,len(z)):
    pa.append(P-(P-pAo)*exp((R*T*Na*z[i])/(Dab*P)))
    
from matplotlib.pyplot import plot
plt.plot(z,pa);
plt.xlabel('z(cm)');
plt.ylabel('pA(atm)');
plt.title('Partial pressure distribution of A along the diffusion path \n',fontsize=14);

#calculation of (b) part
z = 0.025           #diffusion path
pA = 0.113          #in bar
#we have to find partial pressure gradient of oxygen at mid way of diffusion path
#let dpA/dz = ppd
ppd = -(R*T*round(Na,8)*(P-pA))/(Dab*P)
print '(b) The partial pressure gradient of oxygen at midway in diffusion path is: %0.2f'%ppd,'bar/m'

#calculation of (c) part
uA = Na*(R*T/pA)     #velocity of oxygen
uB = 0               #since nitrogen is non-diffusing hence Nb = 0
U = pA*uA/P          #since U=1/C*(uA*Ca + uB*Cb)
vAd = uA - U         #diffusion velocity of oxygen
vBd = uB - U         #diffusion velocity of nitrogen
print '(c)'
print 'Molar average velocity and diffusion velocities at "midway"'
print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'
print 'The diffusion velocity of oxygen %0.1E'%vAd,'m/s'
print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'
#at z=0(at top of tube)
uA = Na*(R*T/pAo)
uB = 0
U = pAo*uA/P
vAd = uA - U
vBd = uB - U
print 'Molar average velocity and diffusion velocities at "top of tube"'
print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'
print 'The diffusion velocity of oxygen %0.2E'%vAd,'m/s'
print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'
#at z=0.05(at bottom of tube)
#uA = inf
uB = 0
U = pAo*uA/P
vAd = uA - U
vBd = uB - U
print 'Molar average velocity and diffusion velocities at "bottom of tube"'
print 'Molar average velocity in z-direction is %0.1E'%U,'m/s'
print 'The diffusion velocity of oxygen is not infinity'
print 'The diffusion velocity of Nitrogen %0.1E'%vBd,'m/s'

#calculation of (d) part
V = -2*U
pA = 0.113
Nad = round(Na,8) - V*(pA/(R*T))
Nbd = 0 - (P - pA)*V/(R*T)
print '(d)'
print 'New molar flux of (A) %0.2E'%Nad,'kmol/m^2.s'
print 'New molar flux of (B) %0.2E'%Nbd,'kmol/m^2.s'
#Answers may vary due to round off errors
(a) Rate of diffusion of oxygen 7.151E-10 kmol/s
(b) The partial pressure gradient of oxygen at midway in diffusion path is: -4.25 bar/m
(c)
Molar average velocity and diffusion velocities at "midway"
Molar average velocity in z-direction is 9.9E-05 m/s
The diffusion velocity of oxygen 7.9E-04 m/s
The diffusion velocity of Nitrogen -9.9E-05 m/s
Molar average velocity and diffusion velocities at "top of tube"
Molar average velocity in z-direction is 9.9E-05 m/s
The diffusion velocity of oxygen 3.72E-04 m/s
The diffusion velocity of Nitrogen -9.9E-05 m/s
Molar average velocity and diffusion velocities at "bottom of tube"
Molar average velocity in z-direction is 9.9E-05 m/s
The diffusion velocity of oxygen is not infinity
The diffusion velocity of Nitrogen -9.9E-05 m/s
(d)
New molar flux of (A) 4.95E-06 kmol/m^2.s
New molar flux of (B) 7.19E-06 kmol/m^2.s

Example 2.5 pgno:21

In [5]:
#Diffusion with changing bulk concentration

from math import log
#given data
area = 3*4           #in m^2
mperarea = 3.0/12    #in kg/m^2
#part (a)
P = 1.013            #in bar
Dab = 9.95e-6        #in m^2/s
R = 0.08317          #in m^3.bar./K.kmol
T = 273+27           #in K
#let d=1
d = 1                #in m
pAo = 0.065          #partial pressure of alcohol on liquid surface
pAd = 0              #partial pressure over d length of stagnant film of air
Na = (Dab*P*log((P-pAd)/(P-pAo)))/(R*T*d)     #in kmol/m^2.s
Na = Na*60           #in kg/m^2.s
flux = mperarea/(5*60)   #since the liquid evaporates completely in 5 minutes
#now we have to find the value of d
d = Na/flux
print '(a) The air-film thickness is :%0.5f'%d,'m'
(a) The air-film thickness is :0.00193 m

Example 2.6 pgno:24

In [6]:
#Equimolar counterdiffusion

from math import pi
#given data
#part (a)
Dab = 0.23e-4*0.5*(293.0/316)**1.75     #in m^2/s
pA1 = 2*0.8           #in atm
pA2 = 2*0.2           #in atm
l = 0.15              #in m
R = 0.0821            #in m^3.atm./K.kmol
T = 293               #in K
Ma = 28
Mb = 32
Na = Dab*(pA1-pA2)/(R*T*l)   #in kmol/m^2.s
area = pi/4*(0.05)**2     #in m^2
rate = area*Na
print '(a)'
print 'The steady-state flux is: %0.2E'%Na,'kmol/m^2.s'
print 'The rate of transport of N2 from vessel 1 to 2: %0.1E'%rate,'kmol/s'

#part (b)
Nb = -Na
print '(b)'
print 'The flux and the rate of transport of oxygen is: %0.2E'%Nb,'kmol/m^2.s'

#part (c)
#let dpA/dz = ppg
dz = 0.05               #in m
ppg = (pA2 - pA1)/l     #in atm/m
pA = pA1 + (ppg)*dz     #in atm
print '(c)'
print 'Partial pressure at a point 0.05m from vessel 1 is: %0.1f'%pA,'atm'

#part (d)
nt = Ma*Na + Mb*Nb
print '(d)'
print 'Net or total mass flux: %0.3E'%nt,'kmol/m^2.s'
#Answers may vary due to round off errors
(a)
The steady-state flux is: 3.35E-06 kmol/m^2.s
The rate of transport of N2 from vessel 1 to 2: 6.6E-09 kmol/s
(b)
The flux and the rate of transport of oxygen is: -3.35E-06 kmol/m^2.s
(c)
Partial pressure at a point 0.05m from vessel 1 is: 1.2 atm
(d)
Net or total mass flux: -1.340E-05 kmol/m^2.s

Example 2.7 pgno:25

In [7]:
#Non-equimolar counterdiffusion in distillation of a binary mixture

from math import log
#given data
Ha = 274.6*32     #molar latent heat of methanol(a)
Hb = 557.7*18     #molar latent heat of water(b)
yAl = 0.76        #mole fraction of methanol in the vapour
yAo = 0.825       #mole fraction of methanol in the vapour at the liquid-vapour interface
P = 1             #in atm
l = 1e-3          #in m
T =344.2          #in K
R = 0.0821        #m^3.atm./K.kmol
Dab = 1.816e-5    #in m^2/s
Na = Dab*P*log((1-0.1247*yAl)/(1-0.1247*yAo))/(0.1247*R*T*l)
print 'Methanol flux: %0.2e'%Na,'kmol/m^2.s'
Nb = -(Ha/Hb)*Na
print 'Water flux: %0.2e'%Nb,'kmol/m^2.s'
#Answers may vary due to round off errors
Methanol flux: 4.64e-05 kmol/m^2.s
Water flux: -4.06e-05 kmol/m^2.s

Example 2.8 pgno:27

In [8]:
#Equimolar counterdiffusion in an interconnected system

#given values
from math import exp
V1 = 3000      #in cm^3
V2 = 4000      #in cm^3
Dab = 0.23     #in cm^2/s
Dba = 0.23     #in cm^2/s
l1 = 4         #in cm
d1 = 0.5       #in cm
l2 = 2         #in cm
d2 = 0.3       #in cm
pA3 = 1        #in atm
#unknowns
# pA1   and   pA2
# dpA1bydt = (Dab/V1*l1)*((pA1)-(pA2))*((math.pi*(d1**2))/4)
#on integrating using Laplace trandformation
# initial conditions
t=18000       #in seconds
pA1 = 1-0.57*(exp((-1.005)*(10**(-6))*t)-exp((-7.615)*(10**(-6))*t))
print 'Value of pA1 is %0.3f'%pA1,'atm'
Value of pA1 is 0.937 atm

Example 2.10 pgno:34

In [9]:
#Diffusion of only one component in a three-component mixture

#given values
from math import log
y1l = 0           #mol fraction of dry air
y10 = (17.53/760) #mol fraction of water
l = 1.5           #in mm
C = 0.0409        #in kmol/m^3 : calculated by P/RT
D12 = 0.923       #Diffusivity of hydrogen over water
D13 = 0.267       #Diffusivity of oxygen over water
y2 = 0.6          #mole fraction of hydrogen
y3 = 0.4          #mole fraction of oxygen
D1m = 1/((y2/D12)+(y3/D13))       #calculating mean diffusivity
Ni = (D1m*C*1000/(l*10000))*log((1-y1l)/(1-y10))
print 'Value of flux of water vapour: %0.2E'%Ni,'kmol/m^2.s'
Value of flux of water vapour: 2.96E-05 kmol/m^2.s

Example 2.11 pgno:35

In [10]:
#Multicomponent diffusion

from math import log
#given data
y1 = 0.4          #mole fraction of ethane(1)
y2 = 0.3          #mole fraction of ethylene(2)
y3 = 0.3          #mole fraction of hydrogen(3)
#calculating D13
#The Lennard-Jones parameters are
sigma1 = 4.443    #in angstrom
sigma2 = 4.163    #in angstrom
sigma3 = 2.827    #in angstrom
e1byk = 215.7
e2byk = 224.7
e3byk = 59.7
sigma13 = (sigma1 + sigma3)/2     #in angstrom
e13byk = (e1byk*e3byk)**0.5
kTbye13 = 993/113.5
ohmD13 = 0.76      #from collision integral table
D13 = ((0.001858)*(993**1.5)*((1.0/30)+(1.0/2))**0.5)/((2)*(sigma13**2)*(ohmD13))
#calculating D23
sigma23 = (sigma2+sigma3)/2
kTbye23 = ((993/224.7)*(993/59.7))*0.5
ohmD23 = 0.762
D23 = (0.001858*(993**1.5)*((1.0/28)+(1.0/2))**0.5)/(2*(sigma23**2)*ohmD23)
D = (D13+D23)/2   #in cm^2/s
l = 0.15          #in cm
#at z=0 (bulk gas)
y10 = 0.6
y20 = 0.2
y30 = 0.2
#at z=l (catalyst surface)
y1l = 0.4
y2l = 0.3
y3l = 0.3
C = 2.0/(82.1*993)   #calculated by P/RT
N1 = (D*C/l)*log((y10+y20)/(y1l+y2l))
print 'Flux of ethane %0.3E'%N1,'gmol/cm^2.s'
Flux of ethane 4.804E-05 gmol/cm^2.s

Example 2.12 pgno:43

In [11]:
#Liquid-phase diffusion

#given data
from math import pi
rc = 5e-4        #in m
D = 7e-10        #in m^2/s
Cab = 1          #in kmol/m^3
Na = 3.15e-6     #in kmol/m^2.s
W = 4*pi*(rc**2)*Na    #the rate of reaction
#let (rc+delta)/delta = 1
w1 = 4*pi*D*Cab*rc*1   #flux of the reactant to the surface of the catalyst
rcplusdelta = W/w1
delta = rc/(rcplusdelta-1)      #stagnant liquid-film thickness 
print 'The liquid-film thickness is: ',delta,'m'
The liquid-film thickness is:  0.0004 m

Example 2.13 pgno:46

In [12]:
#Diffusivity determination--diaphragm cell

#given data
from math import log
from math import pi
V1 = 60.2        #in cm^3; volume of compartment 1
V2 = 59.3        #volume of compartment 2 in cm^3
Ca1i = 0.3       #initial concentration of KCl in compartment 1
Ca2i = 0         #initial concentration of KCl in compartment 2
Ca1f = 0.215     #final concentration of KCl in compartment 1
Ca2f = 0.0863    #final concentration of KCl in compartment 2
D = 1.51e-5      #diffusivity of KCl in cm^2/s
tf = 55.2*3600   #time of the experiment in s
#calcutaling cell constant
beta = (1/(D*tf))*log((Ca1i - Ca2i)/(Ca1f - Ca2f))
#diffusion of propionic acid
Cpa1i = 0.4      #initial concentration of propionic acid in compartment 1
Cpa2i = 0        #initial concentration of propionic acid in compartment 2
Cpa1f = 0.32     #final concentration of propionic acid in compartment 1
Cpa2f = 0.0812   #final concentration of propionic acid in compartment 2 by mass balance
tfp = 56.4*3600  #time for the experiment
Dp = (1/(beta*tfp))*log((Cpa1i-Cpa2i)/(Cpa1f-Cpa2f))   #diffusivity of the propionic acid
#calculating tortusity factor
A= (pi/4)*(3.5**2)     #area of the diaphragm
epsilon = 0.39    #average porosity of the diaphragm
l = 0.18         #thickness of hte diaphragm
tou = (A*epsilon/(beta*l))*(1/V1 + 1/V2)
print 'Tortuosity factor is: ',round(tou,1)
Tortuosity factor is:  2.5