In [27]:

```
from __future__ import division
#Overall liquid transfer coefficient KLa = 0.003 kmol/s.m**3(kmol/m**3)
#(1/KLa)=(1/kLa)+(1/HkGa)
# let (KLa)=x
x = 0.003#
overall = 1/x#
#For the absorption of a moderately soluble gas it is reasonable to assume that the liquid and gas phase resistances are of the same order ofmagnitude, assuming them to be equal.
#(1/KLa)=(1/kLa)+(1/HkGa)
#let 1/kLa = 1/HkGa = y
y = (1/(2*x))#
z = (1/y)# #z is in kmol/s m**3(kmol/m**3)
print "\n For S02:"
print "\n kGa = %0.5f ol/s m**3(kN/m**2)"%(z/50)#
print "\n For NH3:"
d_SO2 = 0.103# #diffusivity at 273K for SO2 in cm**2/sec
d_NH3 = 0.170# #diffusivity at 273K for NH3 in cm**2/sec
print "\n kGa = %0.5f kmol/s m**3(kN/m**2)"%((z/50)*(d_NH3/d_SO2)**0.56)#
print "\n For a very soluble gas such as NH3, kGa = KGa."
print "\n For NH3 the liquid-film resistance will be small, and:"
print "\n kGa =KGa = %0.5f mol/s m**3(kN/m**2)"%((z/50)*(d_NH3/d_SO2)**0.56)
```

In [28]:

```
G = 2# #air flow rate in kg/m**2.sec
Re = 5160# #Re stands for Reynolds number
f = 0.02# #friction factor = R/pu**2
d_SO2 = 0.116*10**(-4)# #diffusion coefficient in m**2/sec
v = 1.8*10**(-5)# #viscosity in mNs/m**2
p = 1.154# #density is in kg/m**3
#(hd/u)(Pm/P)(u/p/d_SO2)**0.56 = BRe**(-0.17)=jd
def a1():
x = (v/(p*d_SO2))**(0.56)#
return x
#jd = f =R/pu**2
def a2():
y = f/a1()#
return y
#G = pu
u = (G/p)# #u is in m/sec
def a3():
x1 = a2()*u#
return x1
def d1():
d = Re*v/(G)#
return d
print "\n d = %0.2f mm"%(d1())#
R = 8314# #R is in m**3(N/m**2)/K kmol
T = 298# #T is in Kelvins
def kG1():
kG = a3()/(R*T)#
return kG
print "\n kG = %.2f*10**(-8) kmol/m**2sec(N/m**2)"%(kG1()*10**(8))#
print "\n kG = %.2f*10**(-4)kg SO2/m**2sec(kN/m**2)"%(kG1()*10**(7)*64)#
```

In [32]:

```
from sympy import symbols, solve, log
#as the system are dilute mole fractions are approximately equal to mole ratios.
#At the bottom of the tower
y1 =0.015# #mole fraction
G = 1# #Gas flow rate is in kg/m**2sec
#At the top of the tower
y2 = 0.00015# #mole fraction
x2 = 0#
L = 1.6# #liquid flow rate is in kg/m**2.sec
Lm = 1.6/18# #liquid flow rate is in kmol/m**2.sec
Gm = 1.0/29# #gas flow rate is in kmol/m**2.sec
x1 = symbols('x1')
x11 = solve(Gm*(y1-y2)-Lm*(x1),x1)[0]
print "\n x1 = %0.2f"%(x11)#
def henry_law(x):
ye1 = 1.75*x#
return ye1
bottom_driving_force = y1 - henry_law(x11)#
def log_mean():
lm = (bottom_driving_force-y2)/log(bottom_driving_force/y2)
return lm
NoG = (y1-y2)/log_mean()
NoL = NoG*1.75*(Gm/Lm)#
print "\n NoL =%.2f"%(NoL)#
```

In [33]:

```
from sympy import symbols, solve
from math import ceil
Gm = 0.015#
KGa = 0.04#
top = 0.0003#
Y1 = 0.03#
Ye = 0.026#
bottom = (Y1-Ye)#
log_mean_driving_force = (bottom-top)/log(bottom/top)#
Z = symbols('Z')
Z1 = solve(Gm*(Y1-top)-KGa*log_mean_driving_force*Z,Z)[0]
print "\n Z =%.2fm"%(Z1)#
HoG = Gm/KGa#
print "\n Height of transfer unit HoG = %.3fm"%(HoG)#
print "\n Number of transfer units NoG = %0.2f"%(ceil(7.79/0.375))#
```

In [34]:

```
%matplotlib inline
from matplotlib.pyplot import plot, show, xlabel, ylabel, title
from numpy import arange
y1 = 0.10#
Y1 = 0.10/(1-0.10)#
y2 = 0.001#
Y2 = y2#
mass_flowrate_gas = 0.95# #mass flow rate in kg/m**2.sec
mass_percent_air = (0.9*29/(0.1*17+0.9*29))*100#
mass_flowrate_air = (mass_percent_air*mass_flowrate_gas)##in kg/m**2.sec
Gm = (mass_flowrate_air/29)#
Lm = 0.65/18# #Lm is in kmol/m**2.sec
#A mass balance between a plane in the tower where the compositions are X and Y and the top of the tower gives:
#Y = 1.173X+0.001
X = arange(0,0.159,0.001)
Y=[]
for x in X:
Y.append(1.173*x+0.001)
plot(X,Y)#
x=[0.021,0.031,0.042,0.053,0.079,0.106,0.159]
PG = [12,18.2,24.9, 31.7, 50.0, 69.6, 114.0]
i=0
Y1=[]
while i<7:
Y1.append(PG[(i)]/(760-PG[(i)]))
i=i+1
plot(x,Y1)#
#xlabel("Area under the curve is 3.82m"%("kmolNH3/kmolH2O"%("kmolNH3/kmol air"
title("Operating and equilibrium lines")
xlabel("kmol NH3/kmol H2O")
ylabel("kmol NH3/kmol air")
show()
#If the equilibrium line is assumed to be straight, then:
#Gm(Y2 − Y1) = KGaZdeltaPlm
#Top driving force
deltaY2 = 0.022#
#Bottom driving force
deltaY1 = 0.001#
deltaYlm = 0.0068#
Z = (0.0307*0.11)/(0.001*0.688)#
print "The height of the tower is %.2f meters"%(Z)#
```

In [35]:

```
from sympy import symbols, solve, log
print "\n Number of theoretical plates = %d"%((30*0.3))#
#At the bottom of the tower:
#Flowrate of steam = Gm (kmol/m**22s)
#Mole ratio of pentane in steam = Y1, and
#Mole ratio of pentane in oil = X1
X1 = 0.001#
#At the top of the tower:
#exit steam composition = Y2
#inlet oil composition = X2
X2 = 0.06#
#flowrate of oil = Lm (kmol/m**2.sec)
#The minimum steam consumption occurs when the exit steam stream is in equilibrium with the inlet oil, that is when:
#The equilibrium relation for the system may be taken as Ye = 3.0X, where Ye and X are expressed in mole ratios of pentane in the gas and liquid phases respectively.
Ye2 = X2*3#
#Lmin(X2 − X1) = Gmin(Y2 − Y1)
#If Y1 = 0, that is the inlet steam is pentane-free, then:
ratio_min = (X2 - X1)/Ye2#
#The operating line may be fixed by trial and error as it passes through the point (0.001, 0), and 9 theoretical plates are required for the separation. Thus it is a matter of selecting the operating line which, with 9 steps, will give X2 = 0.001 when X1 = 0.06. This is tedious but possible, and the problem may be better solved analytically since the equilibrium line is straight.
#let x = 1/A
#for a stripping operation
LHS = (X2-X1)/(X2)#
print "\n LHS = %0.2f"%(LHS)#
x = symbols('x')
x1 = solve((x**10-x)-LHS*(x**(10)-1),x)[0]
print "\n 1/A = %.2f"%(x1)#
#A = Lm/mGm
print "\n Gm/Lm = %.3f"%(x1/3)#
print "\n Actual/minimum Gm/Lm = %.2f"%(0.457/0.328)#
#If (actual Gm/Lm)/(min Gm/Lm) = 2,
print "\n Actual Gm/Lm = %.3f"%(.328*2)#
x2 = 3*(0.656)#
print "\n 1/A = mGm/Lm = %.3f"%(3*0.656)#
#y = (1.968)**(N+1)
y = symbols('y')
y1 = solve(0.983*(y-1)-(y-1.968),y)[0]
N = log(y1)/log(1.968)-1#
print "\n The actual number of plates are : %.1f"%(ceil(N/0.3))#
```