#Design of a sieve tray
from math import pi
from math import sqrt
tL = 14100.0 #top liquid rate(kg/h)
bL = 15300.0 #Bottom liquid rate(kg/h)
tG = 23300.0 #top vapour rate(kg/h)
bG = 24500.0 #Bottom vapour rate(kg/h)
phoL = 810.0 #liquid density(kg/m^3)
phoG = 2.65 #average vapour density(kg/m^3)
sig = 20.5 #liquid surface tension(dyne/cm)
T = 82.0 #Temperature
p = 18.0 #average pressure at the column top(psia)
#Fair's method
Flv = (bL/bG)*(phoG/phoL)**(0.5) #Flow parameter
Csb = 0.285 #Souders-Brown flooding constant
usfl = Csb*((20/sig)**0.2)*(((50.4-0.165)/(0.165))**0.5) #flooding velocity
us = 5*0.7 #operating velocity when operating velocity is 70% of flooding velocity
Vfl = (bG/phoG)*35.315 #Volumetric flow rate of the vapour
Aa = Vfl/(us*3600)
fd = 0.2 #taking fractional downcomer area
At = Aa/(1-fd) #Tower cross-section
Dc = (4*32.4/pi)**(0.5) #Tower diameter
print "(a) Tower diameter by Fair's method is %0.2f ft"%Dc
print " Flooding velocity by Fair's method is %0.0f ft"%usfl
#Kister and Haas method
dh = 3.0/8 #hole diameter
Af = 0.1 #fractional hole area on the tray
Dc = 6
lw = 0.727*Dc
L = bL/(0.81*3.78*60) #Liquid rate(gpm)
Ql = 83.3/(lw*12) #gpm per inch
fh = 0.1
hctw = (0.29*(0.1**-0.791)*(dh**0.833))/(1+(0.0036*(1.6**-0.59)*(0.1**-1.79)))
n = 0.0231*(dh/0.1)
hct = hctw*(62.2/50.4)**(0.5*(1-0.0866))
Csb = 0.144*((dh*dh*20.5/50.4)**0.125)*((0.165/50.4)**0.1)*((18/0.749)**0.5)
usfl = Csb*((50.4-0.165)/0.165)**0.5
print ' Flooding velocity by Kister ans Haas method is %0.2f ft/s'%usfl
print ' It is very close that is obtained by Fairs method and is acceptable'
#(b)Check of the estimated downcomer area
area = 3.38 #Estimated downcomer area
liq_f = 15300*35.315/(810*3600) #The clear liquid flow rate
liq_v = liq_f*area #The downcomer liquid velocity
d_vol = area*18/12 #Downcomer volume
res_t = d_vol/liq_f #Residence time
n_ar = Aa/(1-(2*0.06)) #Revised tower cross-section
Dc = (4*n_ar/pi)**0.5 #Tower diameter
d_area = n_ar*0.06 #Downcomer area
lw = 3.75 #Weir length
d_liqv = liq_f/d_area #downcomer liquid velocity
print '(b) Downcomer area = %0.3f ft^2'%d_area,' and downcomer liquid velocity = %0.3f ft/s'%d_liqv
print ' These are acceptable values. So we keep the revised column diameter at Dc = %0.2f ft'%Dc
#(c)Effective bubbling area and layout of the holes
eff_area = Aa-3 #effective bubbling area
frac_area = 0.905*(1.0/3)*(1.0/3)
tot_harea = eff_area*frac_area
n_holes = tot_harea/((pi/4)*((3.0/96)**2))
print '(c) Number of holes = %0.0f placed on a triangular pitch'%n_holes
#(d)Wier height
hw = 2
print '(d) Select an outlet weir height of hw = %0.0f inches on the tray'%hw
#(e)Pressure drop calculation
uh = Vfl/(tot_harea*3600) #Vapour velocity through the holes
thick = 3.0/16 #select a tray thickness
thbyD = thick/(3.0/8) #tray thickness/hole dia
Co = 0.73 #the orifice coefficient
hd = (0.186/(Co**2))*(0.165/50.4)*(39.1**2) #Dry tray pressure drop
print '(e) Dry tray pressure drop, hd = %0.2f inches of liquid'%hd
Ql = 83.3/(lw*12) #in gpm per inch of weir length
Fw = 1.27 #weir correction factor
how = 0.48*Fw*(Ql**(2.0/3))
print ' how = %0.2f inch'%how
hc = hw + how
us = 326500/(22.9*3600)
beta = 0.6
hl = 0.6*2.92 #first calculate us and us(pg^0.5) and then from figure take beta
print ' pressure drop for flow of the vapour through the liquid'
Ada = 0.5*3.75/12 #area for liquid flow
had = 0.03*(83.3/(100*Ada))**2
print ' head loss for liquid flow below the downcomer flow, had = %0.2f inch'%had
print ' total pressure drop = %0.2f inch of liquid'%(hc+hd+hl+had)
phi = (bL/bG)*(0.165/50.4)**0.5
print ' The rate of entrainment is %0.4f mol per mol gross downflow'%phi
sig = 20.5 #in dyne/cm
phol = 50.4 #lb/ft^3
dH = 3.0/8 #in inch
hsig = (0.04*sig)/(phol*dH)
hd = 0.58
uh = sqrt(((0.73**2)/0.186)*(50.4*hd/0.165))
print ' The corresponding vapour velocity at the hole at weeping is %0.1f ft/s'%uh
#column height
height = 29*1.5
ex_sp = 3*0.5
tot_h = 43.5+1.5+1.5+9+4
#total column height will be tray spacing + extra space for feed trays
# + extra space at trays with manholes + bottom space + top space
print 'Total column height = %0.0f ft'%tot_h
#Answers may vary due to round off error
#Design of packed tower
from math import pi
from math import sqrt
L = 37525 #Liquid rate
G = 1500.0 #gas rate
M = 0.9*28.8 + (0.1*64) #average molecular weight of the feed gas
R = 0.08317 #gas constant
T = 303 #in K
P = 1.013 #in bar
phoG = P*M/(R*T) #kg/m^3
phoG_c = 0.081 #in lb/ft^3
muL = 0.81 #liquid viscosity
st = 70 #surface tension
phoL = 996 #in kg/m^3
phoL_c = 62 #in lb/ft^3
Flv = (L/G)*(phoG/phoL)**0.5
#Calculation of column diameter using raschig ring as packing material
dp = 3.0/4 #size of packing material
cp = 0.021 #from Eckert's GPDC chart(capacity parameter)
pwbypl = 1 #pho_w by pho_l
Fp = 94.5 #packing factor(in per ft)
gc = 4.18e8 #in ft/h^2
Gdash = sqrt((cp*phoG_c*phoL_c*gc)/(Fp*pwbypl*(muL**0.2)))
op_Gdash = Gdash*0.7
op_Gdash = op_Gdash*0.453592/(0.3048*0.3048)
tow_cross = G/op_Gdash
Dc = sqrt(4*tow_cross/pi)
print 'Tower diameter when raschig ring is used as packing material, Dc = %0.2f m'%Dc
#Calculation of column diameter when 50mm Pall ring is used as packing material
cp = 0.52 #capacity parameter from chart
Fp = 25 #flow parameter
v = 0.81 #liquid viscosity
Cs = cp/((Fp**0.5)*(v**0.05))
usG = Cs*sqrt((phoL - phoG)/phoG) #superficial gas velocity
usG = usG*0.3048
Gflow = G/(phoG*3600) #volumeteric gas flow rate
tow_cros = Gflow/usG #tower cross section
Dc = sqrt(4*tow_cros/pi) #tower diameter
print 'Tower diameter, Dc when Pall ring is used, = %0.2f m'%Dc
P_drop = 0.2*(5.0/0.3048) #pressure drop across the bed of 5m height
op_Pdrop = P_drop*1.1
op_Pdrop = op_Pdrop*0.0254*phoL*9.81
G = G/3600
Pow = (op_Pdrop/phoG)*G
print 'Power requirement is %0.2fW'%Pow
Pow = Pow/0.65
print 'Actual Power requirement is %0.2fW'%Pow
#calculation of operating liquid holup using Engel's equation
ap = 102
muL = 8.1e-4 #liquid viscosity
sigL = 0.07 #surface tension
usL = (L/phoL)/(0.362*3600) #superficial velocity
hLo = 0.93*(((usL**2)*102/9.81)**(1.0/6))*(((muL**2)*(ap**3)/((phoL**2)*9.81))**(1.0/10))*((0.07*102*102/phoL*9.81)**1.0/8)
print 'volume fraction liquid holdup in the bed %0.4f m^3 liquid per m^3 bed volume'%hLo
#Answers may vary due to round off error