Skip to content
Snippets Groups Projects
Commit 064695ec authored by Delvigne Frank's avatar Delvigne Frank
Browse files

Upload New File

parent fc5edd7a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 19 22:17:31 2025
@author: delvigne
"""
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
# function that returns dC1/dt, dC2/dt, dC3/dt
def model(C, t, Q, V):
C1, C2, C3 = C
dC1dt = -Q*C1/V
dC2dt = -Q*C2/V + Q*C1/V
dC3dt = -Q*C3/V + Q*C2/V
return [dC1dt, dC2dt, dC3dt]
#Initial conditions
C0 = [1, 0, 0]
# Parameters
V = 1000/3 #in L
Q = 100 #in L/min
# time points
t = np.linspace(0, 30) # time points in minutes
# solve ODE
C= odeint(model, C0, t, args=(Q,V))
# plot results
plt.plot(t, C[:, 0], label='CSTR1')
plt.plot(t, C[:, 1], label='CSTR2')
plt.plot(t, C[:, 2], label='CSTR3')
plt.xlabel('time (min')
plt.ylabel('Concentration (AU)')
plt.grid()
plt.legend()
plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment