What you will build
A closed flask (a batch reactor) in which aerobic heterotrophs grow on a soluble substrate. You will grow them with Monod kinetics, add endogenous decay, and then turn the flask into a BOD bottle that tracks dissolved oxygen, comparing the oxygen curve with the first-order BOD model. Each stage is checked against a numerical solution of the same equations that you write yourself (spreadsheet or Python), plus the exact results of Module 10: the conservation of \(X + YS\), the integrated Monod solution, the exponential limit and the COD balance.
| Stage | What changes | What to look for | Saved as |
|---|---|---|---|
| 1 | Monod growth, no decay (\(S_0 = 200\), \(X_0 = 2\)) | \(X\) → 86 mg/L; \(S + X/Y\) = 204.76 at all times; \(S\) = 20 mg/L at 1.010 days | M10_stage1_monod_growth.ohq |
| 2 | + endogenous decay, \(b = 0.1\) day⁻¹ | peak 82.6 mg/L at 1.15 days, then \(X \propto e^{-0.1t}\) | M10_stage2_decay.ohq |
| 3 | a BOD bottle: + dissolved oxygen, + a first-order BOD model | \(DO_0 - DO = (S_0 - S) + 1.42(X_0 - X)\); BOD₅ = 3.00 mg/L | M10_stage3_bod_bottle.ohq |
The system
| Item | Value |
|---|---|
| Flask | a Reactor with 1 m³ of water and no inflow or outflow (Module 4: batch reactor) |
| Kinetics (Module 10, Example 3) | \(q_{\max} = 10\) g COD/(g VSS·day), \(K_s = 20\) mg COD/L, \(Y = 0.42\) g VSS/g COD (\(\mu_{\max} = 4.2\) day⁻¹), \(b = 0.1\) day⁻¹ |
| Stages 1–2 | \(S_0 = 200\) mg COD/L, \(X_0 = 2\) mg VSS/L; 2 days (Stage 2: 8 days) |
| Stage 3 (BOD bottle) | \(S_0 = 5\) mg COD/L (a diluted sample), \(X_0 = 0.5\) mg VSS/L (seed), \(DO_0 = 9\) mg/L; 20 days |
Units: OpenHydroQual works in g/m³, which equals mg/L. S is in COD units and X in VSS units, so the stoichiometric constants carry the conversion (\(Y\) g VSS per g COD; 1.42 g COD per g VSS).
Build: 1 Plugin 2 Constituents 3 Parameters 4 Growth reaction 5 Flask 6 Settings
Stages: 1 Monod growth 2 Decay 3 BOD bottle Your numerical solution Checkpoints Explore Troubleshooting What to submit
1Start a model and load the Mass Transfer plugin
As in the M1 guide, Step 1: File → Preferences → Add plugin → Mass Transfer (for the Reactor block).


2Two constituents: S and X
Create two Chemical constituents (as in M1, Step 2) and name them S (substrate, mg COD/L) and X (active biomass, mg VSS/L).
Biomass is a Chemical constituent here because nothing moves in a flask. In a reactor with flows (Module 11) the cells are suspended in the water and also flow, so a Chemical constituent is still the right choice; attached biofilm (Module 12) will need an immobile one.
3Reaction parameters
Create three Reaction Parameters (Add Objects → Chemistry → Reaction Parameter), setting the name and Value, Arrhenius factor 1:
| Name | Value | Meaning |
|---|---|---|
| q_max | 10 | maximum specific substrate-utilization rate, g COD/(g VSS·day) |
| K_s | 20 | half-saturation constant, mg COD/L |
| Y | 0.42 | true yield, g VSS/g COD (Module 10, Example 2a: \(f_s \approx 0.6\)) |
The Arrhenius factor is the \(\theta\) of Module 2: OpenHydroQual multiplies the value by \(\theta^{T - T_{\text{ref}}}\) if you give it a temperature time series. With \(\theta = 1\) the value is used as it is.
4The growth reaction
Add a Chemical reaction named Growth. Its rate expression is the substrate-utilization rate \(r_{ut}\) of Module 10, Section 3, and its stoichiometric constants say what each gram of substrate COD used does to S and X:
| Property | Value | Meaning | |
|---|---|---|---|
| 1 | S:Stoichiometric Constant | −1 | 1 g of substrate COD is used |
| 2 | X:Stoichiometric Constant | Y | \(Y\) g of cells are made (a parameter name is allowed here) |
| 3 | Name | Growth | |
| 4 | Rate Expression | q_max*S/(K_s+S)*X | \(r_{ut} = q_{\max}\dfrac{S}{K_s + S}X\), g COD/(m³·day) |
OpenHydroQual multiplies the rate by each stoichiometric constant and adds it to that constituent's balance, so it solves exactly \(dS/dt = -r_{ut}\) and \(dX/dt = Y\,r_{ut}\).
5The flask: a Reactor with no flows
Add one Reactor named Flask. No outlet and no links are needed: a batch reactor exchanges nothing with its surroundings.
6Simulation time and a fixed, small time step


Stage 1Monod growth
Save as M10_stage1_monod_growth.ohq and run.


Check three exact results from Module 10, Section 4:
- Conservation: \(S + X/Y\) is the same at every time: \(200 + 2/0.42 = 204.76\) mg/L. Read S and X at a few times and check.
- Final biomass: \(X_0 + YS_0 = 2 + 0.42(200) = 86.0\) mg/L.
- Integrated solution: \(S\) reaches 100, 20 and 1 mg/L at 0.824, 1.010 and 1.105 days (\(\mu_{\max}t = 1.0977\ln(X/X_0) - 0.0977\ln(S/S_0)\)).
- Exponential limit: early on \(X \approx 2e^{4.2t}\); it predicts 20 mg/L at 0.548 day, while the model (and the exact solution) reach it at 0.607 day. Plot \(X\) on a log scale (or compute \(\ln X\)) to see the straight line and where it bends.
Stage 2Endogenous decay
Save a copy as M10_stage2_decay.ohq. Add a parameter b = 0.1 and a second reaction:
b*X.Set the end time to 8 days and run. Now \(dX/dt = Yr_{ut} - bX\), and \(S + X/Y\) is no longer constant (decayed cells are lost).
Stage 3The flask becomes a BOD bottle
Save a copy as M10_stage3_bod_bottle.ohq. A BOD bottle is a batch reactor too: a diluted sample (little substrate), a small seed of bacteria, and oxygen that is used up and not replaced. Make these changes:
- Add two Chemical constituents, DO (dissolved oxygen) and L (BOD remaining in the first-order model).
- Add the oxygen use to the two reactions (Module 10, Section 5): in Growth, DO:Stoichiometric Constant
-(1-1.42*Y); in Decay, DO:Stoichiometric Constant-1.42. - Add a parameter k_1 = 0.162 and a reaction First_order_BOD with rate
k_1*Land L:Stoichiometric Constant −1 (all others 0). - Flask initial values: S = 5, X = 0.5, DO = 9, L = 5.21. End time 20 days.

-(1-1.42*Y) = −0.404 (the GUI displays it as (0-(1-1.42*Y))), 2 L 0, 3 S −1, 4 X Y.
Where do 5.21 and 0.162 come from? They are the first-order curve \(L_0(1 - e^{-kt})\) that best fits (least squares, 0.5–20 days) the oxygen used by the Monod model in this bottle. Fitting a first-order curve is how BOD data are usually summarized, and here it lets you see how well that summary describes growth plus decay.
The exact check for this stage is the COD balance from Module 10, Section 5: at every time, \(9 - DO = (5 - S) + 1.42(0.5 - X)\). Read S, X and DO at 2, 5 and 10 days and verify it to the third decimal.
Your own numerical solution
The Monod equations with decay have no closed-form solution, so the honest check is to solve the same equations with a method you control. Either:
- Spreadsheet (Euler): columns t, S, X (and DO); each row \(S_{n+1} = S_n - \Delta t\,q_{\max}\frac{S_n}{K_s + S_n}X_n\), \(X_{n+1} = X_n + \Delta t\,(Y q_{\max}\frac{S_n}{K_s + S_n} - b)X_n\), with \(\Delta t = 0.001\) day (2000 rows for Stage 1). Halve \(\Delta t\) once to confirm the answer no longer changes.
- Python (Runge–Kutta, 4th order): the short program below.
# Monod batch growth with decay and oxygen: RK4 (CEE 466/566 M10)
import math
qmax, Ks, Y, b = 10.0, 20.0, 0.42, 0.1 # Stage 1: set b = 0
def f(y):
S, X, DO = y
r = qmax * S / (Ks + S) * X # substrate utilization, g COD/m3/day
return [-r, Y * r - b * X, -(1 - 1.42 * Y) * r - 1.42 * b * X]
y, t, dt = [200.0, 2.0, 9.0], 0.0, 0.001 # Stage 3: [5.0, 0.5, 9.0]
for n in range(int(8 / dt)): # 8 days
k1 = f(y)
k2 = f([a + dt / 2 * k for a, k in zip(y, k1)])
k3 = f([a + dt / 2 * k for a, k in zip(y, k2)])
k4 = f([a + dt * k for a, k in zip(y, k3)])
y = [a + dt / 6 * (p + 2 * q + 2 * r + s) for a, p, q, r, s in zip(y, k1, k2, k3, k4)]
t += dt
if abs(t - round(t * 4) / 4) < dt / 2: # print every 0.25 day
print(f"{t:5.2f} S = {y[0]:8.3f} X = {y[1]:7.3f}")
(In Stages 1–2, DO goes negative because the flask is not aerated; ignore that column there.)
Checkpoints
Read these from your own runs; small differences in the last digit are normal. "RK4" is a fourth-order Runge–Kutta solution of the same equations (\(\Delta t \le 0.0005\) day).
| Stage | Quantity | Model | Exact / RK4 |
|---|---|---|---|
| 1 | X at 0.5 / 0.75 / 1.0 days (mg/L) | 13.42 / 33.97 / 76.25 | 13.37 / 33.80 / 75.97 (RK4) |
| 1 | S at 0.5 / 1.0 days (mg/L) | 172.8 / 23.2 | 172.9 / 23.9 (RK4) |
| 1 | Time at which S = 100 / 20 / 1 mg/L (days) | 0.822 / 1.008 / 1.104 | 0.824 / 1.010 / 1.105 (integrated) |
| 1 | Final X; S + X/Y (mg/L) | 86.00; 204.76 | 86.00; 204.76 |
| 2 | X at 1 / 2 / 8 days (mg/L) | 70.62 / 76.02 / 41.72 | 70.34 / 76.03 / 41.73 (RK4) |
| 2 | Decline rate ln(X₄/X₈)/4 (day⁻¹) | 0.1000 | \(b\) = 0.1 |
| 3 | BOD = 9 − DO at 2 / 5 / 10 / 20 days (mg/L) | 1.420 / 2.996 / 4.094 / 5.116 | 1.420 / 2.996 / 4.094 / 5.116 (RK4) |
| 3 | COD balance (5 − S) + 1.42(0.5 − X) at the same times | 1.420 / 2.996 / 4.094 / 5.116 | equal to 9 − DO (exact) |
| 3 | First-order 5.21 − L at 5 / 10 / 20 days (mg/L) | 2.892 / 4.179 / 5.006 | 2.892 / 4.179 / 5.006 (exact) |
During the steep part of the growth (around 1 day in Stage 1) a concentration can differ by a few percent between two correct solutions, because a small shift in time is a large shift in value; compare the times at which S crosses a value instead (third row): they agree to within 3 minutes.
Explore
Save a copy with File → Save as and change one thing at a time.
- The time step matters. Rerun Stage 1 with the M1 solver settings (initial step 0.01, increase factor 5). Compare X at 0.5 day with the RK4 value. Then try 0.0005 with factor 1.
- Ks does not change the final biomass. In Stage 1, set K_s = 100. Which results change, and which do not?
- Lower yield. Use Y = 0.35 (denitrifier-like, Module 10, Example 2b) in Stage 3. How do the oxygen used by growth and the BOD₅ change? Check with \(1 - 1.42Y\).
- A bigger seed. In Stage 3, set X = 5. Does the BOD curve now look more like the first-order model? Why?
- Temperature. Give q_max an Arrhenius factor of 1.07 with reference temperature 20 and a constant temperature time series of 10 °C. How much slower is the growth?
Troubleshooting
| Nothing happens: S and X stay constant. | X:Concentration is 0 (no cells, no growth), or the rate expression has a typo. Parameter names are case-sensitive (q_max, K_s). |
| X ends above 86 mg/L in Stage 1. | The X stoichiometric constant is 1 instead of Y, or S is not −1. |
| Growth is much faster than the checkpoints. | The solver settings are still M1's (Step 6). |
| Concentrations change in a block you did not expect. | Reactions run in every block that has the constituents: keep only the Flask. |
| Stage 3: 9 − DO does not equal the COD balance. | The DO constants are wrong: Growth must be -(1-1.42*Y) and Decay -1.42. |
| DO goes negative in Stage 3. | S or X initial values are too large for a BOD bottle (total demand \(S_0 + 1.42X_0\) must be below 9 mg/L). |
What to submit
- Your three
.ohqfiles and your own numerical solution (spreadsheet printout or code). - Stage 1: a plot of S and X with your numerical solution overlaid; a table showing \(S + X/Y\) at four times; the times for S = 100, 20 and 1 mg/L from the model and from the integrated solution; and a log-scale plot of X with the exponential limit.
- Stage 2: the peak biomass and the decay rate you read from the model.
- Stage 3: a plot of the BOD exerted (Monod and first-order) and the COD balance check at three times; BOD₅ and BOD₅/BODu (BODu = 5.71 mg/L).
- Short answers (2–4 sentences each): (a) Why does the Monod BOD curve start more slowly than the first-order curve? (b) Why does oxygen keep being consumed after the substrate is gone? (c) Your result for one Explore item, with a sentence explaining it.
Submit everything in one PDF plus the .ohq files in Brightspace → Assignments → Modeling Assignment M10.