← Module 13 · Modeling Assignment M13 (OpenHydroQual)

Nitrification, denitrification and redox zones in OpenHydroQual

An illustrated, step-by-step worked example · about 90 minutes · the latest OpenHydroQual · uses Module 13, Sections 1–5, the aeration source of Modules 7 and 11 and the attached biomass and diffusion layers of Module 12

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.

StageWhat it isWhat to look forSaved as
1aerated reactor: ammonification, AOB and NOB (attached), oxygen and alkalinityNH₄⁺ 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 NM13_stage1_nitrification.ohq
2+ anoxic reactor with a methanol dose; heterotrophs use O₂ first, nitrate when O₂ is lowCOD falls to the heterotrophs' Smin; nitrate removed to 3.6 mg N/L because the carbon dose is shortM13_stage2_denitrification.ohq
3sediment: 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 belowM13_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).

Aerobic reactor (Stages 1–2): aerated, attached nitrifiersAnoxic reactor (Stage 2): no aerationONorganic NNH₄⁺ammoniumNO₂⁻nitriteNO₃⁻nitrateammonificationk_am·ON+3.57 AlkAOB growth (X_A)uses 3.22 O₂−7.14 AlkNOB growth (X_N)uses 1.07 O₂X_Aattached AOBX_Nattached NOBdecay uses 1.42 O₂decay uses 1.42 O₂DOfrom the Aeration sourceK_La V (DO_sat − DO)Every nitrifier rate is multiplied by DO/(K_O + DO): no oxygen, no nitrification.flowNO₃⁻nitrateN₂gas, leavesdenitrification(X_H) × K_I/(K_I + DO)+3.57 Alk per g NCODmethanol doseX_Hheterotrophselectron donorleftover O₂ is used first (aerobic growth)
Stages 1–2. Nitrogen moves left to right: ammonification, then the two nitrification steps in the aerated reactor; the nitrate flows on to the anoxic reactor, where heterotrophs fed methanol reduce it to N₂ gas. Dashed arrows: what each reaction grows or needs.
Stage 3: a sediment under oxygenated water (40 layers of 0.25 mm; diffusion only)overlying wateroxic0 – 2.5 mmnitrate zone2.5 – 3.6 mmsulfate zone3.6 – 4.6 mmsulfide belowdepthOM + O₂ → CO₂ + H₂Oaerobic respiration, R·OM·O₂/(K_O + O₂)used first: the most energyOM + NO₃⁻ → N₂denitrification, × K_IO/(K_IO + O₂)starts only where O₂ is nearly goneOM + SO₄²⁻ → H₂Ssulfate reduction, × K_IO/(K_IO + O₂) × K_IN/(K_IN + NO₃⁻)only where O₂ and NO₃⁻ are both goneO₂, NO₃⁻ and SO₄²⁻ diffuse down from the water; H₂S diffuses up. OM marks the organic matter (an immobile constituent).
Stage 3. Microbes oxidize the organic matter with the best electron acceptor available, so going down into the sediment oxygen is used first, then nitrate, then sulfate: the redox ladder of Module 13, Section 5. The zone depths are the model results.

The system

ItemValue
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 reactor500 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\)

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

Object Browser with the constituents of Stage 1
The Object Browser after Step 1: 1 the six mobile constituents and 2 the two immobile ones.

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.

Reaction parameters list
The eleven reaction parameters and the Aeration source in the Object Browser.

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.

ReactionRate ExpressionStoichiometric constants
Ammonificationk_am*ONON −1, NH4 +1, Alk +3.57
AOB growthmu_A/Y_A*NH4/(K_NH+NH4)*DO/(K_OA+DO)*XANH4 −1, NO2 +1, XA +0.15, DO −3.217, Alk −7.14
AOB decayb_A*DO/(K_OA+DO)*XAXA −1, DO −1.42
NOB growthmu_N/Y_N*NO2/(K_NO2+NO2)*DO/(K_ON+DO)*XNNO2 −1, NO3 +1, XN +0.05, DO −1.069
NOB decayb_N*DO/(K_ON+DO)*XNXN −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.

AOB growth reaction
AOB growth: 1 Alk −7.14, 2 DO −3.217, 3 NH4 −1, 4 NO2 +1, 5 XA +0.15, 6 Rate Expression.
AOB decay reaction
AOB decay: 1 DO −1.42, 2 XA −1, 3 Rate Expression.
Type every stoichiometric constant as a number (−3.217, −1.42, …).

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.

Aerobic reactor properties
Aerobic reactor properties (the influent is the block's own inflow). The panel is long: the top part and the part further down are shown one above the other.
PropertyValueMeaning
1Alk:Concentration / Alk:Constant Inflow concentration250 / 250starts at the influent alkalinity
2DO:Concentration2initial DO
3DO:External sourceAerationaerated (double-click the value cell and pick Aeration)
4NH4:Constant Inflow concentration30influent ammonium
5ON:Constant Inflow concentration8influent organic N
6Initial Storage500 m³6 h at 2000 m³/d
7XA:Concentration per volume of water / XN:Concentration per volume of water5 / 2seeds of attached nitrifiers
8Constant Inflow2000 m³/dayQ
9NameAerobic

5Settings

Simulation end time 100 days; initial time-step 0.01; maximum time-step increase factor 5 (Module 1, Step 6).

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

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:

\[ \mathrm{NH_4^+} = \frac{K_{NH}b_A}{\hat\mu_A - b_A} = \frac{0.5(0.17)}{0.73} = 0.116, \qquad \mathrm{NO_2^-} = \frac{0.2(0.17)}{0.83} = 0.041\ \text{mg N/L}, \qquad ON = \frac{8}{1 + 4(0.25)} = 4.0\ \text{mg N/L}. \]

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.

Stage 1: nitrogen species in the aerobic reactor
Aerobic: NH4, NO2 and NO3:Concentration. For the first days the small seed of AOB lets ammonium and some nitrite pass; as XA grows, NH₄⁺ falls to 0.116 mg N/L and nitrate rises to 33.8 mg N/L. The nitrite blip is the series reaction of Module 2.
Stage 1: DO and alkalinity
Left: DO settles at 2.79 mg/L. Right: alkalinity falls from 250 to 22 mg/L as CaCO₃: nitrification used \(7.14 \times 33.9 = 242\) mg/L and ammonification returned \(3.57 \times 4.0 = 14\). A real plant would need alkalinity added.
Stage 1: attached AOB and NOB
XA and XN grow to 141 and 53 g/m³. Steady state takes weeks: near Smin the net growth rate is close to zero (Module 12).

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:

ReactionRate ExpressionStoichiometric constants
Aerobic growthq_H*COD/(K_C+COD)*DO/(K_OH+DO)*XHCOD −1, XH +0.3, DO −0.574
Anoxic growthq_H*COD/(K_C+COD)*NO3/(K_NO3+NO3)*K_I/(K_I+DO)*XHCOD −1, XH +0.3, NO3 −0.2007, N2 +0.2007, Alk +0.7165
Aerobic decayb_H*DO/(K_OH+DO)*XHXH −1, DO −1.42
Anoxic decayb_H*NO3/(K_NO3+NO3)*K_I/(K_I+DO)*XHXH −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.

Anoxic growth reaction
Anoxic growth: 1 Alk +0.7165, 2 COD −1, 3 N2 +0.2007, 4 NO3 −0.2007, 5 XH +0.3, 6 Rate Expression with the nitrate switch and the oxygen inhibition factor.

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.

Stage 2 canvas
1 Aerobic, 2 Anoxic (with its methanol inflow), 3 Effluent; the links carry 2000 and 2010 m³/d.

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 2: nitrate and COD in the anoxic reactor
Anoxic: NO3:Concentration (left) falls to 3.6 mg N/L and COD:Concentration (right) to 0.69 mg/L. The heterotroph biofilm keeps growing for months: its loss rate bH = 0.1 d⁻¹ sets the time scale.
Stage 2: DO and ammonium in the anoxic reactor
Anoxic DO (left) drops to about 0.006 mg/L: the heterotrophs strip the incoming 2.8 mg/L of oxygen first, which is what lets the nitrate switch turn on. Anoxic NH4 (right): after the start-up peak, while the aerobic tank's nitrifiers are still growing, it settles at 1.44 mg N/L, well above the 0.12 leaving the aerobic tank: organic N that escaped the aerobic tank keeps ammonifying, but there are no nitrifiers (and no oxygen) here.

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.

ReactionRate Expression (g COD/(m³·d))Stoichiometric constants
Aerobic respirationR_max*OM*DO/(K_O+DO)DO −1
DenitrificationR_max*OM*NO3/(K_N+NO3)*K_IO/(K_IO+DO)NO3 −0.3497, N2 +0.3497
Sulfate reductionR_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.

Sulfate reduction reaction
Sulfate reduction: 1 H2S +0.5, 2 SO4 −0.5, 3 Rate Expression with two 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.

Array Generator for the sediment layers
Array Generator (Select Components: Reactor and the link type; then Block Properties and Link Properties (x-x)): 1 Initial Storage 2.5, 2 OM:Concentration per volume of water 1, 3 Name Sediment, 40 × 1 cells; link 4 Time-Dependent flow, 5 Cross-sectional area of the connection 10000, 6 Separation between the connected blocks 0.00025.

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

Stage 3: DO, NO3, SO4 and H2S at several depths, several curves per plot
Right-click a layer → Results → …:Concentration (layer centres at depth \((i - 0.5) \times 0.25\) mm), then put several layers in one plot window: right-click a second plot → Copy curve, right-click the first → Paste. Top left: DO in Sediment(1:1) and (5:1), 7.22 and 2.55 mg/L at day 3 (depths 0.125 and 1.125 mm). Top right: NO3 in (11:1) and (15:1), 0.53 and 0.053 mg N/L (2.625 and 3.625 mm). Bottom: SO4 and H2S in (15:1) and (25:1) (3.625 and 6.125 mm), both as S on one axis: SO4 0.79 and 0.005 mg S/L (the second lies on the axis), H2S 4.2 and 5.0 mg S/L. DO, NO3 and SO4 settle within a few hours; H2S keeps building up for about two days. Plot your day-3 values of all 40 layers against depth: oxygen vanishes at 2.6 mm, nitrate at about 3.8 mm, sulfate at about 5.5 mm, and sulfide builds up below and diffuses back up.

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.

StageQuantityModelFormula
1Aerobic ON / NH4 / NO2 / NO3 at 100 d (mg N/L)4.000 / 0.1164 / 0.0410 / 33.8434.000 / 0.1164 / 0.0410 / 33.843
1Aerobic DO / Alk at 100 d2.787 / 22.352.787 / 22.35
1XA / XN at 100 d (g/m³)141.05 / 52.67141.0 / 52.7
2Anoxic COD / NO3 at 200 d (mg/L)0.690 / 3.5710.690 / 3.571
2Anoxic DO / NH4 / Alk at 200 d0.0056 / 1.438 / 134.430.0056 / 1.438 / 134.43
2nitrogen balance in / out incl. N₂ (kg N/d)76.000 in = 76.000 out (ON + NH₄⁺ + NO₂⁻ + NO₃⁻ + N₂)
3O₂ flux into the sediment (g/(m²·d))0.6220.632 (zero-order zone)
3NO₃⁻ flux into the sediment (g N/(m²·d))0.09720.0972
3SO₄²⁻ flux / H₂S flux out (g S/(m²·d))0.1188 / 0.11870.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

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