Recycle reactor
January 19, 2025
1 PFR trajectory convex hull demonstration
1.1 Import necessary python packages
[2]: # artools
import sys
sys.path.append('../../../artools')
from importlib import reload
import artools
artools = reload(artools)
import numpy as np
# anaconda
from ipywidgets import interact
import scipy as sp
from scipy.spatial import ConvexHull
import matplotlib.pyplot as plt
from matplotlib.tri import Triangulation
%matplotlib inline
plt.style.use("ggplot")
from mpl_toolkits.mplot3d import Axes3D
1.2 Define kinetics
We use the van de vusse system to demonstrate:
A→B→C
2A → D
[84]: # 2D van de Vusse kinetics
# A -> B -> C
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])
[320]: def plot_fn(L=0.85, pfr_tend=0.21, N=25):
Cf = np.array([1.0, 0.0])
pfr_cs, pfr_ts = artools.pfrTrajectory(Cf, rate_fn, 10)
cstr_cs, cstr_ts = artools.cstrLocus_fast(Cf, rate_fn, 1000, 200)
fig = plt.figure(figsize=(5,5))
ax = fig.gca()
ax.plot(cstr_cs[:, 0], cstr_cs[:, 1], "bx")
ax.plot(pfr_cs[:, 0], pfr_cs[:, 1], "r-")
pfr_cs, pfr_ts = artools.pfrTrajectory(Cf, rate_fn, pfr_tend)
ax.plot(pfr_cs[:, 0], pfr_cs[:, 1], "k-")
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)
ax.plot(pfr_cs[:, 0], pfr_cs[:, 1], "k-")
ax.plot(pfr_cs[-1, 0], pfr_cs[-1, 1], "ko")
#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,:]
pfr_cs_from_cstr, pfr_ts = artools.pfrTrajectory(c_cstr_output, rate_fn,␣
15)
,→
ax.plot(pfr_cs_from_cstr[:, 0], pfr_cs_from_cstr[:, 1])
plt.text(c_mix[0],c_mix[1],"starting for recycle *")
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␣
,→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.")
interactive(children=(FloatSlider(value=0.85, description='L', max=1.0, step=0.
,→01), FloatSlider(value=0.21, de...
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