In [1]:

```
#Variable declaration
T = 300 # [K]
P = 500 # [kPa]
R = 8.314 # [J/mole.K]
# Solution (a)
# Using equation 1.7
C = P/(R*T) # [Total molar concentration, kmole/cubic m]
print"Total molar concentration in the gas feed is",round(C,1),"kmole/cubic m\n\n"
#Illustration 1.1 (b)
# Solution (b)
# Mixture of gases
# Components a-CH4 , b-C2H6 , c-nC3H8 , d-nC4H10
# Basis: 100 kmole of gas mixture
n_a = 88 # [kmole]
n_b = 4 # [kmole]
n_c = 5 # [kmole]
n_d = 3 # [kmole]
M_a = 16.04 # [gram/mole]
M_b = 30.07 # [gram/mole]
M_c = 44.09 # [gram/mole]
M_d = 58.12 # [gram/mole]
m_a = n_a*M_a # [kg]
m_b = n_b*M_b # [kg]
m_c = n_c*M_c # [kg]
m_d = n_d*M_d # [kg]
n_total = n_a+n_b+n_c+n_d # [kmole]
m_total = m_a+m_b+m_c+m_d # [kg]
M_avg = m_total/n_total # [kg/kmole]
row = C*M_avg # [mass density, kg/cubic m]
print"Average molecular weight of gas feed is ",round(M_avg,2),"kg/kmole\n"
print"Density of gas feed is ",round(row,2),"kg/cubic m\n\n"
#Illustration 1.1 (c)
# Mass fraction of each component
x_a = m_a/m_total
x_b = m_b/m_total
x_c = m_c/m_total
x_d = m_d/m_total
print"Mass fraction of CH4, C2H6, nC3H8, nC4H10 are",round(x_a,3),round(x_b,3),round(x_c,3),round(x_d,3),"respectively"
```

In [2]:

```
#Variable declaration
# Component a-KNO3 b-H20
T = 293.0 # [K]
s_eqm = 24.0 # [percent by weight, %]
row = 1162.0 # [density of saturated solution, kg/cubic m]
#Illustration 1.2 (a)
# Solution (a)
# Basis: 100 kg of fresh wash solution
m_a = (s_eqm/100)*100 # [kg]
m_b = 100 - m_a # [kg]
M_a = 101.10 # [gram/mole]
M_b = 18.02 # [gram.mole]
# Therefore moles of component 'a' and 'b' are
n_a = m_a/M_a # [kmole]
n_b = m_b/M_b # [kmole]
m_total = 100 # [basis, kg]
n_total = n_a+n_b # [kmole]
# Average molecular weight
M_avg = m_total/n_total # [kg/kmole]
# Total molar density of fresh solution
C = row/M_avg # [kmole/cubic m]
print"Total molar density of fresh solution is",round(C,2),"kmole/cubic m\n\n"
#Illustration 1.2 (b)
# Solution (b)
# mole fractions of components 'a' and 'b'
x_a = n_a/n_total
x_b = n_b/n_total
print"Mole fraction of KNO3 and H2O is",round(x_a,3),round(x_b,3)
```

In [3]:

```
#Variable declaration
f_a = 45.0 # [percent of blood cells by volume]
f_b = 55.0 # [percent of plasma by volume]
r = 1200.0 # [Rate of blood which is pumped through artificial kidney, mL/minute]
m_urine = 1540.0 # [mass of urine collected, g]
x_u = 1.3 # [urea concentration, percent by weight]
# Data for sample of blood plasma
c_urea = 155.3 # [mg/dL]
d = 1.0245 # [specfic gravity of plasma]
#CALCULATION
#Illustration 1.3 (a)
# Solution (a)
# Basis: 4 hours
# Assuming that the rate of formation and decomposition of urea during the procedure is negligible and that no urea is removed by the patient’s kidneys
# Therefore urea in “clean” blood = urea in “dirty” blood - urea in urine
m_u = m_urine*(x_u/100) # [mass of urea in urine, g]
# total volume of plasma that flows through the artificial kidney in 4 hours
V_b = r*60*(f_b/100)*(1.0/100.0)*4 # [dL]
# urea in dirty blood from given plasma concentration
m_ud = c_urea*(1.0/1000.0)*V_b # [g]
# urea removal efficiency
n = (m_u/m_ud)*100
#RESULT
print"Urea removal efficiency is ",round(n,1),"%"
#Illustration 1.3 (b)
# Solution (b)
#CALCULATION
m_uc = m_ud-m_u # [mass of urea on clean blood, g]
m_p = d*100*V_b # [Mass of plasma entering, g]
m_rem = m_p-m_urine # [Mass of plasma remaining, g]
V_brem = m_rem/(d*100) # [Volume of plasma remaining, dL]
#RESULT
c_y = (m_uc*1000)/V_brem # [urea concentration in remaining plasma, mg/dL]
print"urea concentration in the plasma of the cleansed blood is",round(c_y),"mg/dL"
```

In [4]:

```
import math
#VARIABLE DECLARATION
T = 273 # [K]
P = 1 # [bar]
# 1 bar = 10**5 Pa
# Values of the Lennard-Jones parameters (sigma and E/K) are obtained from Appendix B:
sigma_a = 4.483 # [1st Lennard-Jones parameter, Angstrom]
sigma_b = 3.620 # [Angstrom]
d_a = 467.0 # [d = E/K 2nd Lennard-Jones parameter, K]
d_b = 97.0 # [K]
M_a = 76.0 # [gram/mole]
M_b = 29.0 # [gram/mole]
#CALCULATION
sigma_ab = (sigma_a+sigma_b)/2 # [Angstrom]
d_ab =math.sqrt(d_a*d_b) # [K]
M_ab = 2/((1/M_a)+(1/M_b)) # [gram/mole]
T_star = T/d_ab
a = 1.06036
b = 0.15610
c = 0.19300
d = 0.47635
e = 1.03587
f = 1.52996
g = 1.76474
h =3.89411
ohm = ((a/T_star**b)+(c/math.exp(d*T_star))+(e/math.exp(f*T_star))+(g/math.exp(h*T_star)))
# Substituting these values into the Wilke-Lee equation yields (equation 1.49)
D_ab = ((10**-3*(3.03-(.98/math.sqrt(M_ab)))*T**1.5)/(P*(math.sqrt(M_ab))*(sigma_ab**2)*ohm))
#RESULT
# [square cm/s]
print"The diffusivity of carbon disulfide vapor in air at 273 K and 1 bar is",round(D_ab,4),"square cm/s\n"
# The math.experimental value of D_ab obtained from Appendix A:
D_abexp = (.894/(P*10**5))*10**4 # [square cm/s]
percent_error = ((D_ab-D_abexp)/D_abexp)*100 # [%]
#RESULT
print"The percent error of the estimate, compared to the math.experimental value is",round(percent_error,1),"%"
```

In [5]:

```
import math
#VARIABLE DECLARATION
# A-C3H5Cl B-air
T = 298.0 # [K]
P = 1.0 # [bar]
# Values of the Lennard-Jones parameters for allyl chloride must be estimated from equations (1.46) and (1.47).
# From Table 1.2
V_bA = 3*14.8+5*3.7+24.6 # [cubic cm/mole]
# From equation 1.46
sigma_A = 1.18*(V_bA)**(1.0/3.0) # [1st Lennard-Jones parameter, Angstrom]
# Normal boiling-point temperature for allyl chloride is Tb = 318.3 K
# From equation 1.47, E/K = 1.15*Tb
T_b = 318.3 # [K]
d_A = 1.15*T_b # [2nd Lennard-Jones parameter for C3H5Cl E/K, K]
M_A = 76.5 # [gram/mole]
# Lennard-Jones parameters for air
sigma_B = 3.62 # [Angstrom]
d_B = 97 # [2nd Lennard-Jones parameter for air E/K, K]
M_B = 29.0 # [gram/mole]
sigma_AB = (sigma_A+sigma_B)/2 # [Angstrom]
d_AB = math.sqrt(d_A*d_B) # [K]
M_AB = 2/((1/M_A)+(1/M_B)) # [gram/mole]
T_star = T/d_AB
a = 1.06036
b = 0.15610
c = 0.19300
d = 0.47635
e = 1.03587
f = 1.52996
g = 1.76474
h =3.89411
ohm = ((a/T_star**b)+(c/math.exp(d*T_star))+(e/math.exp(f*T_star))+(g/math.exp(h*T_star)))
# Substituting these values into the Wilke-Lee equation yields (equation 1.49)
D_AB = ((10**-3*(3.03-(.98/math.sqrt(M_AB)))*T**1.5)/(P*(math.sqrt(M_AB))*(sigma_AB**2)*ohm)) # [square cm/s]
print"The diffusivity of allyl chloride in air at 298 K and 1 bar is",round(D_AB,4),"square cm/s\n"
# The experimental value of D_AB reported by Lugg (1968) is 0.098 square cm/s
D_ABexp = .098 # [square cm/s]
percent_error = ((D_AB-D_ABexp)/D_ABexp)*100 # [%]
print"The percent error of the estimate, compared to the experimental value is",round(percent_error,1),"%"
```

In [6]:

```
import math
#Variable declaration
# solute A-C2H60 solvent B-water
T = 288 # [K]
# Critical volume of solute
V_c = 167.1 # [cubic cm/mole]
# Calculating molar volume using equation 1.48
V_ba = 0.285*(V_c)**1.048 # [cubic cm/mole]
u_b = 1.153 # [Viscosity of liquid water at 288 K, cP]
M_solvent = 18 # [gram/mole]
phi_b = 2.26 # [association factor of solvent B]
#Illustration 1.8 (a)
# Solution (a)
# Using the Wilke-Chang correlation, equation 1.52
D_abo1 = (7.4*10**-8)*(math.sqrt(phi_b*M_solvent))*T/(u_b*(V_ba)**.6) # [diffusivity of solute A in very dilute solution in solvent B, square cm/s]
#RESULT
print"Diffusivity of C2H60 in a dilute solution in water at 288 K is",round(D_abo1,8),"square cm/s"
# The experimental value of D_abo reported in Appendix A is 1.0 x 10**-5 square cm/s
D_aboexp = 1*10**-5 # [square cm/s]
percent_error1 = ((D_abo1-D_aboexp)/D_aboexp)*100 # [%]
print"The percent error of the estimate, compared to the experimental value is",round(percent_error1,1),"%"
#Illustration 1.8 (b)
# Solution (b)
#CALCULATION
# Using the Hayduk and Minhas correlation for aqueous solutions equation 1.53
E = (9.58/V_ba)-1.12
D_abo2 = (1.25*10**-8)*(((V_ba)**-.19)-0.292)*(T**1.52)*(u_b**E) # [square cm/s]
#RESULT
print"\n\nDiffusivity of C2H60 in a dilute solution in water at 288 K is",round(D_abo2,8),"square cm/s\n"
percent_error2 = ((D_abo2-D_aboexp)/D_aboexp)*100 # [%]
print"The percent error of the estimate, compared to the experimental value is",round(percent_error2,1),"%"
```

In [7]:

```
import math
#Variable declaration
# A-acetic acid(solute) B-acetone(solvent)
T = 313 # [K]
# The following data are available (Reid, et al., 1987):
# Data for acetic acid
T_bA = 390.4 # [K]
T_cA = 594.8 # [K]
P_cA = 57.9 # [bar]
V_cA = 171 # [cubic cm/mole]
M_A = 60 # [gram/mole]
# Data for acetone
T_bB = 329.2 # [K]
T_cB = 508 # [K]
P_cB = 47 # [bar]
V_cB = 209 # [cubic cm/mole]
u_bB = 0.264 # [cP]
M_B = 58 # [gram/mole]
phi = 1
#CALCULATION
#Illustration 1.9 (a) -
# Solution (a)
# Using equation 1.48
V_bA = 0.285*(V_cA)**1.048 # [cubic cm/mole]
# Using the Wilke-Chang correlation , equation 1.52
D_abo1 = (7.4*10**-8)*(math.sqrt(phi*M_B))*T/(u_bB*(V_bA)**.6)
#RESULT
print"Diffusivity of acetic acid in a dilute solution in acetone at 313 K using the Wilke-Chang correlation is",round(D_abo1,8),"square cm/s\n"
# From Appendix A, the experimental value is 4.04*10**-5 square cm/s
D_aboexp = 4.04*10**-5 # [square cm/s]
percent_error1 = ((D_abo1-D_aboexp)/D_aboexp)*100 # [%]
print"The percent error of the estimate, compared to the experimental value is ",round(percent_error1,1),"%"
#Illustration 1.9 (b)
# Solution (b)
#CALCULATION
# Using the Hayduk and Minhas correlation for nonaqueous solutions
V_bA = V_bA*2 # [cubic cm/mole]
V_bB = 0.285*(V_cB)**1.048 # [cubic cm/mole]
# For acetic acid (A)
T_brA = T_bA/T_cA # [K]
# Using equation 1.55
alpha_cA = 0.9076*(1+((T_brA)*math.log(P_cA/1.013))/(1-T_brA))
sigma_cA = (P_cA**(2.0/3.0))*(T_cA**(1.0/3.0))*(0.132*alpha_cA-0.278)*(1-T_brA)**(11.0/9.0) # [dyn/cm]
# For acetone (B)
T_brB = T_bB/T_cB # [K]
# Using equation 1.55
alpha_cB = 0.9076*(1+((T_brB*math.log(P_cB/1.013))/(1-T_brB)))
sigma_cB = (P_cB**(2.0/3.0))*(T_cB**(1.0/3.0))*(0.132*alpha_cB-0.278)*(1-T_brB)**(11.0/9.) # [dyn/cm]
# Substituting in equation 1.54
D_abo2 = (1.55*10**-8)*(V_bB**0.27)*(T**1.29)*(sigma_cB**0.125)/((V_bA**0.42)*(u_bB**0.92)*(sigma_cA**0.105))
#RESULT
print"Diffusivity of acetic acid in a dilute solution in acetone at 313 K using the Hayduk and Minhas correlation is",round(D_abo2,7),"square cm/s\n"
percent_error2 = ((D_abo2-D_aboexp)/D_aboexp)*100 # [%]
print"The percent error of the estimate, compared to the experimental value is",round(percent_error2),"%"
```

In [8]:

```
#Variable declaration
# acetone-1 benzene-2
T = 298 # [K]
x_1 = 0.7808
x_2 = 1-x_1
#CALCULATIONS
# The infinite dilution diffusivities are
D_12o = 2.75*10**-9 # [square m/s]
D_21o = 4.15*10**-9 # [square m/s]
# From the NRTL equation, for this system at the given temperature and concentration the thermodynamic correction factor r = 0.871.
r = 0.871
D_12exp = 3.35*10**-9 # [square m/s]
# Using equation 1.56
D_12 = (D_12o**x_2)*(D_21o**x_1)
D_12 = D_12*r
#RESULT
print"The theoritical value of Fick diffusivity is",round(D_12,11),"square m/s"
# The predicted value of the Fick diffusivity is in excellent agreement with the experimental result.
```

In [9]:

```
#Variable declaration
# ammonia-1 nitrogen-2 hydrogen-3
T = 300 # [K]
P = 1 # [bar]
y_1 = .40
y_2 = .20
y_3 = .40
import math
# Lennard-Jones parameter for ammonia
sigma_1 = 2.9 # [Angstrom]
d_1 = 558.3 # [E/K, K]
M_1 = 17.0 # [gram/mole]
# Lennard-Jones parameter for nitrogen
sigma_2 = 3.798 # [Angstrom]
d_2 = 71.4 # [E/K, K]
M_2 = 28.0 # [gram/mole]
# Lennard-Jones parameter for hydrogen
sigma_3 = 2.827 # [Angstrom]
d_3 = 59.7 # [E/K, K]
M_3 = 2.0 # [gram/mole]
# Binary diffusivitiy of ammonia in nitrogen (D_12)
#CALCULATIONS
sigma_12 = (sigma_1+sigma_2)/2 # [Angstrom]
d_12 = math.sqrt(d_1*d_2) # [K]
M_12 = 2/((1/M_1)+(1/M_2)) # [gram/mole]
T_star12 = T/d_12
a = 1.06036
b = 0.15610
c = 0.19300
d = 0.47635
e = 1.03587
f = 1.52996
g = 1.76474
h = 3.89411
ohm12 = ((a/T_star12**b)+(c/math.exp(d*T_star12))+(e/math.exp(f*T_star12))+(g/math.exp(h*T_star12)))
# Substituting these values into the Wilke-Lee equation yields (equation 1.49)
D_12 = ((10**-3*(3.03-(.98/math.sqrt(M_12)))*T**1.5)/(P*(math.sqrt(M_12))*(sigma_12**2)*ohm12)) # [square cm/s]
print"The diffusivitiy of ammonia in nitrogen",round(D_12,3),"square cm/s"
# Binary diffusivitiy of ammonia in hydrogen (D_13)
sigma_13 = (sigma_1+sigma_3)/2 # [Angstrom]
d_13 = math.sqrt(d_1*d_3) # [K]
M_13 = 2/((1/M_1)+(1/M_3)) # [gram/mole]
T_star13 = T/d_13
a = 1.06036
b = 0.15610
c = 0.19300
d = 0.47635
e = 1.03587
f = 1.52996
g = 1.76474
h = 3.89411
ohm13 = ((a/T_star13**b)+(c/math.exp(d*T_star13))+(e/math.exp(f*T_star13))+(g/math.exp(h*T_star13)))
# Substituting these values into the Wilke-Lee equation yields (equation 1.49)
D_13 = ((10**-3*(3.03-(.98/math.sqrt(M_13)))*T**1.5)/(P*(math.sqrt(M_13))*(sigma_13**2)*ohm13)) # [square cm/s]
#RESULT
print"The diffusivitiy of ammonia in hydrogen",round(D_13,3),"square cm/s\n"
# Figure 1.5 shows the flux of ammonia (N_1) toward the catalyst surface, where
# it is consumed by chemical reaction, and the fluxes of nitrogen (N_2) and hydrogen (N_3)
# produced by the reaction migrating away from the same surface.
# Therefore N_1 = N_2+N_3
# From equation 1.59
# N_2 = -(0.5)*N_1 and N_3 = -(1.5)*N_1
# Substituting in equation (1.58) we obtain
D_1eff = (1+y_1)/((y_2+0.5*y_1)/D_12 + (y_3+1.5*y_1)/D_13) # [square cm/s]
#RESULT
print"The effective diffusivity of ammonia in the gaseous mixture is",round(D_1eff,3),"square cm/s"
```

In [10]:

```
#Variable declaration
# ammonia-1 nitrogen-2 hydrogen-3
T = 300 # [K]
P = 1 # [bar]
y_1 = 0.40
y_2 = 0.20
y_3 = 0.40
#CALCULATIONS
# The binary diffusivities are the same as for Example 1.11.
D_12 = 0.237 # [square cm/s]
D_13 = 0.728 # [square cm/s]
# mole fractions of nitrogen (2) and hydrogen (3) on an ammonia (1)-free base from equation (1.61)
y_21 = y_2/(1-y_1)
y_31 = y_3/(1-y_1)
# Substituting in equation (1.60) gives us
D_1eff = 1/((y_21/D_12)+(y_31/D_13))
print"The effective diffusivity of ammonia in the gaseous mixture is",round(D_1eff,3),"square cm/s"
```

In [11]:

```
#VARIABLE DECLARATION
# acetic acid-1 water-2 ethyl alcohol-3
T = 298 # [K]
# The data required data for water at 298 K
u_2 = 0.894 # [cP]
V_c1 = 171 # [cubic cm/mole]
# From equation 1.48
V_b1 = 62.4 # [cubic cm/mole]
# Substituting in equation (1.53)
# the infinite dilution diffusion coefficient of acetic acid in water at 298 K
E = (9.58/V_b1)-1.12
D_abo12 = (1.25*10**-8)*(((V_b1)**-.19)-0.292)*(T**1.52)*(u_2**E) # [square cm/s]
import math
# Data for acetic acid
T_b1 = 390.4 # [K]
T_c1 = 594.8 # [K]
P_c1 = 57.9 # [bar]
V_c1 = 171 # [cubic cm/mole]
M_1 = 60.0 # [gram/mole]
# Data for ethanol
T_b3 = 351.4 # [K]
T_c3 = 513.9 # [K]
P_c3 = 61.4 # [bar]
V_c3 = 167 # [cubic cm/mole]
M_3 = 46.0 # [gram/mole]
u_3 = 1.043 # [cP]
#CALCULATION
# Using the Hayduk and Minhas correlation for nonaqueous solutions
# According to restriction 3 mentioned above, the molar volume of the acetic acid to be used in equation (1.54) should be
V_b1 = V_b1*2 # [cubic cm/mole]
# The molar volume of ethanol is calculated from equation (1.48)
V_b3 = 60.9 # [cubic cm/mole]
# For acetic acid (1)
T_br1 = T_b1/T_c1 # [K]
# Using equation 1.55
alpha_c1 = 0.9076*(1+((T_br1)*math.log(P_c1/1.013))/(1-T_br1))
sigma_c1 = (P_c1**(2.0/3.0))*(T_c1**(1.0/3.0))*(0.132*alpha_c1-0.278)*(1-T_br1)**(11.0/9.0) # [dyn/cm]
# For ethanol (3)
T_br3 = T_b3/T_c3 # [K]
# Using equation 1.55
alpha_c3 = 0.9076*(1+((T_br3*math.log(P_c3/1.013))/(1-T_br3)))
sigma_c3 = (P_c3**(2.0/3.0))*(T_c3**(1.0/3.0))*(0.132*alpha_c3-0.278)*(1-T_br3)**(11.0/9.0) # [dyn/cm]
# Substituting in equation 1.54
D_abo13 = (1.55*10**-8)*(V_b3**0.27)*(T**1.29)*(sigma_c3**0.125)/((V_b1**0.42)*(u_3**0.92)*(sigma_c1**0.105))
# The viscosity of a 40 wt% aqueous ethanol solution at 298 K is u_mix = 2.35 cP
u_mix = 2.35 # [cP]
# The solution composition must be changed from mass to molar fractions following a procedure similar to that illustrated in Example 1.2
# Accordingly, a 40 wt% aqueous ethanol solution converts to 20.7 mol%.
# Therefore mole fraction of ethanol (x_3) and water (x_2)
x_3 = 0.207
x_2 = 1-x_3
# Using equation 1.62
D_1eff = ((x_2*D_abo12*(u_2**0.8))+(x_3*D_abo13*(u_3**0.8)))/(u_mix**0.8)
#RESULT
print"The diffusion coefficient of acetic acid at very low concentrations diffusing into a mixed solvent containing 40.0 wt percent ethyl alcohol in water at a temperature of 298 K is",round(D_1eff,7),"cm^2/s\n\n"
# The experimental value reported by Perkins and Geankoplis (1969) is
D_1exp = 5.71*10**-6 # [square cm/s]
percent_error = ((D_1eff-D_1exp)/D_1exp)*100 # [%]
print"The error of the estimate is ",round(percent_error,1),"%"
```

In [12]:

```
#Variable declaration
# Binary gaseous mixture of components A and B
P = 1 # [bar]
T = 300 # [K]
R = 8.314 # [cubic m.Pa/mole.K]
delta = 1 # [mm]
y_A1 = 0.7
y_A2 = 0.2
D_AB = 0.1 # [square cm/s]
# Using equation 1.72
#CALCULATION
N_A = (D_AB*10**-4)*(P*10**5)*(y_A1-y_A2)/(R*T*delta*10**-3)
#RESULT
print"The molar flux of component A is",round(N_A,1),"mole/square m.s"
```

In [13]:

```
#Variable declaration
# Diffusion of A through stagnant B
P_total = 1.0 # [bar]
P_B1 = 0.8 # [bar]
P_B2 = 0.3 # [bar]
import math
#Calculation
# Using equation 1.83
P_BM = (P_B2-P_B1)/(math.log(P_B2/P_B1)) # [bar]
# using the result of Example 1.14, we have
N_A = 0.2 # [mole/square m.s]
N_A = N_A*P_total/P_BM # [moloe/square m.s]
#Result
print"The molar flux of component A is",round(N_A,2),"mole/square m.s"
```

In [14]:

```
import math
#Variable declaration
# Nickel Carbonyl-A carbon monoxide-B
T = 323 # [K]
P = 1 # [atm]
R = 8.314 # [cubic m.Pa/mole.K]
y_A1 = 1.0
y_A2 = 0.5
delta = 0.625 # [mm]
D_AB = 20 # [square mm/s]
#Calculations
# The stoichiometry of the reaction determines the relation between the fluxes: from equation (1-59), N_B = - 4N_A and N_A + N_B = -3NA
# Molar flux fraction si_A = N_A/(N_A+N_B) = N_A/(-3*N_A) = -1/3
si_A = -1.0/3.0
# Using equation 1.78
N_A = si_A*(D_AB*10**-6*P*10**5*math.log((si_A-y_A2)/(si_A-y_A1))/(R*T*delta*10**-3))
#Result
print"The molar flux of component A is",round(N_A,3),"mole/square m.s"
```

In [15]:

```
import math
#Variable declaration
# a-CuS04 b-H2O
T = 273 # [K]
delta = 0.01 # [mm]
sol_ab = 24.3 # [gram/100 gram water]
den_ab = 1140 # [kg/cubic m]
D_ab = 3.6*10**-10 # [square m/s]
den_b = 999.8 # [kg/cubic m]
#Calcualtions
# both fluxes are in the same direction therefore, they are both positive and relation is N_b = 5N_a (where N_b and N_a are molar fluxes of component 'a' and 'b')
# From equation (1.76), si_a = 1/6 = 0.167
si_a = 0.167
# Calculation of mole fraction of component 'a'
# Basis: 100 gram H2O (b)
M_a = 159.63 # [gram/mole]
M_b = 18 # [gram/mole]
M_c =249.71 # [here M_c is molecular mass of hydrated CuSO4, gram/mole]
m_a = 24.3 # [gram]
m_c = m_a*(M_a/M_c) # [here m_c is the mass of CuSO4 in 24.3 gram of crystal, gram]
m_d = m_a-m_c # [here m_d is mass of hydration of water in the crystal, gram]
m_b_total = 100+m_d # [total mass of water, gram]
x_a1 = (m_c/M_a)/((m_c/M_a)+(m_b_total/M_b))
x_a2 = 0
# At point 1, the average molecular weight is
M_1 = x_a1*M_a+(1-x_a1)*M_b # [gram/mole]
# At point 2, the average molecular weight is
M_2 = x_a2*M_a+(1-x_a2)*M_b
# Molar density at point 1 and 2
row_1 = den_ab/M_1 # [kmole/cubic m]
row_2 = den_b/M_2
row_avg = (row_1+row_2)/2 # [kmole/cubic m]
# Using equation 1.96
N_a = si_a*D_ab*row_avg*math.log((si_a-x_a2)/(si_a-x_a1))/(delta*10**-3) # [kmole/square m.s]
rate = N_a*M_c*3600 # [kg/square m of crystal surface area per hour]
#Result
print"the rate at which the crystal dissolves in solution is",round(rate),"kg/square m of crystal surface area per hour"
```

In [16]:

```
#Variable declaration
# A-hydrogen B-ethane
T = 373 # [K]
P = 10 # [atm]
d = 4000 # [Angstrom]
e = 0.4 # [porosity]
t = 2.5 # [tortuosity]
D_AB = 0.86/P # [square cm/s]
k = 1.3806*10**-23 # [J/K]
import math
#Calculation
# Using data from Appendix B for hydrogen and ethane, and equation (1.45)
sigma_A = 2.827 # [Angstrom]
sigma_B = 4.443 # [Angstrom]
sigma_AB = ((sigma_A+sigma_B)/2)*10**-10 # [m]
lamda=k*T/(math.sqrt(2)*3.14*(sigma_AB**2)*P*1.01325*10**5) # [m]
lamda=lamda*10**10 # [Angstrom]
# From equation 1.101
K_n = lamda/d
#Result
print"The value of a dimensionless ratio, Knudsen number is ",round(K_n,3)
# If K_n is less than 0.05 then diffusion inside the pores occurs only by ordinary molecular diffusion and equation 1.100 can be used to calculate D_ABeff
D_ABeff = D_AB*e/t
print"The effective diffusivity of hydrogen in ethane is",round(D_ABeff,3),"square cm /s"
```

In [17]:

```
#Variable declaration
# a-oxygen b-nitrogen
T = 293 # [K]
P = 0.1 # [atm]
d = 0.1*10**-6 # [m]
e = 0.305 # [porosity]
t = 4.39 # [tortuosity]
k = 1.3806*10**-23 # [J/K]
l = 2*10**-3 # [m]
R = 8.314 # [cubic m.Pa/mole.K]
x_a1 = 0.8
x_a2 = 0.2
M_a = 32.0 # [gram/mole]
M_b = 28.0 # [gram/mole]
#Calculation
import math
# Using data from Appendix B for oxygen and nitrogen, and equation (1.45)
sigma_a = 3.467 # [Angstrom]
sigma_b = 3.798 # [Angstrom]
sigma_AB = ((sigma_a+sigma_b)/2)*10**-10 # [m]
lamda = k*T/(math.sqrt(2)*3.14*(sigma_AB**2)*P*1.01325*10**5) # [m]
# From equation 1.101
K_n = lamda/d
#Result
print"The value of a dimensionless ratio, Knudsen number is ",round(K_n,3)
# If K_n is greater than 0.05 then transport inside the pores is mainly by Knudsen diffusion
# Using equation 1.103
#Calculation
D_Ka = (d/3)*(math.sqrt(8*R*T)/math.sqrt(3.14*M_a*10**-3)) # [square m/s]
# Using equation 1.107
D_Kaeff = D_Ka*e/t # [square m/s]
p_a1 = (x_a1*P)*1.01325*10**5 # [Pa]
p_a2 = (x_a2*P)*1.01325*10**5 # [Pa]
# Using equation 1.108
N_a = D_Kaeff*(p_a1-p_a2)/(R*T*l) # [mole/square m.s]
# Now using the Graham’s law of effusion for Knudsen diffusion
# N_b/N_a = -math.sqrt(M_a/M_b) ,therefore
N_b = -N_a*math.sqrt(M_a/M_b) # [mole/square m.s]
#Result
print"The diffusion fluxes of both components oxygen and nitrogen are ",round(N_a,5),"mole/square m.s and",round(N_b,5),"mole/square m.s respectively\n"
```

In [18]:

```
#Variable declaration
# a-oxygen b-nitrogen
T = 293 # [K]
P = 0.1 # [atm]
d = 0.3*10**-6 # [m]
e = 0.305 # [porosity]
t = 4.39 # [tortuosity]
k = 1.3806*10**-23 # [J/K]
R = 8.314 # [cubic m.Pa/mole.K]
l = 2*10**-3 # [m]
D_ab = 2.01*10**-4 # [square m/s]
y_a1 = 0.8
y_a2 = 0.2
#Calculations
import math
# Using data from Appendix B for oxygen and nitrogen, and equation (1.45)
sigma_a = 3.467 # [Angstrom]
sigma_b = 3.798 # [Angstrom]
sigma_AB = ((sigma_a+sigma_b)/2)*10**-10 # [m]
lamda = k*T/(math.sqrt(2)*3.14*(sigma_AB**2)*P*1.01325*10**5) # [m]
# From equation 1.101
K_n = lamda/d
print"The value of a dimensionless ratio,Knudsen number is ",round(K_n,2)
# It means that both molecular and Knudsen diffusion are important and equation (1.109) must be used to calculate N_a
# From example 1.21 N_b/N_a = -1.069
# Therefore si_a = 1/(1+(N_b/N_a))
si_a = 1/(1+(-1.069))
# From equation 1.100
D_abeff = D_ab*e/t # [square m/s]
# From equation 1.103
D_Ka = 0.440*10**-4 # [square m/s]
# Using equation 1.107
D_Kaeff = D_Ka*e/t # [square m/s]
Y_a = 1+(D_abeff/D_Kaeff)
# Using equation 1.109 to calculate N_a
N_a = (si_a*P*1.01325*10**5*D_abeff*math.log((si_a*Y_a-y_a2)/(si_a*Y_a-y_a1)))/(R*T*l)
N_b = -1.069*N_a
#RESULTS
print"The diffusion fluxes of both components oxygen and nitrogen are",round(N_a,5),"mole/square m.s and",round(N_b,5),"mole/square m.s respectively"
```

In [19]:

```
#Variable declaration
# A-beta dextrin B-water
T = 293 # [K]
d = 88.8 # [Average pore diameter, Angstrom]
d_mol = 17.96 # [Molecular diameter, Angstrom]
e = 0.0233 # [porosity]
t = 1.1 # [tortuosity]
D_AB = 3.22*10**-6 # [square cm/s]
#Calculation
# Using equation 1.111 to calculate restrictive factor
K_r = (1-(d_mol/d))**4
# Using equation 1.110 to calculate effective diffusivity
D_ABeff = e*D_AB*K_r/t # [square cm/s]
#Result
print"The effective diffusivity of beta-dextrin at 298 K is",round(D_ABeff,10),"square cm/s"
```

In [20]:

```
#Variable declaration
# a-nitrogen
P_atm = 1.01325*10**5 # [Pa]
T = 300 # [K]
P_2 = 10130 # [Pa]
P_1 = 500+P_2 # [Pa]
d = 0.01*10**-2 # [average pore diameter, m]
u = 180 # [micro Poise]
u = 180*10**-6*10**-1 # [Pa.s]
l = 25.4*10**-3 # [m]
v = 0.05 # [volumetric flow rate, cubic m/square m.s]
R = 8.314 # [cubic m.Pa/mole.K]
#Calculations
# Solution (a)
P_avg = (P_1+P_2)/2 # [Pa]
# The mean free path for nitrogen is from equation (1.102)
lamda = 0.622*10**-6 # [m]
K_n = lamda/d
# Therefore, Knudsen diffusion will not occur and all the flow observed is of a hydrodynamic nature.
# From the ideal gas law, the nitrogen flux corresponding to the volumetric flow rate of 0.05 m3/m2-s at 300 K and 1 atm
N_a = P_atm*v/(R*T) # [mole/square m.s]
# Using equation 1.113
B_o = u*R*T*N_a*l/(P_avg*(P_1-P_2)) # [square m]
#RESULT
print"The value of the viscous flow parameter is",round(B_o,13),"square m\n\n"
#Illustration 1.24 (b) - Page:64
# Solution (b)
#Calculation
T1 = 393 # [K]
u = 220 # [micro Poise]
u = 220*10**-6*10**-1 # [Pa.s]
# Substituting in equation (1.113) the new values of temperature and viscosity and the value of B_o, obtained in part (a) while maintaining the pressure conditi# ons unchanged, we get N_a
N_a1 = B_o*P_avg*(P_1-P_2)/(l*T*u*R) # [mole/square m.s]
v1 = N_a1*R*T/P_atm # [cubic m(measured at 300 K and 1 atm)/ square m.s]
#Result
print"The nitrogen flow to be expected at 393 K with the same pressure difference is ",round(v1,3),"cubic m/sqm.s (measured at 300 K and 1 atm)"
```