import math
from scipy.integrate import quad
# Variables
#Initial Concentration(mol/litre)eactant in combined feed
CAo = 10.
CBo = 10.
XA = 0.9; # conversion
CAf = CAo*(1-XA);
CA = CAf;
# Calculations
def f4(CA):
return 1./(1+CA**0.5)
Qp = (-1./(CAo-CAf))* quad(f4,CAo,CAf)[0]
CRf = 9*Qp;
CSf = 9*(1-Qp)
# Results
print " Part a"
print " For Plug Flow"
print " Concentration of R in the product stream is %.2f mol/litre"%(CRf)
print " Csf is %.2f mol/litre"%(CSf)
Qm = CA/(CA+CA**1.5);
CRf = 9*Qm;
Csf = 9*(1-Qm)
print " Part b"
print " For Mixed Flow"
print " Concentration of R in the product stream is %.2f mol/litre "%(CRf)
print " Csf is %.2f mol/litre"%(Csf)
CAo = 19.
CB = 1;
def f5(CA):
return CA/(CA+CB**1.5)
Q = -1./(CAo-CAf)* quad(f5,CAo,CAf)[0]
CRf = 9*Q;
Csf = 9*(1-Q)
print " Part c"
print " For Plug flow A Mixed flow B"
print " Concentration of R in the product stream is %.2f mol/litre"%(CRf)
print " Csf is %.2f mol/litre"%(Csf)
print ('The result for plug flow varies as there seems to be typographical error in integration done in book')
import math
from scipy.integrate import quad
# Variables
CAo = 2; # decomposition of A
CA = 0.5;
CAf = 0.;
Csf = (CAo-CA)*2*CA/(1+CA)**2;
print " Part a"
print " For Mixed Flow Reactor"
print " Maximum expected Cs is %.3f"%(Csf)
# Calculations
def f12(CA):
return 2*CA/(1+CA)**2
Csf = -1* quad(f12,CAo,CAf)[0]
# Results
print " Part b"
print " For Plug Flow"
print " Maximum expected concentration of S is %.3f "%(Csf)
CA = 1.;
Csf = (CAo-CA)*2*CA/(1+CA)**2;
print "Part c"
print " For MFR with separation and recycle"
print " Concentration of Csf is %.2f"%(Csf)
import math
from scipy.integrate import quad
# Variables
CAo = 2. # based on example 7.3
CA = 1.
Q = 0.5
# Calculations
Cs1 = Q*(CAo-CA);
def f6(CA):
return 2*CA/(1+CA)**2
Cs2 = -1* quad(f6,1,0)[0]
#Total amount of CS formed is
Cs = Cs1+Cs2;
# Results
print "Mixed flow followed by plug flow would be best"
print " Total amount of CS formed is %.3f mol/litre"%(Cs)