import math
# Variables
PA = 101325. #Pa
HA = 36845. #PA.m3.l/mol
CBo = 1000. #mol/m3
v = 10**-4 #m3*l/s
h = 5. #m
A = 0.1 #m2
# Calculations
CA = PA/HA;
FBo = v*CBo;
Vr = A*h;
dp = 5*10**-3; #mcat
d_solid = 4500. #kg/m3cat
De = 8*10**-10; #m3l/mcat.s
n = 0.5;
b = 1.;
k = 2.35*10**-3;
L = dp/6.;
kai_overall = 0.02;
kac_ac = 0.05;
f = 0.6;
#For a half-order reaction
Mt = L*math.sqrt((n+1)*(k*d_solid*(CA)**(n-1))/(2*De));
E = 1/Mt;
rA = (1/((1/(kai_overall))+(1/(kac_ac))+(1/(k*b*(CA**(n-1))*E*f*d_solid))))*(PA/HA);
#From Material Balance
XB = b*rA*Vr/FBo;
# Results
print " The conversion of acetone is %.3f"%(XB)
%matplotlib inline
import math
from matplotlib.pyplot import *
from numpy import *
# Variables
PA = 14.6*101325; #Pa
HA = 148000.; # liquid
Vr = 2.;
Vl = Vr;
b = 1.;
fs = 0.0055;
# Calculations
k = 5.*10**-5; #m6l/kg.molcat.s
dp = 5*10**-5; #mcat
kac = 4.4*10**-4;kai = 0.277; #m3l/m3.r.s
density = 1450.; #kg/m3
De = 5*10**-10; #m3l/mcat.s
L = dp/6; #for spherical particle
CA = PA/HA;
X = 0.9;
CBo = 2500.
CB = CBo*(1-X);
ac = 6*fs/dp;
K = kac*ac;
CB = [2500,1000,250];
e = [0.19,0.29,0.5];
Mt = zeros(3)
rA = zeros(3)
inv_rA = zeros(3)
for i in range(3):
Mt[i] = L*math.sqrt(k*CB[i]*density/De);
rA[i] = CA/((1./kai)+(1./K)+(1./(k*density*e[i]*fs*CB[i])))
inv_rA[i] = 1/rA[i];
# Results
plot(CB,inv_rA)
ylabel("1/-rA")
Area = 3460.
t = Vl*Area/(b*Vr);
t = t/60. #min
print " The time required for 90 percentage conversion of reactant is %.f"%t,
print "min"
show()