What you will build
An aerated reactor with attached nitrifiers that turn ammonium into nitrate in two steps; an anoxic reactor after it where heterotrophs, fed methanol, use the leftover oxygen first and then the nitrate; and a sediment column in which oxygen, nitrate and sulfate are used one after another with depth. Every process is a Monod rate multiplied by switching functions: \(A/(K + A)\) to turn a process on, \(K_I/(K_I + A)\) to turn it off.
| Stage | What it is | What to look for | Saved as |
|---|---|---|---|
| 1 | aerated reactor: ammonification, AOB and NOB (attached), oxygen and alkalinity | NH₄⁺ and NO₂⁻ fall to the nitrifiers' Smin (0.116 and 0.041 mg N/L); O₂ = 4.57 g/g N; alkalinity −7.14 g/g N | M13_stage1_nitrification.ohq |
| 2 | + anoxic reactor with a methanol dose; heterotrophs use O₂ first, nitrate when O₂ is low | COD falls to the heterotrophs' Smin; nitrate removed to 3.6 mg N/L because the carbon dose is short | M13_stage2_denitrification.ohq |
| 3 | sediment: 40 layers of 0.25 mm under oxygenated water; O₂ → NO₃⁻ → SO₄²⁻ | oxic zone 2.5 mm, nitrate zone 1.1 mm (Example 13b); sulfide below | M13_stage3_sediment_redox.ohq |
The transformations
The flow chart shows every transformation the model carries, which reactor it happens in, and what controls it. Each arrow is one reaction you will create; the numbers are the stoichiometry per g of N (Module 13, Sections 2–4).
The system
| Item | Value |
|---|---|
| Influent (Stages 1–2) | 2000 m³/d with 8 mg/L organic N, 30 mg/L NH₄⁺-N, 250 mg/L alkalinity as CaCO₃, no DO |
| Aerobic reactor | 500 m³ (6 h); \(k_{am} = 4\) d⁻¹; \(K_La = 100\) d⁻¹, \(DO_{sat} = 9.09\) mg/L |
| AOB | \(\hat\mu = 0.9\) d⁻¹, \(K_{NH} = 0.5\) mg N/L, \(K_O = 0.5\) mg/L, \(Y = 0.15\) g VSS/g N, \(b = 0.17\) d⁻¹; seed 5 g/m³ |
| NOB | \(\hat\mu = 1.0\) d⁻¹, \(K_{NO_2} = 0.2\) mg N/L, \(K_O = 0.9\) mg/L, \(Y = 0.05\), \(b = 0.17\) d⁻¹; seed 2 g/m³ |
| Anoxic reactor (Stage 2) | 250 m³; methanol dose 10 m³/d at 18,000 mg COD/L (180 kg COD/d); heterotrophs \(\hat q = 10\) g COD/(g VSS·d), \(K_C = 20\) mg/L, \(Y = 0.3\), \(b = 0.1\) d⁻¹, \(K_{OH} = K_I = 0.2\) mg/L, \(K_{NO_3} = 0.5\) mg N/L |
| Sediment (Stage 3) | overlying water 8 mg/L O₂, 3 mg/L NO₃⁻-N, 5 mg/L SO₄²⁻-S; 40 layers × 0.25 mm; \(D = 10^{-4}\) m²/d; \(R = 250\) g COD/(m³·d); all \(K\) = 0.05 mg/L except \(K_S = 0.2\) |
Build: 1 Constituents 2 Parameters 3 Reactions 4 Aerobic reactor 5 Settings
Stages: 1 Nitrification 2 Denitrification 3 Sediment redox zones Checkpoints Explore Troubleshooting What to submit
1Plugin and constituents
Start a new model with the Mass Transfer plugin (Module 1, Step 1). Create six Chemical constituents: ON, NH4, NO2, NO3 (all in g N/m³), Alk (alkalinity, g CaCO₃/m³) and DO. Then two Immobile constituents: XA (attached AOB) and XN (attached NOB).
Alkalinity is just another constituent here: the reactions add or remove it with the stoichiometry of Module 13. OpenHydroQual does not compute pH.
2Reaction parameters
Create the parameters (Add Objects → Chemistry → Reaction Parameter): k_am = 4; AOB mu_A = 0.9, K_NH = 0.5, K_OA = 0.5, Y_A = 0.15, b_A = 0.17; NOB mu_N = 1, K_NO2 = 0.2, K_ON = 0.9, Y_N = 0.05, b_N = 0.17.
Then add the aeration as a source, as in Modules 7 and 11: Add Objects → Sources → Atmospheric Exchange, named Aeration, with Rate coefficient 100 1/day (\(K_La\)) and Saturation Concentration Level 9.09 g/m³ (\(DO_{sat}\)). It adds \(V K_La (DO_{sat} - DO)\) g/day to every block whose DO uses it.
3Five reactions with switching functions
Growth rates are written per g of N oxidized (so NH₄⁺ or NO₂⁻ has −1), decay rates per g of biomass. The oxygen factor \(DO/(K_O + DO)\) multiplies both growth and decay, so with no oxygen the nitrifiers neither grow nor respire.
| Reaction | Rate Expression | Stoichiometric constants |
|---|---|---|
| Ammonification | k_am*ON | ON −1, NH4 +1, Alk +3.57 |
| AOB growth | mu_A/Y_A*NH4/(K_NH+NH4)*DO/(K_OA+DO)*XA | NH4 −1, NO2 +1, XA +0.15, DO −3.217, Alk −7.14 |
| AOB decay | b_A*DO/(K_OA+DO)*XA | XA −1, DO −1.42 |
| NOB growth | mu_N/Y_N*NO2/(K_NO2+NO2)*DO/(K_ON+DO)*XN | NO2 −1, NO3 +1, XN +0.05, DO −1.069 |
| NOB decay | b_N*DO/(K_ON+DO)*XN | XN −1, DO −1.42 |
Where do −3.217 and −1.069 come from? Oxidizing 1 g of NH₄⁺-N to nitrite needs 3.43 g O₂ (Module 13, Section 3), but the electrons that go into the \(Y_A = 0.15\) g of new cells (1.42 g COD per g VSS) do not reach oxygen: \(3.43 - 1.42(0.15) = 3.217\). For NOB, \(1.14 - 1.42(0.05) = 1.069\). When the cells later decay, they use the remaining 1.42 g O₂ per g. At steady state every gram of biomass grown also decays, so the total is back to 3.43 + 1.14 = 4.57 g O₂ per g N.


4The aerobic reactor and the effluent
Add a Reactor Aerobic and a large Reactor Effluent (1e+07 m³), joined by a Fixed flow of 2000 m³/day.

| Property | Value | Meaning | |
|---|---|---|---|
| 1 | Alk:Concentration / Alk:Constant Inflow concentration | 250 / 250 | starts at the influent alkalinity |
| 2 | DO:Concentration | 2 | initial DO |
| 3 | DO:External source | Aeration | aerated (double-click the value cell and pick Aeration) |
| 4 | NH4:Constant Inflow concentration | 30 | influent ammonium |
| 5 | ON:Constant Inflow concentration | 8 | influent organic N |
| 6 | Initial Storage | 500 m³ | 6 h at 2000 m³/d |
| 7 | XA:Concentration per volume of water / XN:Concentration per volume of water | 5 / 2 | seeds of attached nitrifiers |
| 8 | Constant Inflow | 2000 m³/day | Q |
| 9 | Name | Aerobic |
5Settings
Simulation end time 100 days; initial time-step 0.01; maximum time-step increase factor 5 (Module 1, Step 6).

Stage 1Nitrification
Save as M13_stage1_nitrification.ohq and run. Predict first. The nitrifiers are attached, so (Module 12, Section 4) each population grows until its substrate falls to its Smin; because the oxygen factor multiplies growth and decay alike, Smin does not depend on DO:
Everything else follows from mass balances: nitrate is what is left of the 38 mg/L TN, and oxygen and alkalinity follow from the 4.57, 7.14 and 3.57 of Module 13.
Check the oxygen: at steady state \(K_LaV(DO_{sat} - DO) = O_2 \text{ used} + Q\cdot DO\), with O₂ used \(= 3.43 \times\) (NH₄⁺ oxidized) \(+ 1.14 \times\) (NO₂⁻ oxidized) = 309.6 kg/d, i.e. 4.57 g per g of nitrate formed (plus 3.43 for the little nitrite left).
Stage 2Denitrification in an anoxic reactor
Save a copy as M13_stage2_denitrification.ohq. Add Chemical constituents COD (methanol, as COD) and N2 (to close the nitrogen balance), and an Immobile constituent XH (attached heterotrophs). Add the parameters q_H = 10, K_C = 20, Y_H = 0.3, b_H = 0.1, K_OH = 0.2, K_NO3 = 0.5, K_I = 0.2, and four reactions:
| Reaction | Rate Expression | Stoichiometric constants |
|---|---|---|
| Aerobic growth | q_H*COD/(K_C+COD)*DO/(K_OH+DO)*XH | COD −1, XH +0.3, DO −0.574 |
| Anoxic growth | q_H*COD/(K_C+COD)*NO3/(K_NO3+NO3)*K_I/(K_I+DO)*XH | COD −1, XH +0.3, NO3 −0.2007, N2 +0.2007, Alk +0.7165 |
| Aerobic decay | b_H*DO/(K_OH+DO)*XH | XH −1, DO −1.42 |
| Anoxic decay | b_H*NO3/(K_NO3+NO3)*K_I/(K_I+DO)*XH | XH −1, NO3 −0.4965, N2 +0.4965, Alk +1.7725 |
The coefficients are the electron bookkeeping of Module 13, Section 4. Of each g of COD used for growth, \(1.42 \times 0.3 = 0.426\) g goes into cells and \(0.574\) g to the acceptor: 0.574 g O₂, or \(0.574/2.86 = 0.2007\) g NO₃⁻-N, which returns \(3.57 \times 0.2007 = 0.7165\) g alkalinity. Decay passes 1.42 g per g VSS: 1.42 g O₂ or \(1.42/2.86 = 0.4965\) g NO₃⁻-N.
Add a Reactor Anoxic: Initial Storage 250 m³, Constant Inflow 10 m³/day with COD:Constant Inflow concentration 18000 (the methanol dose, 180 kg COD/d), XH:Concentration 5, Alk:Concentration 250, and leave DO:External source empty (no aeration). Replace the link Aerobic → Effluent by Aerobic → Anoxic (2000 m³/day) and Anoxic → Effluent (2010 m³/day). End time 200 days.
Predict: with growth and decay switched by the same acceptor factors, the attached heterotrophs bring COD down to their Smin, \(K_Cb_H/(Y_H\hat q_H - b_H) = 20(0.1)/(3 - 0.1) = 0.69\) mg/L. Since no biomass leaves, all the COD used ends on an acceptor (Module 13, Example 13g): \(180 - 1.4 = 178.6\) kg/d is used, 5.6 kg/d by the incoming oxygen and the rest, 173.0 kg/d, by nitrate: \(173.0/2.86 = 60.5\) kg N/d of the 67.7 kg N/d that arrives. The effluent keeps about 3.6 mg/L NO₃⁻-N.
Stage 3Redox zones in a sediment
Start a new model (Mass Transfer plugin), saved as M13_stage3_sediment_redox.ohq. This is Module 12's layered biofilm turned into a sediment: thin porewater layers that exchange solutes only by diffusion, now with three acceptors used in sequence.
- Chemical constituents DO, NO3, N2, SO4 (as S) and H2S (as S), each with Diffusion Coefficient 1e-04 m²/day (choose m^2/day first).
- Immobile constituent OM: a marker for decomposable organic matter, 1 in the sediment layers, 0 in the water.
- Parameters R_max = 250, K_O = 0.05, K_N = 0.05, K_S = 0.2, K_IO = 0.05, K_IN = 0.05.
| Reaction | Rate Expression (g COD/(m³·d)) | Stoichiometric constants |
|---|---|---|
| Aerobic respiration | R_max*OM*DO/(K_O+DO) | DO −1 |
| Denitrification | R_max*OM*NO3/(K_N+NO3)*K_IO/(K_IO+DO) | NO3 −0.3497, N2 +0.3497 |
| Sulfate reduction | R_max*OM*SO4/(K_S+SO4)*K_IO/(K_IO+DO)*K_IN/(K_IN+NO3) | SO4 −0.5, H2S +0.5 |
Each rate is the COD oxidized; the constants convert it to the acceptor: 1 g O₂, \(1/2.86 = 0.3497\) g NO₃⁻-N, or \(1/2 = 0.5\) g SO₄²⁻-S per g COD. Sulfate reduction is switched off by both oxygen and nitrate: the redox ladder written as a product of inhibition factors.
Add a Reactor Water with Initial Storage 1e+09 m³, DO 8, NO3 3, SO4 5 (it stays constant). Use Create 2D Array (Module 12, Stage 2c) for 40 × 1 Reactors named Sediment: Initial Storage 2.5 m³ (10,000 m² × 0.25 mm), OM:Concentration 1, joined by Time-Dependent flow links with area 10000 m² and length 0.00025 m. Then a Time-Dependent flow link Water → Sediment(1:1) with area 10000 and length 0.000125 m (half a layer: no boundary layer this time). End time 3 days.
Predict with Module 13, Example 13b: oxygen penetrates \(z_O = \sqrt{2DC_0/R} = 2.53\) mm (about 10 layers) with a flux of 0.632 g/(m²·d); nitrate is used in the next 1.11 mm with a flux of 0.097 g N/(m²·d); sulfate below 3.6 mm. The run takes a few minutes: diffusion over 10 mm needs about a day to settle (\(L^2/D = 1\) d).
The fluxes into the sediment are the Mass transfer rate of each constituent through the Water → Sediment(1:1) link divided by 10,000 m².
Checkpoints
Read these from your own runs; small differences in the last digit are normal.
| Stage | Quantity | Model | Formula |
|---|---|---|---|
| 1 | Aerobic ON / NH4 / NO2 / NO3 at 100 d (mg N/L) | 4.000 / 0.1164 / 0.0410 / 33.843 | 4.000 / 0.1164 / 0.0410 / 33.843 |
| 1 | Aerobic DO / Alk at 100 d | 2.787 / 22.35 | 2.787 / 22.35 |
| 1 | XA / XN at 100 d (g/m³) | 141.05 / 52.67 | 141.0 / 52.7 |
| 2 | Anoxic COD / NO3 at 200 d (mg/L) | 0.690 / 3.571 | 0.690 / 3.571 |
| 2 | Anoxic DO / NH4 / Alk at 200 d | 0.0056 / 1.438 / 134.43 | 0.0056 / 1.438 / 134.43 |
| 2 | nitrogen balance in / out incl. N₂ (kg N/d) | 76.000 in = 76.000 out (ON + NH₄⁺ + NO₂⁻ + NO₃⁻ + N₂) | |
| 3 | O₂ flux into the sediment (g/(m²·d)) | 0.622 | 0.632 (zero-order zone) |
| 3 | NO₃⁻ flux into the sediment (g N/(m²·d)) | 0.0972 | 0.0972 |
| 3 | SO₄²⁻ flux / H₂S flux out (g S/(m²·d)) | 0.1188 / 0.1187 | 0.121 / equal at steady state |
The Stage 3 formulas treat each zone as exactly zero order with sharp boundaries; the model's half-saturation constants and 0.25 mm layers round the corners, which accounts for the 1–2 % differences.
Explore
- Low DO. In Stage 1, set the Aeration source's Rate coefficient to 25 d⁻¹. The DO drops, the nitrifiers' oxygen factor falls, and they need more biomass; does the effluent ammonium change? Why not (look at Smin)? Now try 12 d⁻¹.
- Cold weather. In Stage 1, set the Arrhenius factor of mu_A to 1.072 and of b_A to 1.04 with a temperature of 10 °C (or simply set mu_A = 0.449 and b_A = 0.115). Compare the time it takes to start nitrifying.
- Enough carbon. In Stage 2, raise the methanol concentration to 20,000 and then 24,000 mg/L. When does nitrate stop falling and COD start to appear in the effluent?
- Oxygen leak. In Stage 2, create a second Atmospheric Exchange source with Rate coefficient 20 d⁻¹ and set it as the anoxic reactor's DO:External source (a little aeration). How much does the denitrification suffer?
- A richer sediment. In Stage 3, double R_max. Predict the new oxygen penetration depth (by \(1/\sqrt2\)) and check it. Then set the water's DO to 0: what happens to the nitrate flux (PS13, Problem 6)?
Troubleshooting
| Stage 1: ammonium never falls. | XA was created as a Chemical constituent (it washes out), its seed is 0, or the aerobic reactor's DO:External source is not set to Aeration (no oxygen). |
| Stage 1: DO is too high and alkalinity does not drop. | A stoichiometric constant typed as an expression like (0-7.14); type the number. |
| Stage 2: no denitrification. | The anoxic reactor is aerated (its DO:External source must be empty), or the DO inhibition factor is written DO/(K_I+DO) instead of K_I/(K_I+DO). |
| Stage 2: the anoxic reactor overflows or empties. | Its outflow must be 2010 m³/d: 2000 from the aerobic tank plus the 10 m³/d methanol stream. |
| Stage 3: all layers stay at the water's concentrations. | OM:Concentration is 0 in the layers, or the link areas were left at 1e-09 m² (no diffusion). |
| Stage 3: the run is very slow. | That is normal for 40 layers and six constituents (a few minutes). Check that the maximum time-step increase factor is 5, not 1. |
What to submit
- Your three
.ohqfiles. - Stage 1: plots of the N species, DO, alkalinity and biomass; a table comparing the steady state with the formulas; the oxygen balance in g O₂ per g N.
- Stage 2: plots of nitrate, COD and DO in the anoxic reactor; the COD budget (dose, O₂, nitrate) and the nitrogen balance including N₂.
- Stage 3: profiles of DO, NO₃⁻, SO₄²⁻ and H₂S against depth (all 40 layers), with the zone boundaries and fluxes of Example 13b marked.
- Short answers (2–4 sentences each): (a) Why does the effluent ammonium of Stage 1 not depend on the DO, while the nitrifier biomass does? (b) What limits nitrate removal in Stage 2, and how would you find the dose that removes nitrate to 1 mg/L? (c) In Stage 3, where would sulfide be oxidized in a real sediment, and which process is missing from the model?
Submit everything in one PDF plus the .ohq files in Brightspace → Assignments → Modeling Assignment M13.