← Module 10 · Modeling Assignment M10 (OpenHydroQual)

Batch microbial growth: Monod kinetics, decay and oxygen demand

An illustrated, step-by-step worked example · about 60 minutes · the latest OpenHydroQual · uses Module 10, Sections 2–5, and the Module 1 guide

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.

StageWhat changesWhat to look forSaved as
1Monod 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 daysM10_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
3a BOD bottle: + dissolved oxygen, + a first-order BOD model\(DO_0 - DO = (S_0 - S) + 1.42(X_0 - X)\); BOD₅ = 3.00 mg/LM10_stage3_bod_bottle.ohq

The system

ItemValue
Flaska 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).

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).

File menu: Preferences, Add plugin
1 File → 2 Preferences → 3 Add plugin.
Select Plugin: Mass Transfer
1 Mass Transfer, then 2 OK.

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).

Add Objects, Chemistry, Chemical constituent
1 Add Objects → 2 Chemistry → 3 Chemical constituent. The same menu has Chemical reaction and Reaction Parameter, used next.

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:

NameValueMeaning
q_max10maximum specific substrate-utilization rate, g COD/(g VSS·day)
K_s20half-saturation constant, mg COD/L
Y0.42true yield, g VSS/g COD (Module 10, Example 2a: \(f_s \approx 0.6\))
Reaction parameters list and q_max properties
The Reaction Parameters in the Object Browser and the properties of q_max: 1 Value 10, 2 Name (the GUI lists Value before Name).

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:

Growth reaction properties
Properties of the Growth reaction.
PropertyValueMeaning
1S:Stoichiometric Constant−11 g of substrate COD is used
2X:Stoichiometric ConstantY\(Y\) g of cells are made (a parameter name is allowed here)
3NameGrowth
4Rate Expressionq_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

Blocks toolbar: Reactor icon
1 The Reactor icon.

Add one Reactor named Flask. No outlet and no links are needed: a batch reactor exchanges nothing with its surroundings.

Flask properties
1 S:Concentration 200, 2 Initial Storage 1 m³, 3 X:Concentration 2, 4 Constant Inflow 0, 5 Name Flask. These are the initial values \(S_0\) and \(X_0\); leave the inflow concentrations at 0.
The canvas with one Flask block
1 The whole model is one block.

6Simulation time and a fixed, small time step

General Settings: end time 2
General Settings: 1 Simulation end time 2 days (Stage 2: 8; Stage 3: 20).
Solver Settings
Solver Settings: 1 initial time-step 0.001, 2 maximum time-step increase factor 1 (the step then stays at 0.001 day).
Why not the M1 settings? OpenHydroQual's solver is implicit: over each step it evaluates the rates at the end of the step. For a population doubling every 4–5 hours, a step of 0.05 day (what the M1 settings reach) makes growth run far ahead: with the M1 settings the biomass is 20 % too high at half a day. With a fixed step of 0.001 day it is within 0.5 %. Try it in Explore: it is a good lesson in checking a model against a numerical solution you trust.

Stage 1Monod growth

Save as M10_stage1_monod_growth.ohq and run.

Run Model button
1 Run Model.
Running Model window
Close the run window when it says Finished! (2000 steps take a few seconds).
Right-click Flask, Results, X:Concentration
Right-click Flask → 1 Results → 2 X:Concentration (then S:Concentration).
Substrate falling and biomass rising in the flask
Left: S falls slowly at first (173 mg/L at half a day), then drops to zero just after 1 day. Right: X grows exponentially, then levels at 86 mg/L.

Check three exact results from Module 10, Section 4:

Stage 2Endogenous decay

Save a copy as M10_stage2_decay.ohq. Add a parameter b = 0.1 and a second reaction:

Decay reaction properties
1 S:Stoichiometric Constant 0, 2 X:Stoichiometric Constant −1, 3 Name Decay, 4 Rate Expression 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).

Biomass with decay: peak and exponential decline
X peaks at 82.6 mg/L at about 1.15 days (lower than 86, because cells decay while others grow), then falls to 41.7 mg/L at 8 days. Between days 4 and 8, \(\ln(X_4/X_8)/4 = 0.100\) day⁻¹ \(= b\): the decay phase.

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:

  1. Add two Chemical constituents, DO (dissolved oxygen) and L (BOD remaining in the first-order model).
  2. 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.
  3. Add a parameter k_1 = 0.162 and a reaction First_order_BOD with rate k_1*L and L:Stoichiometric Constant −1 (all others 0).
  4. Flask initial values: S = 5, X = 0.5, DO = 9, L = 5.21. End time 20 days.
Growth reaction with the DO stoichiometric constant
Growth in Stage 3: 1 DO:Stoichiometric Constant -(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.
Flask initial values in Stage 3
Flask: 1 DO 9, 2 L 5.21, 3 S 5, 4 X 0.5.

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.

Oxygen consumed in the BOD bottle and the first-order model
Plot Flask DO and L. The BOD exerted is \(9 - DO\) (Monod model) and \(5.21 - L\) (first-order model). The Monod curve starts more slowly (the seed must grow), exerts 3.00 mg/L by day 5, and keeps rising slowly as the biomass decays, toward the ultimate demand \(S_0 + 1.42X_0 = 5.71\) mg/L.

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:

# 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).

StageQuantityModelExact / RK4
1X at 0.5 / 0.75 / 1.0 days (mg/L)13.42 / 33.97 / 76.2513.37 / 33.80 / 75.97 (RK4)
1S at 0.5 / 1.0 days (mg/L)172.8 / 23.2172.9 / 23.9 (RK4)
1Time at which S = 100 / 20 / 1 mg/L (days)0.822 / 1.008 / 1.1040.824 / 1.010 / 1.105 (integrated)
1Final X; S + X/Y (mg/L)86.00; 204.7686.00; 204.76
2X at 1 / 2 / 8 days (mg/L)70.62 / 76.02 / 41.7270.34 / 76.03 / 41.73 (RK4)
2Decline rate ln(X₄/X₈)/4 (day⁻¹)0.1000\(b\) = 0.1
3BOD = 9 − DO at 2 / 5 / 10 / 20 days (mg/L)1.420 / 2.996 / 4.094 / 5.1161.420 / 2.996 / 4.094 / 5.116 (RK4)
3COD balance (5 − S) + 1.42(0.5 − X) at the same times1.420 / 2.996 / 4.094 / 5.116equal to 9 − DO (exact)
3First-order 5.21 − L at 5 / 10 / 20 days (mg/L)2.892 / 4.179 / 5.0062.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.

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