In [4]:

```
# Variables
#Concentrations in mol/litre
CAo = 0.1 # liquid
CBo = 0.01 # liquid
Cco = 0. # liquid
CAf = 0.02 # outlet stream
CBf = 0.03 # outlet stream
Ccf = 0.04; # outlet stream
#Volume in litre
V = 1.;
#Volumetric flow rate(l/min)
v = 1.;
CA = CAf;CB = CBf;Cc = Ccf;
# Calculations
#Rate of reaction(mol/litre.min)
rA = (CAo-CA)/(V/v);
rB = (CBo-CB)/(V/v);
rc = (Cco-Cc)/(V/v);
# Results
print "rate of reaction of A is %.2f mol/litre.min"%(rA)
print "rate of reaction of B is %.2f mol/litre.min"%(rB)
print "rate of reaction of C is %.2f mol/litre.min"%(rc)
```

In [5]:

```
%matplotlib inline
import math
from numpy import *
from matplotlib.pyplot import *
from scipy import stats
# Variables
vo = array([10,3,1.2,0.5]) #Volumetric flow rates(litre/hr)
CA = array([85.7,66.7,50,33.4]) #Concentrations (millimol/litre)
CAo = 100.;
V = 0.1; #Volume(litre)
e = (1.-2.)/2; #Expansion factor is
#Initialization
XA = zeros(4);
rA = zeros(4);
m = zeros(4);
n = zeros(4);
# Calculations
#Relation between concentration and conversion
for i in range(4):
XA[i] = (1-CA[i]/CAo)/(1+e*CA[i]/CAo);
rA[i] = vo[i]*CAo*XA[i]/V;
m[i] = math.log10(CA[i]);
n[i] = math.log10(rA[i]);
# Results
#For nth order plot between n & m should give a straight line
plot(m,n)
xlabel("log CA")
ylabel("log (-rA)")
show()
coefs = stats.linregress(m,n);
print coefs
print "Intercept of the graph is %.2f"%(coefs[1])
print "Slope of the graph is %.2f"%(coefs[0])
k = 10**coefs[1]
n = coefs[0]
print " Taking n = 2, rate of equation is %.2f millimol/litre.hr"%(k),
print "CA**2 "
print ('The sol slightly differ from that given in book because regress fn is used to calculate the slope')
```

In [6]:

```
'''
Note : The sol varies from book as the value of CB taken in book at end is wrong
'''
import math
# Variables
CAo = 1.4
CBo = 0.8
CRo = 0.
#Volume(litre)
V = 6.
# Calculations
#For 75% conversion of B
#From stoichiometry of equation A+2B-->R
CA = 1.4-(0.75*0.8)/2.;
CB = 0.8-(0.75*0.8);
CR = (0.75*0.8)/2.;
#From the Given rate equation(mol/litre.min)
rB = 2*(12.5*CA*CB*CB-1.5*CR);
#Volumetric flow rate is given by
v = V*rB/(CBo-CB);
# Results
print " volumetric flow rate into and out of the reactor is %.1f litre/min"%(v)
```

In [1]:

```
import math
from scipy.integrate import quad
# Variables
eA = (4-2.)/2;
CAo = 0.0625; # mol/liter
xAo = 0.
xAf = 0.8 # conversion
k = 0.01;
# Calculations
def f1(xA):
return math.sqrt((1+xA)/(1-xA))
X = quad(f1,xAo,xAf)[0]
t = math.sqrt(CAo)*X/k;
# Results
print " Space timesec needed is %.2f sec"%(t)
```

In [9]:

```
import math
# Variables
T = 922. #Temperature(kelvin)
P = 460000.; # kPA
FAo = 40. # pure phosphine
k = 10.
R = 8.314;
# Calculations
CAo = P/(R*T); # mol/m3
e = (7-4)/4.;
XA = 0.8;
#The volume of plug flow reactor is given by
V = FAo*((1+e)*math.log(1./(1-XA))-e*XA)/(k*CAo);
# Results
print " volume of reactor is %.3f m**3"%(V)
```

In [ ]:

```
```