← Module 11 · Modeling Assignment M11 (OpenHydroQual)

An activated sludge plant in OpenHydroQual: chemostat, recycle and wasting, and oxygen

An illustrated, step-by-step worked example · about 75 minutes · the latest OpenHydroQual · uses Module 11, Sections 2–4, and the reactions you built in Modules 2 and 10

What you will build

A 1000 m³ aeration tank fed 4000 m³/d of wastewater at 300 mg bCOD/L. First it runs as a chemostat. Then you add a clarifier, return sludge and waste sludge, and watch the biomass rise twentyfold and the effluent improve fifty-fold. Finally you add dissolved oxygen, aerate the tank, and check that the oxygen supplied matches the oxygen requirement of Module 11, Section 4.

StageWhat changesWhat to look forSaved as
1aeration tank, no recycle (chemostat)steady S = 43.8 mg/L, X = 99.5 mg/L at θ = 0.25 dM11_stage1_chemostat.ohq
2+ clarifier, return sludge, waste sludgeSRT ≈ 8 d: S ≈ 0.85 mg/L, X ≈ 1950 mg/LM11_stage2_recycle.ohq
3+ dissolved oxygen and aerationDO ≈ 2.1 mg/L; O₂ supplied ≈ Q(S₀ − S) − 1.42PX ≈ 840 kg/dM11_stage3_oxygen.ohq

The system

ItemValue
Aeration tank\(V = 1000\) m³, completely mixed; influent \(Q = 4000\) m³/d at \(S_0 = 300\) g bCOD/m³ (HRT \(\theta = 0.25\) d = 6 h)
Kinetics (Module 11, Section 1)\(\hat\mu = 6\) d⁻¹, \(K_s = 20\) g/m³, \(Y = 0.4\) g VSS/g bCOD, \(b = 0.12\) d⁻¹
Clarifier (Stages 2–3)upper compartment 50 m³, lower 2 m³, interface area 1000 m², biomass settling velocity 3000 m/d (an almost ideal clarifier)
Flows (Stages 2–3)tank → clarifier 6000 m³/d; return sludge \(Q_r = 2000\) m³/d (\(R = 0.5\)); waste sludge \(Q_w = 40\) m³/d; effluent 3960 m³/d
Oxygen (Stage 3)\(K_La = 120\) d⁻¹ in the aeration tank only, \(DO_{sat} = 9.09\) g/m³ (20 °C), \(K_O = 0.2\) g/m³
Simulation0 to 10 days (Stage 1), 0 to 60 days (Stages 2–3)

OpenHydroQual writes, for every block and constituent, the mass balance of Module 1 plus the reaction terms you define. A reaction you define runs in every block that contains its constituents: in the aeration tank, the clarifier compartments and the sinks. That matters in Stage 3.

1Load two plugins: Mass Transfer and Wastewater

Start a new model and add the Mass Transfer plugin as in Module 1, Step 1. Then add a second plugin, Wastewater, the same way (the list calls it Wastewater processes): it provides the Clarifier block and the Effluent flow and Sludge flow links used in Stage 2.

File menu: Preferences, Add plugin
1 File → 2 Preferences → 3 Add plugin (as in Module 1).
Select Plugin: Mass Transfer
1 Mass Transfer, 2 OK.
Select Plugin: Wastewater
Open Add plugin again and choose 1 Wastewater processes, then 2 OK.
The Wastewater plugin also offers an Activated_Sludge_Reactor block. Do not use it in this assignment: in OpenHydroQual 2.1 it has no inflow property and no bottom elevation, so it cannot receive the influent and the solver reports errors for a settling constituent. A Mass Transfer Reactor is a completely mixed tank and does the job.

2Two constituents: substrate S and biomass X

Create the substrate as a Chemical constituent (Add Objects → Chemistry, as in Module 1, Step 2) and name it S. Then create the biomass as a Solid Particle: a particle constituent has a settling velocity, so the clarifier of Stage 2 can settle it. In Stage 1 there is no clarifier and the particle simply flows with the water.

Add Objects, Chemistry menu
1 Add Objects → 2 Chemistry → 3 Chemical constituent (for S). The same menu has Solid Particle (for X), Chemical reaction and Reaction Parameter.
Particle constituent X properties
The particle constituent: 1 Name X; 2 Settling velocity 3000 m/day (pick m/day in the unit box, then type 3000). The panel then shows the value converted to m/s: 0.0347222[m/s], which is the same 3000 m/d. Leave the turbidity coefficient and exponent at 0.
Why such a large settling velocity?
Activated sludge flocs settle at a few metres per hour. OpenHydroQual's clarifier treats its upper compartment as completely mixed, which is a poor settler (Module 8: an ideal basin is closer to plug flow). To represent the near-perfect clarifier assumed in Module 11, Section 3, we give the biomass a large settling velocity: then only about 0.2 % of the mixed liquor biomass escapes in the effluent (≈ 4 mg/L, a realistic effluent VSS). In Explore you lower it and see what a poor clarifier does to the SRT.

3Reaction parameters and the two reactions

As in Modules 2 and 10, the kinetics go in Reaction Parameters and Chemical reactions. Create four reaction parameters (Add Objects → Chemistry → Reaction Parameter) and set their Value:

Reaction parameters mu_max, K_s, Y, b
1 mu_max = 6 (d⁻¹), 2 K_s = 20 (g/m³), 3 Y = 0.4, 4 b = 0.12 (d⁻¹). Leave the Arrhenius factor at 1 (no temperature correction).

Now two reactions (Add Objects → Chemistry → Chemical reaction). A reaction has a rate expression and one stoichiometric constant per constituent: the change in that constituent per unit of rate. We write both rates in units of biomass (g VSS/m³/d), so X has the constant +1 or −1:

ReactionRate ExpressionS:Stoichiometric ConstantX:Stoichiometric ConstantMeaning
Growthmu_max*S/(K_s+S)*X(0-1/Y)1each g of cells grown uses 1/Y = 2.5 g bCOD
Decayb*X0-1cells lose mass at rate bX
Growth reaction properties
Growth: 1 S:Stoichiometric Constant (0-1/Y), 2 X:Stoichiometric Constant 1, 3 Name, 4 Rate Expression.
Decay reaction properties
Decay: 1 X:Stoichiometric Constant −1, 2 Name, 3 Rate Expression b*X. S:Stoichiometric Constant stays 0.

Write a negative expression as (0-1/Y); a plain negative number can be typed directly (−1, −1.42).

4The aeration tank: a Reactor with an inflow

Add a Reactor (Module 1, Step 3) and set:

Blocks toolbar: Reactor icon
1 The Reactor icon.
Aeration tank properties
Properties of the aeration tank.
PropertyValueMeaning
1S:Concentration0initial substrate
2S:Constant Inflow concentration300 g/m³\(S_0\)
3Initial Storage1000 m³\(V\)
4X:Concentration100 g/m³initial biomass (a seed; any value above zero works)
5Constant Inflow4000 m³/day\(Q\)
6NameAeration

Leave X:Constant Inflow concentration at 0: there is no biomass in the influent, as the formulas assume. Leave Bottom elevation at 0.

5Effluent: a large Reactor and a Fixed flow

Add a second Reactor named Effluent with Initial Storage 1e+06 m³ (a sink, as the Outlet in Module 1) and Bottom elevation −10 m. Draw a Fixed flow link from Aeration to Effluent with Flow rate 4000 m³/day.

Links toolbar: Fixed flow icon
1 The Fixed flow link.
Stage 1 canvas: Aeration, link, Effluent
1 Aeration, 2 the link (4000 m³/d), 3 Effluent. In the Object Browser: 4 the constituents S and X, 5 the reactions.
Why a bottom elevation for the sink?
A particle settles from a block into a connected block that lies lower. Through a Fixed flow link the settling term is negligible (the link's area is 10⁻⁹ m²), so it makes no difference here, but setting the sinks low keeps the clarifier geometry consistent in Stage 2.

6Simulation time and time step

As in Module 1, Step 6: General Settings → Simulation end time 10 (days); Solver Settings → initial time-step 0.01 and Maximum allowable time-step increase factor 5.

Solver Settings
1 initial time-step 0.01, 2 maximum time-step increase factor 5.

Stage 1A chemostat

Save as M11_stage1_chemostat.ohq, close and press Run Model.

Run Model button
1 Run Model.

Predict the answer first (Module 11, Example 11a): with \(\theta = 0.25\) d,

\[ S = \frac{20(1 + 0.12\times0.25)}{0.25(6 - 0.12) - 1} = 43.8\ \text{g/m}^3, \qquad X = \frac{0.4(300 - 43.8)}{1 + 0.12\times0.25} = 99.5\ \text{g/m}^3. \]
Stage 1: S and X in the aeration tank
Right-click Aeration → Results → S:Concentration (left) and X:Concentration (right). Both settle within about two days, at 43.8 and 99.5 g/m³. The tank removes 85 % of the bCOD, but the effluent still has 44 mg/L and the biomass is dilute.

Stage 2Clarifier, return sludge and waste sludge

Save a copy as M11_stage2_recycle.ohq. Delete the link Aeration → Effluent (select it, press Delete). Change the Aeration tank's X:Concentration to 1500 g/m³ (a closer starting point, so the run is shorter) and the end time to 60 days.

2a · The clarifier

Click the Clarifier icon in the Blocks toolbar (it appears once the Wastewater plugin is loaded). The Clarifier is a composite block: it creates two settling compartments, Upper and Lower, joined by an interface through which the biomass settles and the underflow passes. On the canvas it is a single Clarifier icon; the Object Browser lists its members Clarifier__Lower, Clarifier__Upper and Clarifier__interface.

Blocks toolbar: Clarifier icon
1 The Clarifier icon.
Clarifier properties
Clarifier properties.
PropertyValueMeaning
1Elevation of the clarifier floor−1 mbottom of the lower compartment
2Elevation of the interface between the two compartments0 mbottom of the upper compartment
3Initial volume of water in the lower compartment2 m³kept small: biomass held here also reacts
4NameClarifier
5Cross-sectional area of the compartment interface1000 m²plan area over which solids settle
6Flow drawn from the upper into the lower compartment2040 m³/dayunderflow = \(Q_r + Q_w\)
7Initial volume of water in the upper compartment50 m³

Add a third large Reactor, Waste (1e+06 m³, bottom elevation −10 m), below the Effluent sink.

2b · Four links

The Wastewater plugin adds two link types that behave like a Fixed flow but attach to the right compartment: an Effluent flow leaves the upper compartment and a Sludge flow leaves the lower one. Draw:

Links toolbar: Effluent flow and Sludge flow icons
1 Effluent flow, 2 Sludge flow.
LinkTypeFrom → ToFlow rate (m³/day)
Aeration - ClarifierFixed flowAeration → Clarifier6000 (\(Q + Q_r\))
EffluentEffluent flowClarifier → Effluent3960 (\(Q - Q_w\))
Return sludgeSludge flowClarifier → Aeration2000 (\(Q_r\))
Waste sludgeSludge flowClarifier → Waste40 (\(Q_w\))
Stage 2 canvas
1 Aeration, 2 Clarifier (one icon; the Object Browser shows its members Clarifier__Lower, Clarifier__Upper and Clarifier__interface), 3 Effluent, 4 Waste, 5 the return sludge line back to the aeration tank.
Waste sludge link properties
The waste sludge link: 1 Flow rate 40 m³/day, 2 Name Waste sludge. This one number sets the SRT.

Check the water balance before you run: the aeration tank gets 4000 + 2000 and sends 6000; the clarifier gets 6000 and sends 3960 + 2000 + 40. Predict the SRT for an ideal clarifier (\(X_e = 0\)) with Module 11, Section 3:

\[ X_r = X\frac{Q + Q_r}{Q_r + Q_w} = 2.94X, \qquad \theta_x = \frac{VX}{Q_wX_r} = \frac{1000}{40 \times 2.94} = 8.5\ \text{d}. \]
Stage 2: biomass in the aeration tank and clarifier underflow
Left: Aeration X:Concentration rises from 1500 to 1945 g/m³. Right: right-click the Clarifier → Results → Lower → X:Concentration (the underflow, \(X_r\)); it settles at about 5710 g/m³, 2.94 times X. The approach takes about 20 days: the biomass responds on the time scale of the SRT, not the HRT.
Stage 2: substrate in the aeration tank
Left: Aeration S:Concentration falls to 0.854 g/m³, fifty times lower than the chemostat. Right: Clarifier → Results → Upper → X:Concentration (the effluent solids \(X_e\)) is about 3.9 g/m³.

2c · Compute the actual SRT from your results

Effluent solids are wasting too. With your day-60 values of X, \(X_r\) and \(X_e\):

\[ \theta_x = \frac{VX}{Q_wX_r + (Q - Q_w)X_e} = \frac{1000(1945)}{40(5713) + 3960(3.88)} = 8.0\ \text{d}. \]

Now compute S and X with the Lawrence–McCarty equations at \(\theta_x = 8.0\) d and compare with the model (Checkpoints).

Stage 3Dissolved oxygen and aeration

Save a copy as M11_stage3_oxygen.ohq.

3a · A new constituent and an aeration source

Add DO, a Chemical constituent (dissolved oxygen, g/m³). Then add the aeration itself as a source, the same one you used for gas transfer in Module 7: Add Objects → Sources → Atmospheric Exchange. Rename it Diffusers and set Rate coefficient 120 1/day (\(K_La\)) and Saturation Concentration Level 9.09 g/m³ (\(DO_{sat}\) at 20 °C). A source acts only in the blocks that name it, so the clarifier and the sinks stay unaerated.

Atmospheric Exchange source named Diffusers
1 Add Objects → Sources → Atmospheric Exchange; 2 its properties: name Diffusers, Rate coefficient 120, Saturation 9.09.
What the source computes. For each block that uses it, the Atmospheric Exchange source adds \(V K_La (DO_{sat} - DO)\) g/day of oxygen: the aeration term of Module 11, Section 4 (and the gas-transfer flux of Module 7).

3b · Parameters and reactions

Add one reaction parameter, K_O = 0.2. Then edit the two reactions:

ReactionRate ExpressionSXDO
Growthmu_max*S/(K_s+S)*DO/(K_O+DO)*X(0-1/Y)1(1.42-1/Y)
Decayb*DO/(K_O+DO)*X0-1-1.42

The DO coefficients are the oxygen bookkeeping of Module 11, Section 4: growing 1 g of cells consumes \(1/Y = 2.5\) g bCOD, of which 1.42 g ends up in the cells, so \(2.5 - 1.42 = 1.08\) g O₂ is used; decaying 1 g of cells uses 1.42 g O₂. The factor \(DO/(K_O + DO)\) slows both reactions when oxygen runs low, which is what keeps DO from going negative in the clarifier, where there is no aeration.

Growth reaction with oxygen
Growth: 1 DO:Stoichiometric Constant (1.42-1/Y), 2 Rate Expression with the oxygen factor.
Type the decay coefficient for DO as the plain number -1.42.

3c · Aerate the aeration tank

Aeration tank properties in Stage 3
Aeration tank: 1 DO:Concentration 2 (initial), 2 DO:External source Diffusers (double-click the value cell and pick Diffusers from the drop-down). Every other block leaves DO:External source empty, so oxygen is added only here.

Predict before you run. The oxygen requirement at \(\theta_x = 8\) d is about \(Q(S_0 - S) - 1.42P_X \approx 1197 - 1.42(250) \approx 840\) kg O₂/d, and \(K_La = 120\) d⁻¹ supplies \(120 \times 1000 \times (9.09 - DO)\) g/d, so DO should settle near \(9.09 - 840{,}000/120{,}000 = 2.1\) g/m³.

Stage 3: DO in the aeration tank and in the clarifier
Left: Aeration DO:Concentration rises within hours from the initial 2 to about 2.7 g/m³, then falls to 2.07 g/m³ as the biomass builds up. Right: Clarifier → Results → Lower → DO:Concentration falls to about 0.9 g/m³ (0.94 at day 60): the settled sludge keeps respiring with no aeration.

Check the oxygen balance with your day-60 results: the oxygen transferred is \(K_LaV(DO_{sat} - DO)\), and with \(P_X = Q_wX_r + (Q - Q_w)X_e\) the requirement is \(Q(S_0 - S) - 1.42P_X\). Then check S and X: at DO = 2.07 the oxygen factor is \(f = 2.07/2.27 = 0.912\), so use \(f\hat\mu\) and \(fb\) in the Lawrence–McCarty equations.

Checkpoints

Read these from your own runs; small differences in the last digit are normal. The formulas assume no reaction in the clarifier; the model's small clarifier holds about 1 % of the biomass, which explains the remaining 0.5 % differences.

StageQuantityModelFormula
1Aeration S at 1 / 2 / 10 days (g/m³)45.04 / 43.86 / 43.8343.83 (steady)
1Aeration X at 1 / 2 / 10 days (g/m³)98.63 / 99.47 / 99.4899.48 (steady)
2X / Xr / Xe at 60 days (g/m³)1945 / 5713 / 3.88Xr/X: 2.937 (ideal 2.941)
2SRT (d)8.02 (from the model's X, Xr, Xe)8.50 if Xe = 0
2Aeration S at 60 days (g/m³)0.8540.850 at SRT = 8.02 d
2Aeration X at 60 days (g/m³)19451957 at SRT = 8.02 d
2Sludge production PX (kg VSS/d)243.9243.9
3Aeration DO at 60 days (g/m³)2.07≈ 2.1 (prediction)
3Aeration S / X at 60 days (g/m³)0.898 / 20330.894 / 2045 (with f = 0.912)
3O₂ transferred / required (kg/d)842.7834.4 + 10.5 carried out as DO

Explore

Save a copy with File → Save as and change one thing at a time.

Troubleshooting

No Clarifier icon, or no Effluent flow / Sludge flow links.The Wastewater plugin is not loaded (Step 1).
X falls to zero in Stage 2.X was created as a Chemical constituent instead of a Solid Particle, so it does not settle and the plant runs as a chemostat with a tiny HRT. Or the settling velocity is too small: the panel should show 0.0347222[m/s], which is 3000 m/day.
The clarifier fills up or empties.Flows do not balance: the underflow must equal return + waste (2040), and the clarifier's inflow (6000) must equal effluent + underflow (3960 + 2040).
S and X look right but DO goes negative somewhere.The oxygen factor \(DO/(K_O + DO)\) is missing from one of the rate expressions.
DO is far above 2 g/m³ in Stage 3.Check the DO stoichiometric constants: growth (1.42-1/Y), decay -1.42.
The clarifier and sinks are aerated too.Their DO:External source is set to Diffusers; only the aeration tank should name it.

What to submit