# Chapter 2 : Diffusion¶

### Example 2.1.a¶

In [30]:
#  variable declaration
rA=.3798;
rB=.3941;

# Calculation
rAB=(rA+rB)/2;                        #molecular seperation at collision
ebyk_A=71.4;
ebyk_B=195.2;
ebyk_AB=(ebyk_A/ebyk_B)**.5;          #energy of molecular attraction
pt=1.013*10**5;                       #absolute total pressure in pascal
T=298;                                #absolute temperature in kelvin
s=T/ebyk_AB;                          #collision function
#from chart f(T/ebyk_AB) = 0.5   let it be = x
x=.5;                                 #collision function
MA=28;                                #molecular weight of nitrogen
MB=44;                                #molecular weight of carbondioxide
Mnew=((1./MA)+(1./MB))**.5;
Dab= 10**-4*(1.084-.249*(Mnew))*T**1.5*((Mnew))/(pt*x*rAB**2);

# Result
print " the diffisivity of nitrogen-carbondioxide is :%f *10**-5 m**2/s"%(Dab/10**-5)

#end

 the diffisivity of nitrogen-carbondioxide is :1.678856 *10**-5 m**2/s


### Example 2.1.b¶

In [31]:


#"part(ii)"
rA=.3339;
rB=.3711;

# Calculation

rAB=(rA+rB)/2;                        #molecular seperation at collision
ebyk_A=344.7;
ebyk_B=78.6;
ebyk_AB=(ebyk_A/ebyk_B)**.5;          #energy of molecular attraction
pt=200.*10**3;                        #absolute total pressure in pascal
T=298.;                               #absolute temperature in kelvin
s=T/ebyk_AB;                          #collision function
#from chart f(T/ebyk_AB) = 0.62   let it be = x
x=0.62;                               #collision function
MA=36.5;                              #molecular weight of hydrogen chloride
MB=29;                                #molecular weight of air
Mnew=((1./MA)+(1./MB))**.5;
Dab=10.**-4*(1.084-.249*(Mnew))*T**1.5*((Mnew))/(pt*x*rAB**2);

# Result
print "\n the diffisivity of hydrogen chloride-air is :%f *10**-6 m**2/s"%(Dab/10**-6)

#end

 the diffisivity of hydrogen chloride-air is :8.488596 *10**-6 m**2/s


### Example 2.2¶

In [32]:


#  variable declaration

u=1.145*10**-3;                       #viscosity of water1.145cp
v_a=5*.0148+12*.0037+1*.0074;         #by kopp's law
t=288;                                #temperature of water in kelvin
MB=18;                                #molecular weight of water
phi=2.26;                             #association parameter for solvent-water

# Calculation
D_ab=(117.3*10**-18)*((phi*MB)**.5)*(t)/(u*(v_a)**.6);

# Result
print "\n the diffusivity of isoamyl alcohol is :%f *10**-9 m**2/s"%(D_ab/10**-9)
#end

 the diffusivity of isoamyl alcohol is :0.652780 *10**-9 m**2/s


### Example 2.3¶

In [33]:


pa1=(33./760)*1.013*10**5;              #vapour pressure of ccl4 at 273 in pascal
pa2=0;
d=1.59;
import math                             #density of liquid ccl4 in g/cm**3
#considering o2 to be non diffusing and with
T=273.;                                 #temperature in kelvin
pt=(755./780)*1.013*10**5;              #total pressure in pascal
z=.171;                                 #thickness of film
a=.82*10**-4;                           #cross-sectional area of cell in m**2
v=.0208;                                #volume of ccl4 evaporated
t=10.;                                  #time of evaporation
MB=154.;

# Calculation
#molecular wght of ccl4
rate=v*d/(MB*t);                        #.0208cc of ccl4 is evaporating in 10hrs
Na=rate*10.**-3/(3600.*a);              #flux in kmol/m**2*S

D_ab=Na*z*8314*273./(pt*(math.log((pt-pa2)/(pt-pa1))));    #molecular diffusivity in m**2/s

# Result
print "the  diffusivity of ccl4 through oxygen:%.2f *10**-6 m**2/s"%(D_ab/10.**-6)
#end

the  diffusivity of ccl4 through oxygen:6.27 *10**-6 m**2/s


### Example 2.4¶

In [34]:


z=.0305*10**-3;                   #wall thickness sorrounding the crystal
x1=0.0229;
w1=160.;                          #molecular weight of copper sulphate
w2=18.;                           #molecular weight of water
Dab=7.29*10**-10;                 #diffusivity of copper sulphatein m**2/s
#av=d/m

# Calculation
Mavg=x1*w1+(1-x1)*w2;             #average molecular wght of solution
d1=1193;                          #density of copper sulphate solution
av1=d1/Mavg;                      #value of (d/m) of copper solution

#for pure water
d2=1000.;                         #density of water
m2=18.;                           #molecular wght of water
av2=d2/m2;                        #value of (d/m) of water
allavg=(av1+av2)/2.;              #average value of d/m
xa2=0;
import math

# Result
Na=Dab*(allavg)*math.log((1-xa2)/(1-x1))/z;    #flux of cuso4 from crystal surface to bulk solution
print " the rate at which crystal dissolves :%f *10**-5 kmol/m**2*s"%(Na/10**-5)
#end

 the rate at which crystal dissolves :3.092260 *10**-5 kmol/m**2*s


### Example 2.5.a¶

In [6]:


ya1=0.8;
ya2=0.1;
T=(273+35);                            #temperature  in kelvin
pt=1*1.013*10**5;                      #total pressure in pascal
z=0.3*10**-3;                          #gas film thickness in m
Dab=.18*10**-4;                        #diffusion coefficient in m**2/s
R=8314;   #universal gas constant

# Calculation
Na=Dab*pt*(ya1-ya2)/(z*R*T)       #diffusion flux in kmol/m**2*s
rate=Na*100*10**-4*3600*46;       #since molecular weight of mixture is 46

# Result
print "\n rate of diffusion of alcohol-water vapour :%f kg/hr "%rate
#end

 rate of diffusion of alcohol-water vapour :2.751429 kg/hr


### Example 2.5.b¶

In [35]:
ya1=0.8;
ya2=0.1;
T=(273+35);                            #temperature  in kelvin
pt=1*1.013*10**5;                      #total pressure in pascal
z=0.3*10**-3;                          #gas film thickness in m
Dab=.18*10**-4;                        #diffusion coefficient in m**2/s
R=8314;                                #universal gas constant
import math
#diffusion through stagnant film

# Calculation
Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T);    #diffusion flux in kmol/m**2*s
rate=Na*100*10**-4*3600*46;                     #since molecular weight of mixture is 46

# Result
print "\n rate of diffusion if water layer is stagnant :%f *10**-3 kg/s "%(rate/(3600*10**-3))
#end

 rate of diffusion if water layer is stagnant :1.642207 *10**-3 kg/s


### Example 2.6¶

In [36]:

T=298.;                       #temperature in kelvin
pt=1.*1.013*10**5;            #total pressure in pascal
ID=25.*10**-3;                #internal diameter in m of unvulcanised rubber in m
OD=50.*10**-3;                #internal diameter in m of unvulcanised rubber in m
Ca1=2.37*10**-3;              #conc. of hydrogen at the inner surface of the pipe in kmol/m**3
Ca2=0;                        #conc. of hydrogen at 2
Dab=1.8*10**-10;              #diffusion coefficient in cm**2/s
l=2;                          #length of pipe in m
import math

# Calculation
#    Va=Da*Sa*(pa1-pa2)/z;
z=(50-25)*10**-3/2.;                        #wall thickness in m
Va=Dab*(Ca1-Ca2)/z;                         #diffusion through a flat slab of thickness z
Sa=2*3.14*l*(OD-ID)/(2*math.log(OD/ID));    #average mass transfer area of
rate=Va*Sa;                                 #rate of loss of hydrogen by diffusion

# Result

print "\n rate of loss hydrogen by diffusion through a pipe of 2m length :%f*10**-12kmol/s"%(rate/10.**-12)
#end

 rate of loss hydrogen by diffusion through a pipe of 2m length :7.730099*10**-12kmol/s


### Example 2.7¶

In [37]:

pa1=(1.5)*10**4;                #vapour pressure of ammonia at pt.1
pa2=(0.5)*10**4;                #vapour pressure of ammonia at pt.2
Dab=2.3*10**-5                  #molecular diffusivity in m**2/s
z=0.15;                         #diffusion path in m
R=8314.;                        #universal gas constant
#ammonia diffuses through nitrogen under equimolar counter diffusion
T=298.;                         #temperature in kelvin
pt=1.013*10**5;                 #total pressure in pascal

# Calculation
Na=Dab*(pa1-pa2)/(z*R*T);       #flux in kmol/m**2*S

# Result
print "the ammonia diffusion through nitrogen under equimolar \
counter diffusion:%f *10**-7 kmol/m**2*s"%(Na/10**-7);
#end

the ammonia diffusion through nitrogen under equimolar  counter diffusion:6.188855 *10**-7 kmol/m**2*s


### Example 2.8¶

In [39]:
import math

z=0.4*10**-2;            #film thickness sorrounding the crystal
xa1=0.0453;              #mole fraction of ethanol at pos.2
xa2=0.02775;             #mole fraction of ethanol at pos.1
w1=46;                   #molecular weight of ethanol
w2=18;                   #molecular weight of water
Dab=74*10**-5*10**-4;    #diffusivity of ethanol water sol.in m**2/s
#av=d/m

# Calculation
Mavg1=xa2*w1+(1-xa2)*w2;        #average molecular wght of solution at pos 1
d1=0.9881*10**3;                # density of 6.8 wt%  solution
av1=d1/Mavg1;                   #value of (d/m) of copper solution

#for pure water
d2=972.8;                                   # density of 10.8 wt%  solution
Mavg2=xa1*w1+(1-xa1)*w2;                    #average molecular wght of solution at pos.2
av2=d2/Mavg2;                               #value of (d/m) of water

allavg=(av1+av2)/2;                         #average value of d/m
Na=Dab*(allavg)*math.log((1-xa2)/(1-xa1))/z;   #steady state flux in kmol/m**2*s of ethanol water sol.

# Result
print "\n the rate at which crystal dissolves :%f *10**-5 kmol/m**2*s"%(Na/10**-5)
#end

 the rate at which crystal dissolves :1.737360 *10**-5 kmol/m**2*s


### Example 2.9¶

In [41]:

import math
#  variable declaration

#basis : 100kg of mixture
z=2*10**-3;                 #film thickness sorrounding the water
xa1=0.0323;                 #mole fraction of ethanol at pos.2
xa2=0.0124;                 #mole fraction of ethanol at pos.1
w1=60.;                     #molecular weight of acetic acid
w2=18.;                     #molecular weight of water
Dab=0.000095;               #diffusivity of acetic water sol.in m**2/s
#av=d/m
# Calculation
Mavg1=xa1*w1+(1-xa1)*w2;    #average molecular wght of solution at pos 1
d1=1013.;                   # density of 10 % acid
av1=d1/Mavg1;               #value of (d/m) of copper solution

#for pure water
d2=1004;                    #density of 4% acid
Mavg2=xa2*w1+(1-xa2)*w2;    #average molecular wght of solution at pos.2
av2=d2/Mavg2;               #value of (d/m) of water

allavg=(av1+av2)/2.;        #average value of d/m
#assuming water to be non diffusing
Na=Dab*(allavg)*math.log((1-xa2)/(1-xa1))/z;    #diffusion rate of acetic acid aacross film of non diffusing water sol.

# Result
print "\n diffusion rate of acetic acid aacross film of non diffusing water sol. :%f kmol/m**2*s"%Na
#end

 diffusion rate of acetic acid aacross film of non diffusing water sol. :0.051508 kmol/m**2*s


### Example 2.10.a¶

In [43]:


pa1=190;                #vapour pressure of ammonia at pt.1
pa2=95;                 #vapour pressure of ammonia at pt.2
Dab=2.1*10**-5          #molecular diffusivity in m**2/s
z=1;
R=760*22.414/273;       #universal gas constant in mmHg*m**3*K*kmol
#carbondioxide and oxygen experiences equimolar counter diffusion
T=298.;                 #temperature in kelvin

# Calculation
pt=(10.0/780)*1.013*10**5;      #total pressure in pascal
Na=Dab*(pa1-pa2)/(z*R*T);       #flux in kmol/m**2*S
rate=Na*(3.14*r**2);            #rate of mass transfer..(3.14*r**2)-is the area

# Result
print "\n the rate of mass transfer.:%f *10**-10 kmol/s"%(rate/10**-10)

#end

 the rate of mass transfer.:2.105552 *10**-10 kmol/s


### Example 2.10.b¶

In [44]:


pa1=(190.);                #vapour pressure of ammonia at pt.1
pa2=(95.);                 #vapour pressure of ammonia at pt.2
Dab=2.1*10**-5             #molecular diffusivity in m**2/s
R=760.*22.414/273;         #universal gas constant in mmHg*m**3*K*kmol
#carbondioxide and oxygen experiences equimolar counter diffusion
T=298.;                           #temperature in kelvin

# Calculation
pt=(10./780)*1.013*10**5;         #total pressure in pascal

#part (ii)
#(ya-ya1)/(ya2-ya1)=(z-z1)/(z2-z1);
z2=1;                        #diffusion path in m at pos.2
z1=0;                        #diffusion path in m at pos.1
z=.75;                       #diffusion at general z
#pa=poly([0],'pa');          #calc. of conc. in gas phase
x= 118.750000 #roots((pa-pa1)/(pa2-pa1)-(z-z1)/(z2-z1));

# Result
print "\n partial pressure of co2 at o.75m from the end where partial pressure is 190mmhg is:%f mmHg"%x
#end

 partial pressure of co2 at o.75m from the end where partial pressure is 190mmhg is:118.750000 mmHg


### Example 2.11.a¶

In [45]:

ya1=0.2;                            #initial mole fraction
ya2=0.1;                            #final mole fraction
T=298                               #temperature  in kelvin
pt=1*1.013*10**5;                   #total pressure in pascal
z=0.2*10**-2;                       #gas film thickness in m
Dab=.215*10**-4;                    #diffusion coefficient in m**2/s
R=8314.;                            #universal gas constant
#part (i)when N2 is non diffusing
import math

# Calculation
Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T);    #diffusion flux in kmol/m**2*s

# Result
print " diffusion flux if N2 is non diffusing :%f *10**-5 kmol/m**2*s "%(Na/10**-5);

#end

 diffusion flux if N2 is non diffusing :5.176955 *10**-5 kmol/m**2*s


### Example 2.11.b¶

In [46]:

ya1=0.2;
ya2=0.1;
T=(298);                            #temperature  in kelvin
pt=1*1.013*10**5;                   #total pressure in pascal
z=0.2*10**-2;                       #gas film thickness in m
Dab=.215*10**-4;                    #diffusion coefficient in m**2/s
R=8314;                             #universal gas constant

#part (ii) equimolar counter diffusion
# Calculation
Na=Dab*pt*(ya1-ya2)/(z*R*T)               #diffusion flux in kmol/m**2*s

# Result
print " diffusion  flux of oxygen during equimolar counter-diffusion :%f *10**-5 kmol/m**2*s "%(Na/10**-5)

#end

 diffusion  flux of oxygen during equimolar counter-diffusion :4.395331 *10**-5 kmol/m**2*s


### Example 2.12¶

In [15]:

ya1=0.1;
ya2=0;
T=293.                              #temperature  in kelvin
pt=1*1.013*10**5;                   #total pressure in pascal
z=0.2*10**-2;                       #gas film thickness in m
Dab=.185*10**-4;                    #diffusion coefficient in m**2/s
R=8314.;                            #universal gas constant
#part (i)when air is assumed to be stagnant and non-diffusing
import math

# Calculation
Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T);    #diffusion flux in kmol/m**2*s
mw=17;                                          #molecular weight of ammonia
massflux=Na*mw;                                 #mass flux of given NH3
print " diffusion flux when total presssure is 1atm and air \
is non-diffusing :%f *10**-4 kg/m**2*s "%(massflux/10**-4);
#part (ii) when pressure is increased to 10atm

#Dab_1/Dab_2=pt_2/pt_1
pt_2=10;                                         #final pressure  in atm
pt_1=1;                                          #initially pressure was 1atm
Dab_1=.185;                                      #initially diffusion coefficient was.185
Dab_2=Dab_1*pt_1/pt_2;                           #for gases Dab is proportional to 1/pt
Dab=Dab_2*10**-4;                                #new diffusion coefficient
pt=pt_2*1.013*10**5;                             #new total pressure
Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T);     #diffusion flux in kmol/m**2*s

# Result
print "diffusion  flux when pressure is increased to 10atm :%f *10**-5 kmol/m**2*s "%(Na/10**-5);
print "so the rate of diffusion remains same on increasing the pressure"
#end

 diffusion flux when total presssure is 1atm and air  is non-diffusing :6.889701 *10**-4 kg/m**2*s
diffusion  flux when pressure is increased to 10atm :4.052765 *10**-5 kmol/m**2*s
so the rate of diffusion remains same on increasing the pressure


### Example 2.13¶

In [47]:

#  variable declaration
T=290.0;                    #temperature in kelvin
z=2*10**-3;                 #film thickness sorrounding the water
xa2=0.0092;                 #mole fraction of ethanol at pos.2
xa1=0.0288;                 #mole fraction of ethanol at pos.1
w1=60.0;                    #molecular weight of acetic acid
w2=18.0;                    #molecular weight of water
Dab=0.95*10**-9;            #diffusivity of acetic water sol.in m**2/s
#av=d/m
# Calculation
Mavg1=xa1*w1+(1-xa1)*w2;       #average molecular wght of solution at pos 1
d1=1012.0;                     # density of 10 % acid
av1=d1/Mavg1;                  #value of (d/m) of copper solution

#for position 2
d2=1003.0;                  #density of 4% acid
Mavg2=xa2*w1+(1-xa2)*w2;    #average molecular wght of solution at pos.2
av2=d2/Mavg2;               #value of (d/m) of water

allavg=(av1+av2)/2;         #average value of d/m

#assuming water to be non diffusing
import math
Na=Dab*(allavg)*math.log((1-xa2)/(1-xa1))/z;    #diffusion rate of acetic acid aacross film of non diffusing water sol.

# Result
print "diffusion rate of acetic acid aacross film of non diffusing water sol. :%f *10**-7 kmol/m**2*s"%(Na/10.0**-7)
#end

diffusion rate of acetic acid aacross film of non diffusing water sol. :5.088553 *10**-7 kmol/m**2*s


### Example 2.14¶

In [48]:


ya1=0.2;                          #molefraction at pos.1
ya2=0.1;                          #molefraction at pos.2
T=(293);                          #temperature  in kelvin
pt=1*1.013*10**5;                 #total pressure in pascal
z=0.2*10**-2;                     #gas film thickness in m
Dab=.206*10**-4;                  #diffusion coefficient in m**2/s
R=8314;                           #universal gas constant
#for ideal gases volume fraction =mole fraction
#part (i)when N2 is non diffusing
import math

# Calculation
Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T);    #diffusion flux in kmol/m**2*s
print "\n  diffusion flux if N2 is non diffusing :%f *10**-5 kmol/m**2*s "%(Na/10**-5);
#part (ii) equimolar counter diffusion

Na=Dab*pt*(ya1-ya2)/(z*R*T)             #diffusion flux in kmol/m**2*s

# Result
print "\n  diffusion  flux of nitrogen during equimolar counter-diffusion :%f *10**-5 kmol/m**2*s "%(Na/10**-5)

#end

  diffusion flux if N2 is non diffusing :5.044891 *10**-5 kmol/m**2*s

diffusion  flux of nitrogen during equimolar counter-diffusion :4.283207 *10**-5 kmol/m**2*s


### Example 2.15¶

In [49]:


pa1=0.2*10**5;            #partial pressure at pos.1
pa2=0;                    #partial pressure at pos.2
r=10./2;                  #radius of tank in which benzene is stored
T=298.;                   #temperature  in kelvin
pt=1*1.013*10**5;         #total pressure in pascal
z=10*10**-3;              #gas film thickness in m
Dab=.02/3600;             #diffusion coefficient in m**2/s
R=8314.;                  #universal gas constant
#benzene is stored in atank of dia 10m
#part (i)when air is assumed to be stagnant
import math

# Calculation
Na=Dab*pt*math.log((pt-pa2)/(pt-pa1))/(z*R*T);    #diffusion flux in kmol/m**2*s
rate=Na*(3.14*r**2);                              #rate of loss of benzene if air is stagnant

# Result
print "diffusion rate of loss of benzene :%f *10**-4 kmol/s "%(rate/10**-4);
#end

diffusion rate of loss of benzene :3.921799 *10**-4 kmol/s


### Example 2.16¶

In [50]:


ya2=0.1;                             #molefraction at pos.2
ya1=0.8;                             #molefraction at pos.1
T=(370.);                            #temperature  in kelvin
pt=1*1.013*10**5;                    #total pressure in pascal
z=0.1*10**-3;                        #gas film thickness in m
Dab=.15*10**-2;                      #diffusion coefficient in m**2/s
R=8314;                              #universal gas constant
Area=10;                             #area of the film is 10m**2

#for gase Dab=T**3/2
#Dab1/Dab2=(T1/T2)**3/2
import math
T2=370.;                                        #final temperature in kelvin
T1=298.;                                        #initial temperature in kelvin

# Calculation
Dab1=.15*10**-2;                               #initial diffusion coefficient
Dab2=((T2/T1)**(3./2))*Dab1;                   #final diffusion coefficient
Na=Dab2*pt*math.log((1-ya2)/(1-ya1))/(z*R*T);  #diffusion flux in kmol/m**2*s
rate=Na*3600*46*Area;                          #rate of diffusion of alcohol-water vapour in kg/hour

# Result
print " rate of diffusion of alcohol-water vapour  :%f *10**6 kg/hour "%(rate/10**6)

#end

 rate of diffusion of alcohol-water vapour  :1.702149 *10**6 kg/hour


### Example 2.17¶

In [52]:


ya2=0;                       #molefraction at pos.2
ya1=0.1;                     #molefraction at pos.1
T=(273);                     #temperature  in kelvin
pt=1*1.013*10**5;            #total pressure in pascal
z=2*10**-3;                  #gas film thickness in m
Dab=.198*10**-4;             #diffusion coefficient in m**2/s
R=8314;                      #universal gas constant

#for gase Dab=T**3/2
#Dab1/Dab2=(T1/T2)**3/2
import math
T2=293;                        #final temperature in kelvin
T1=273;                        #initial temperature in kelvin

# Calculation
Dab1=0.198*10**-4;               #initial diffusion coefficient
Dab2=((T2/T1)**(3.0/2))*Dab1;    #final diffusion coefficient
Na=Dab2*pt*math.log((1-ya2)/(1-ya1))/(z*R*T2);    #diffusion flux in kmol/m**2*s
print "  flux of diffusion of ammonia through inert film :%f *10**-5 kmol/m**2*s "%(Na/10**-5)

#if pressure is also incresed from 1 to 5 atm
#for gases Dab=(T**3/2)/pt;
#Dab1/Dab2=(T1/T2)**3/2*(p2/p1)
T2=293.;                    #final temperature in kelvin
T1=273.;                    #initial temperature in kelvin
pa2=5.;                     #final pressure in atm
pa1=1;                      #initial pressure in atm
p=pa2*1.013*10**5;
Dab1=.198*10**-4;                              #initial diffusion coefficient
Dab2=((T2/T1)**(3.0/2))*Dab1*(pa1/pa2);        #final diffusion coefficient
Na=Dab2*p*math.log((1-ya2)/(1-ya1))/(z*R*T2);  #diffusion flux in kmol/m**2*s

# Result
print "flux of diffusion of ammonia if temp. is 20 and pressure is 5 atm  :%f*10**-5 kmol/m**2*s "%(Na/10**-5)
print "so there is no change in flux when pressure is changed"
#end

  flux of diffusion of ammonia through inert film :4.337554 *10**-5 kmol/m**2*s
flux of diffusion of ammonia if temp. is 20 and pressure is 5 atm  :4.822834*10**-5 kmol/m**2*s
so there is no change in flux when pressure is changed


### Example 2.18¶

In [54]:

#  variable declaration
pa1=0.418*10**5;              #partial pressure initially
pa2=0;                        #partial pressure of pure air
r=10/2;                       #radius of tank in which benzene is stored
T=(350);                      #temperature  in kelvin
pt=1*1.013*10**5;             #total pressure in pascal
z=2*10**-3;                   #gas film thickness in m
Dab=.2*10**-4;                #diffusion coefficient in m**2/s
R=8314;                       #universal gas constant
r=0.2/2;                      #radius of open bowl is 0.2
#when air layer is assumed to be stagnant of thickness 2mm
import math

# Calculation

Na=Dab*pt*math.log((pt-pa2)/(pt-pa1))/(z*R*T); #diffusion flux in kmol/m**2*s
rate=Na*(3.14*r**2)*18;  #rate of loss of evaporation

# Result
print "\n diffusion rate loss of evaporation :%f *10**-4 kg/s "%(rate/10**-4)
#end

 diffusion rate loss of evaporation :1.046972 *10**-4 kg/s


### Example 2.19¶

In [55]:

#  variable declaration

#stefan tube experiment
import math
Ml=92.;                        #molecular weight of toluene
T=(312.4);                     #temperature  in kelvin
pt=1*1.013*10**5;              #total pressure in pascal
R=8314.;                       #universal gas constant
t=275.*3600;                   #after 275 hours the level dropped to 80mm from the top
zo=20.*10**-3;                 #intially liquid toluene is at 20mm from top
zt=80.*10**-3;                 #finally liquid toluene is at 80mm from top
#air is assumed to be satgnant
d=850.;                     #density in kg/m**3
pa=7.64*10**3;              #vapour pressure of toluene in at 39.4degree celcius

# Calculation
cal=d/Ml;                  #conc. at length at disxtance l
ca=pt/(R*T);               #total conc.
xa1=pa/pt;                 #mole fraction of toluene at pt1 i.e before evaporation
xb1=1-xa1;                 #mole fraction of air before evaporation i.e at pt1
xb2=1.;                    #mole fraction of air after evaporation i.e at pt.2
xa2=0.;                    #mole fraction of toluene at point 2
xbm=(xb2-xb1)/(math.log(xb2/xb1));
#t/(zt-zt0) = (xbm*cal*(zt+zo))/(2*c*(xa1-xa2)*t);
Dab=(xbm*cal*(zt**2-zo**2))/(2*ca*t*(xa1-xa2));

# Result
print "\n the diffusivity of the mixture in stefan tube of toluene in air is :%f*10**-5 m**2/s"%(Dab/10**-5)
#end

 the diffusivity of the mixture in stefan tube of toluene in air is :0.915437*10**-5 m**2/s


### Example 2.20¶

In [1]:

#  variable declaration

T=(360);                            #temperature  in kelvin
pt=372.4/760;                       #total pressure in atm
R=82.06;                            #universal gas constant
Dab=0.0506;                         #diffusion coefficient in cm**2/s
z=0.254;                            #gas layer thickness in cm
vp=368.0/760;                       #vapour pressure of toluene in atm
xtol=.3;                            #mole fractoin of toluene in atm
pb1=xtol*vp;                        #partial pressure of toluene
#since pb1 is .045263 bt in book it is rounded to 0.145

# Calculation
pb2=xtol*pt;                  #parial pressure of toluene in vapour phase
Na=Dab*(pb1-pb2)/(z*R*T);     #diffusion flux

# Result
print "\n the diffusion flux of a mixture of benzene and toluene %f*10**-8 gmol/cm**2*s\n"%(Na/10**-8)
print "\nthe negative sign indicates that toluene is getting transferred from gas phase \
to liquid phase(hence the transfer of benzene is from liquid to gas phase)"
#end

 the diffusion flux of a mixture of benzene and toluene -1.171233*10**-8 gmol/cm**2*s

the negative sign indicates that toluene is getting transferred from gas phase to liquid phase(hence the transfer of benzene is from liquid to gas phase)


### Example 2.21¶

In [57]:

#  variable declaration

Ml=92.;                     #molecular weight of toluene
T=(303.);                   #temperature  in kelvin
pt=1.*1.013*10**5;          #total pressure in pascal
R=8314.;                    #universal gas constant
t=275.*3600;                #after 275 hours the level dropped to 80mm from the top
zo=20.*10**-3;              #intially liquid toluene is at 20mm from top
zt=77.5*10**-3;             #finally liquid toluene is at 80mm from top
#air is assumed to be satgnant
import math
# Calculation
d=820.;                         #density in kg/m**3
pa=(57.0/760)*1.0135*10**5;     #vapour pressure of toluene in at 39.4degree celcius
cal=d/Ml;                       #conc. at length at disxtance l
ca=pt/(R*T);                    #total conc.
xa1=pa/pt;                      #mole fraction of toluene at pt1 i.e before evaporation
xb1=1.-xa1;                     #mole fraction of air before evaporation i.e at pt1
xb2=1.;                         #mole fraction of air after evaporation i.e at pt.2
xa2=0;                          #mole fraction of toluene at point 2
xbm=(xb2-xb1)/(math.log(xb2/xb1));
#t/(zt-zt0) = (xbm*cal*(zt+zo))/(2*c*(xa1-xa2)*t);
Dab=(xbm*cal*(zt**2-zo**2))/(2*ca*t*(xa1-xa2));

# Result
print "\n the diffusivity of the mixture in stefan tube of toluene in air is :%f*10**-5 m**2/s"%(Dab/10**-5)
#end

 the diffusivity of the mixture in stefan tube of toluene in air is :0.804587*10**-5 m**2/s


### Example 2.22¶

In [2]:

#variation in liquid level with respect to time is given below
%matplotlib inline
t=[26,185,456,1336,1958,2810,3829,4822,6385]
# let Zt-Zo= x;
x=[.25,1.29,2.32,4.39,5.47,6.70,7.38,9.03,10.48]
i=0;
y = [0,0,0,0,0,0,0,0,0]            #looping starts

# Calculation
while(i<9):
y[i]=t[i]/x[i];                #for calculating the t/Zt-Zo value
i=i+1;
from matplotlib.pyplot import *
plot(x,y,"o-");
show()
#xtitle(" Fig.2.2 Example 22 ","X--(zi-zo),cm  --->","Y-- vs (t/(zi-zo))min/cm ---->");
slope=51.4385*60 *10**4;             #slope of the curve in 1/sec*m**2
#slope = Cal *(xblm)/(2*Dab*C*(xa1-xa2))
d=1540.;                       #density in kg/m**3
Ml=154.;                       #molecular weight of toluene
Cal=d/Ml ;                     #conc. at length at disxtance l in mol/m**3

T=(321.);                      #temperature  in kelvin
pt=1.;                         #total pressure in atm
R=82.06;                       #universal gas constant
C=pt/(R*T) *10**3;             #total conc. in kg mol/m**3

pa=(282./760);             #vapour pressure of toluene
xa1=pa/pt;                 #mole fraction of toluene at pt1 i.e before evaporation
xb1=1.-xa1;                #mole fraction of air before evaporation i.e at pt1
xb2=1.;                    #mole fraction of air after evaporation i.e at pt.2
xa2=0.;                    #mole fraction of toluene at point 2
xblm=(xb2-xb1)/(math.log(xb2/xb1));         #log mean temp. difference
Dab = Cal *(xblm)/(2*slope*C*(xa1-xa2));    #diffusivity coefficient

# Result
print "\n the diffusivity of the mixture by winklemann method  of toluene in air is :%f*10**-6 m**2/s"%(Dab/10**-6)
#end

Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].

 the diffusivity of the mixture by winklemann method  of toluene in air is :9.202857*10**-6 m**2/s


### Example 2.23¶

In [59]:
d=0.001;
area=3.14*(d/2)**2;     #area of the bulb
T=298.;                  #temperature in kelvin
p=1.013*10**5;          #total pressure of both the bulbs
R=8314.;               #universal gas constant

# Calculation
c=p/(R*T);            #total concentration
Dab=.784*10**-4;      #diffusion coefficient in m**2/s
xa1=0.8;             #molefraction of nitrogen gas at the 1 end
xa2=0.25;            #molefraction of nitrogen gas at the 2nd end
z=.15;               #distance between the bulbs

#rate=area*Na;
rate=area*Dab*c*(xa1-xa2)/z;    #rate of transfer of hydrogen and hydrogen

# Result
print "\n the rate of transfer from 1 to 2 of  nitrogen and 2 to 1of hydrogen is :%f *10**-11kmol/s"%(rate/10.0**-11)
#end

 the rate of transfer from 1 to 2 of  nitrogen and 2 to 1of hydrogen is :0.922657 *10**-11kmol/s


### Example 2.24¶

In [60]:


T=288;                          #temperature in kelvin
Mb=32;                          #molecular weight of methanol
phi=1.9;                        #association factor for solvent

# Calculation
va=(14.8+(4*24.6))*10**-3        #solute(CCl4) volume at normal BP in m**3/kmol
u=.6*10**-3;                     #viscosity of solution in kg/m*s
Dab=(117.3*10**-18)*(phi*Mb)**0.5*T/(u*va**0.6);    #diffusion coefficient in m**2/s

# Result
print "\ndiffusivity of methanol in carbon tetrachloride is :%f*10**-9 m**2/s"%(Dab/10.0**-9)
#end

diffusivity of methanol in carbon tetrachloride is :1.622494*10**-9 m**2/s


### Example 2.25¶

In [28]:

T=288.0;                          #temperature in kelvin
Mb=18.0;                          #molecular weight of methanol
phi=2.26;                        #association factor for solvent

# Calculation
va=(2*14.8+(6*3.7)+7.4)*10**-3    #solute(water) volume at normal BP in m**3/kmol
u=1*10**-3;                     #viscosity of solution in kg/m*s
Dab=(117.3*10**-18)*(phi*Mb)**0.5*T/(u*va**0.6);    #diffusion coefficient in m**2/s

# Result
print "\ndiffusivity of methanol in water is :%f*10**-9 m**2/s"%(Dab/10**-9)
#end

diffusivity of methanol in water is :1.174865*10**-9 m**2/s


### Example 2.26¶

In [61]:

u=20.*10**-6;                        #viscosity in Ns/m**2
pt=2666.;                          #total pressure in N/m**2
pa1=pt;                            #pressure at 1
pa2=0;                             #pressure at 2
mw=32.;                            #molecular weight of oxygen
R=8314.;                           #universal law constant
T=373.;                            #temp. in kelvin
gc=1.;

# Calculation
l=(3.2*u/pt)*((R*T)/(2*3.14*gc*mw))**0.5;#mean free path
d=.2*10**-6;                        #pore diameter
s=d/l;                             #value of dia/l
#hence knudsen diffusion occurs
Na=0.093*20*273/(760*373*22414*10**-1);         #diffusion coefficient in kmol/m**2*s
Dka=(d/3)*((8*gc*R*T)/(3.14*mw))**0.5;
l1=Dka*(pa1-pa2)/(R*T*Na);                #length of the plate

# Result
print "\n the length of the plate is :%f m "%l1

#for diffusion with hydrogen
u=8.5*10**-6;                        #viscosity in Ns/m**2
pt=1333;                          #total pressure in N/m**2
pa1=pt;                            #pressure at 1
pa2=0;                             #pressure at 2
mw=2;                            #molecular weight of oxygen
R=8314;                           #universal law constant
T=298;                            #temp. in kelvin
gc=1;
l=(3.2*u/pt)*((R*T)/(2*3.14*gc*mw))**0.5;#mean free path
d=.2*10**-6;                        #pore diameter
s=d/l;                             #value of dia/l
#hence knudsen diffusion occurs
Dka=(d/3)*((8*gc*R*T)/(3.14*mw))**0.5;
Na=Dka*(pa1-pa2)/(R*T*l1);                #diffusion coefficient in kmol/m**2*s
print "\n the diffusion coefficient is :%f *10**-4 kmol/m**2*s"%(Na/10.0**-6)
#end

 the length of the plate is :0.035635 m

the diffusion coefficient is :1.788175 *10**-4 kmol/m**2*s