Cre Assignment 2
Cre Assignment 2
import scipy as sp
from scipy.spatial import ConvexHull
plt.style.use("ggplot")
from mpl_toolkits.mplot3d import Axes3D
A→B→C
2A → D
def rate_fn(C,t):
cA = C[0]
cB = C[1]
1
#rate constants
k1 = 1.0
k2 = 1.0
k3 = 10.0
#r = [rA, rB]
return np.array([-k1*cA - 2*k3*cA**2,
k1*cA - k2*cB])
fig = plt.figure(figsize=(5,5))
ax = fig.gca()
for i in range(N):
c_mix = L*pfr_cs[-1, :] + (1.0 - L)*Cf
ax.plot(c_mix[0],c_mix[1],"*")
pfr_cs, pfr_ts = artools.pfrTrajectory(c_mix, rate_fn, pfr_tend)
#plt.show(fig)
index=np.linspace(0,len(cstr_cs)-1,10)
for j in index:
j=int(j)
c_cstr_output=cstr_cs[j,:]
2
ax.set_xlabel("C_A")
ax.set_ylabel("C_B")
plt.show(fig)
interact(plot_fn, L=(0,1,0.01), pfr_tend=(0,10,0.05), N=(1,25,1))
plot_fn(L=0.68,pfr_tend=0.3)
print("The maximum conc of B is seen by hit and trial of parameters, the␣
,→parameters found potimal given that we can only use recycle reactor are given␣
,→other wise more better configuration can be found by using cstr in series with␣
The maximum conc of B is seen by hit and trial of parameters, the parameters
found potimal given that we can only use recycle reactor are given by Recycle
ratio=0.68, residance time=0.3, with maximum value of cb ~~ 0.095. other wise
more better configuration can be found by using cstr in series with pfr as shown
in figure.
3
[315]: def feild_plot(c,t):
for k in [0.1,1]:
ca=np.linspace(0.001,k,50)
cb=np.linspace(0.001,0.1,10)
fig = plt.figure(figsize=(10,5))
ax = fig.gca()
for i in ca:
for j in cb:
normal_rate=rate_fn([i,j],t)
normal_rate=normal_rate/np.linalg.norm(normal_rate)
ax.quiver(i, j, normal_rate[0],␣
,→normal_rate[1],scale=90,color="b")
plt.show()
[316]: feild_plot(1,1)
4
[ ]:
[ ]:
OPTIMAL PLOT
5
6