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

Upload New File

parent 064695ec
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:24:11 2025
@author: delvigne
"""
import numpy as np
from scipy.integrate import solve_ivp
from matplotlib.pyplot import figure
from matplotlib.pyplot import plot
from matplotlib.pyplot import xlabel
from matplotlib.pyplot import ylabel
def Batch(t, state):
C1 = state[0]
C2 = state[1]
C3 = state[2]
V = 1000/3 #in L
Q = 100 #in L/min
dC1dt = -Q*C1/V
dC2dt = -Q*C2/V + Q*C1/V
dC3dt = -Q*C3/V + Q*C2/V
state = [dC1dt,dC2dt,dC3dt]
return state
'''Specify the time range for running the simulation'''
t = np.linspace(0,30)
'''Specify the initial conditions'''
state0 = [1,0,0] #We have 0.1 g/L of biomass and 5 g/L of substrate at the beginning of the simulation
'''Solve the ODEs'''
r = solve_ivp(fun=Batch, t_span=[t[0],max(t)],y0=state0, t_eval=t)
#method='LSODA'
figure(1)
plot(r.t,r.y.T)
xlabel('Time (min)')
ylabel('C (AU)')
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