← Module 12 · Modeling Assignment M12 (OpenHydroQual)

Biofilms in OpenHydroQual: a biofilm reactor, the inside of a biofilm, and a trickling filter

An illustrated, step-by-step worked example · about 75 minutes · the latest OpenHydroQual · uses Module 12, Sections 2–5, the reactions of Modules 10–11 and the Array Generator of Module 5

What you will build

The biofilm biomass is an Immobile constituent: it stays in the block where you put it while water and dissolved substances flow through, and it grows by reacting with the mobile substrate and oxygen. You use it three ways: as the biomass of a completely mixed biofilm reactor, as the fixed biomass in ten thin layers of a biofilm, and as the growing film in ten segments of a trickling filter.

StageWhat it isWhat to look forSaved as
1a mixed reactor with media; thin biofilm B with Monod kinetics, decay, detachment, aerationS falls to Smin = 0.288 mg/L; B → 173 g/m³M12_stage1_biofilm_reactor.ohq
2a 200 µm biofilm split into 10 layers under a 100 µm boundary layer, exchanging substrate by diffusion onlythe cosh profile; J = 0.641 g/(m²·d), Ss = 0.359 mg/LM12_stage2_inside_biofilm.ohq
3a 6 m trickling filter as 10 biofilm segments in series, flux-based removal a·kf·SSe = 24.2 mg/L (tanks in series); biofilm thickest at the topM12_stage3_trickling_filter.ohq

The system

ItemValue
Kinetics (all stages)\(\hat q = 10\) d⁻¹, \(K_s = 10\) g/m³, \(Y = 0.5\), \(b = 0.10\) d⁻¹, \(b_{det} = 0.04\) d⁻¹; \(DO_{sat} = 9.09\) g/m³
Stage 1 reactor\(V = 100\) m³, \(Q = 500\) m³/d, \(S_0 = 10\) g/m³, \(K_La = 10\) d⁻¹; biofilm seed 1 g/m³
Stage 2 biofilm\(L_f = 200\) µm in 10 layers of 20 µm, \(X_f = 40{,}000\) g/m³, \(D_f = 0.8\) cm²/d; boundary layer 100 µm with \(D = 1.0\) cm²/d; bulk at \(S_b = 1\) g/m³
Stage 3 filterdepth 6 m, plan area 50 m², \(a = 100\) m²/m³, \(k_f = 0.10\) m/d, \(Q = 1500\) m³/d at \(S_0 = 150\) g/m³; ventilation \(K_La = 300\) d⁻¹

1Load the Mass Transfer plugin

Start a new model and add the Mass Transfer plugin (Module 1, Step 1). It provides the Reactor, the Fixed flow and Time-Dependent flow links, and the Immobile constituent.

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

2Four constituents, one of them immobile

Create three Chemical constituents (Module 1, Step 2): S (substrate), DO (dissolved oxygen) and Xd (detached biofilm, carried away by the water). Then create the biofilm biomass B as an Immobile constituent (per volume of water) from the same Add Objects → Chemistry menu.

Add Objects, Chemistry menu
1 Add Objects → 2 Chemistry → 3 Chemical constituent (as in Module 1).
Immobile constituent B
1 Add Objects → Chemistry → Immobile constituent (per volume of water); 2 rename it B. Its concentration is grams of biofilm per m³ of the block, and links do not carry it.

3Reaction parameters, three reactions and an aeration source

Create the reaction parameters (Add Objects → Chemistry → Reaction Parameter, as in Modules 10–11): qhat = 10, K_s = 10, Y = 0.5, b = 0.1, b_det = 0.04. Then three Chemical reactions. All rates are per m³ of the block; the stoichiometric constants are the change in each constituent per unit of rate:

ReactionRate ExpressionSBDOXdMeaning
Utilizationqhat*S/(K_s+S)*B-1Y(1.42*Y-1)0the biofilm uses S and grows; oxygen takes the electrons not built into cells
Decayb*B0-1-1.420endogenous respiration (Module 11)
Detachmentb_det*B0-101shear turns attached biomass into suspended solids
Utilization reaction
Utilization: 1 B:Stoichiometric Constant Y, 2 DO (1.42*Y-1), 3 S −1, 4 Rate Expression.
Detachment reaction
Detachment: 1 B −1, 2 Xd +1, 3 Rate Expression b_det*B.

Here the rate of Utilization is written in units of substrate, so S has −1 and B has +Y (in Module 11 it was written per unit of biomass; both work). Type −1.42 as a number, not as (0-1.42) (Module 11, Stage 3).

Oxygen transfer is a source, as in Modules 7 and 11: Add Objects → Sources → Atmospheric Exchange, named Aeration, with Rate coefficient 10 1/day (\(K_La\)) and Saturation Concentration Level 9.09 g/m³ (\(DO_{sat}\)). It adds \(VK_La(DO_{sat} - DO)\) g/day to each block whose DO:External source names it. In Step 4 you will set it on the Biofilm reactor only.

4The biofilm reactor

Add a Reactor named Biofilm reactor. Think of it as a tank packed with plastic media that the water flows through; the media's biofilm is B.

Biofilm reactor properties
Properties of the biofilm reactor.
PropertyValueMeaning
1B:Concentration per volume of water1 g/m³a seed of biofilm (with 0 it could never grow)
2DO:Concentration9.09 g/m³starts saturated
2DO:External sourceAerationoxygen transfer, \(VK_La(DO_{sat} - DO)\); double-click the value cell and pick Aeration
3S:Constant Inflow concentration10 g/m³\(S_0\)
4Initial Storage100 m³\(V\)
5Constant Inflow500 m³/day\(Q\)
6NameBiofilm reactor

5The effluent

Add a Reactor Effluent with Initial Storage 1e+06 m³ and a Fixed flow link Biofilm reactor → Effluent of 500 m³/day (Module 1, Steps 4–5). The water, S, DO and Xd flow through the link; B does not.

Stage 1 canvas
1 Biofilm reactor, 2 the link, 3 Effluent; in the Object Browser, 4 the four constituents, 5 the three reactions and 6 the Aeration source.

6Simulation time and time step

Simulation end time 60 days; initial time-step 0.01 and 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 1A biofilm reactor reaches Smin

Save as M12_stage1_biofilm_reactor.ohq and run (Run Model, Module 1). Predict first with Module 12, Section 4: the film is thin, so

\[ S_{min} = \frac{K_sb'}{Y\hat q - b'} = \frac{10(0.14)}{5 - 0.14} = 0.288\ \text{g/m}^3, \qquad B = \frac{YQ(S_0 - S)}{b'V} = \frac{0.5(500)(9.712)}{0.14(100)} = 173\ \text{g/m}^3. \]
Run Model button
1 Run Model.
Stage 1: S and B in the biofilm reactor
Left: Biofilm reactor S:Concentration. In the first hours the tank fills with influent while the seed of biofilm is still too small to keep up, so S rises from 0 toward the influent value; as B grows, S drops quickly (6.1 g/m³ at day 1, 0.72 at day 5) and then creeps down to 0.288 g/m³. Right: B:Concentration grows to 173 g/m³. The slow final approach is typical of biofilms: near Smin the net growth rate is close to zero.
Stage 1: DO and detached solids
Left: DO falls from 9.09 to 3.48 g/m³ as the growing biofilm uses more oxygen. Right: Xd:Concentration, the detached biomass in the effluent, rises to 1.39 g/m³ \(= b_{det}BV/Q\).

Check the oxygen with a COD balance (Module 11, Section 4): the bCOD removed, \(Q(S_0 - S) = 4856\) g/d, either leaves as detached biomass, \(1.42QX_d = 985\) g/d, or is passed to oxygen, 3871 g/d. The aeration supplies \(K_LaV(DO_{sat} - DO)\), which must equal the oxygen used plus the DO carried out, \(Q\cdot DO\).

Stage 2Inside a biofilm: diffusion and reaction

Start a new model (Mass Transfer plugin) and save it as M12_stage2_inside_biofilm.ohq. Here the biofilm itself is split into 10 layers, each a Reactor, and substrate moves between them only by diffusion.

2a · A diffusing substrate and a fixed biofilm

Constituent S with a diffusion coefficient
1 Diffusion Coefficient: typed as 8e-05 with unit m^2/day, shown converted as 9.25926e-10[m²/s]; 2 Name S.

2b · The bulk liquid

Add a Reactor Bulk with Initial Storage 1e+08 m³ and S:Concentration 1. It is so large that the biofilm hardly changes it: a bulk liquid held at \(S_b = 1\) g/m³.

2c · Ten layers with the Array Generator

Open Add Objects → Create 2D Array (Module 5, Step 3) and generate a row of 10 × 1 Reactors joined by Time-Dependent flow links. A Time-Dependent flow link with no flow time series carries no water, only diffusion: \(D\cdot\text{area}/\text{length}\cdot(C_1 - C_2)\).

Array Generator: block and link properties for the layers
Array Generator. On Select Components pick Reactor and the link type; then the Block Properties and Link Properties (x-x) tabs. Block properties: 1 Initial Storage 0.2 m³, 2 Xf:Concentration per volume of water 40000, 3 Name Layer, 10 × 1 cells. Link type 4 Time-Dependent flow: 5 Cross-sectional area of the connection 10000 m², 6 Separation between the connected blocks 2e-05 m; leave Flow rate (a time series) empty.
Why 0.2 m³ layers and 10,000 m² of biofilm?
Each layer is 20 µm thick (200 µm / 10). A 1 m² piece of biofilm would give layers of \(2\times10^{-5}\) m³, and OpenHydroQual divides an immobile constituent's mass by (Storage + 10⁻⁵ m³), which would spoil such tiny volumes. So we model 10,000 m² of biofilm: each layer holds 10,000 m² × 20 µm = 0.2 m³. The flux per m² does not depend on the area chosen. The link length is the distance between layer centres, 20 µm = 2e-05 m.

2d · The boundary layer

Draw one more Time-Dependent flow link from Bulk to Layer(1:1) with area 10000 m² and length 9e-05 m.

Where does 9e-05 m come from? OpenHydroQual uses one diffusion coefficient per constituent, here the biofilm's 0.8 cm²/d. The boundary layer is 100 µm of water, where \(D = 1.0\) cm²/d; 100 µm of water passes as much as \(100 \times 0.8/1.0 = 80\) µm would with \(D_f\). Add half of the first layer (10 µm) to reach its centre: 90 µm = 9e-05 m.
Boundary-layer link properties
The Bulk → Layer(1:1) link: 1 Cross-sectional area of the connection 10000, 2 Separation between the connected blocks 9e-05. Set the end time to 1 day: diffusion over 200 µm takes only seconds to minutes, so the profile is steady almost at once.

2e · Run and compare

Predict with Module 12, Example 12c: \(J = 0.641\) g/(m²·d), \(S_s = 0.359\) g/m³, and inside the film \(S(z) = S_s\cosh((L_f - z)/\tau)/\cosh\varphi\), \(\tau = 44.7\) µm, \(\varphi = 4.47\).

Stage 2: S in the layers
S:Concentration of Layer(1:1), Layer(3:1), Layer(5:1) and Layer(10:1) at the end of the run (or the Bulk → Layer(1:1) link's S:Mass transfer rate). Layer centres are at z = 10, 30, …, 190 µm. Plot your ten values against z with the cosh curve: the substrate is nearly gone halfway into the film.

The flux is the boundary-layer link's S:Mass transfer rate divided by the area: 6357 g/d ÷ 10,000 m² = 0.636 g/(m²·d), within 1 % of 0.641. The small difference is the layering: ten layers per 200 µm approximate the smooth curve.

Stage 3A trickling filter

Open your Stage 1 model and save it as M12_stage3_trickling_filter.ohq. It already has S, DO, Xd, B, the three reactions and the Aeration source.

3a · From thin to deep: change the Utilization rate

A trickling filter's biofilm is deep (Module 12, Section 5): its flux is \(J = k_fS\) per m² of film, whatever its thickness. With \(a\) m² of film per m³ of filter, the removal per m³ is \(a\,k_f\,S\). Add reaction parameters a_v = 100 (m²/m³) and k_f = 0.1 (m/d), set the Aeration source's Rate coefficient to 300 1/day (the ventilation), and change only the Utilization rate expression:

Utilization rate a_v*k_f*S
1 Rate Expression a_v*k_f*S. The stoichiometry is unchanged: the biofilm B still grows with yield Y from the substrate it removes.

3b · Ten filter segments

Delete the Biofilm reactor (the Effluent stays). Use Create 2D Array again: 10 × 1 Reactors named Filter, Initial Storage 30 m³ (6 m × 50 m² / 10), all concentrations 0, DO:External source Aeration, joined by Fixed flow links of 1500 m³/day.

Array Generator for the filter segments
1 Initial Storage 30, 2 Name Filter, 3 link type Fixed flow, 4 Flow rate 1500, 5 DO:External source Aeration. The Block Properties page has a drop-down for each constituent's External source; pick Aeration there and every generated segment, Filter(1:1) to Filter(10:1), gets it, so you do not have to set it block by block.

Give Filter(1:1) the influent: Constant Inflow 1500 m³/day and S:Constant Inflow concentration 150. Draw a Fixed flow of 1500 m³/day from Filter(10:1) to Effluent and raise the Effluent's storage to 1e+07 m³. Set the end time to 80 days.

Stage 3 canvas
1 Filter(1:1) with the influent, 2 the row of segments, 3 Filter(10:1) → Effluent.
Storage is the filter volume, not the water volume. Does that matter?
A trickling filter holds only a thin film of water on the media. We give each segment the whole filter volume (30 m³) so that the rate per m³, \(a\,k_f\,S\), is per m³ of filter. The steady concentrations depend only on \(k_faV/Q\), so they are right; the time to get there is not meaningful for the water. The biofilm's own approach to steady state, on the scale of \(1/b' = 7\) days, is.

3c · Run and compare

Predict with Module 12, Section 5: each segment is a mixed tank with \(k\tau = a\,k_fV_{seg}/Q = 10(30)/1500 = 0.2\), so \(S_i = 150/1.2^i\): 125, 104, …, 24.2 g/m³ in segment 10 (plug flow would give 20.3). At steady state the biofilm in segment \(i\) is \(B_i = Ya\,k_fS_i/b'\).

Stage 3: S in segments 1, 5 and 10
S:Concentration in Filter(1:1), Filter(5:1) and Filter(10:1): 125.0, 60.3 and 24.2 g/m³, exactly the tanks-in-series values.
Stage 3: biofilm growth in segments 1 and 10
B:Concentration in Filter(1:1) and Filter(10:1) grows as \(B_i(1 - e^{-b't})\) to 4464 and 865 g/m³: the film is five times thicker at the top (44.6 g/m², 1.1 mm) than at the bottom.
Stage 3: DO down the filter
DO:Concentration in Filter(1:1) and Filter(10:1): 4.94 and 8.42 g/m³. The top of the filter, where the substrate and the biofilm are greatest, uses the most oxygen.

Checkpoints

Read these from your own runs; small differences in the last digit are normal.

StageQuantityModelFormula
1S at 5 / 20 / 60 days (g/m³)0.720 / 0.313 / 0.2882Smin = 0.2881
1B at 60 days (g/m³)173.37173.43
1DO / Xd at 60 days (g/m³)3.480 / 1.3873.479 / 1.387
2flux J (g/(m²·d))0.6360.641
2S in Layer(1:1) / (5:1) / (10:1) (g/m³)0.285 / 0.0487 / 0.00860.287 / 0.0483 / 0.0084
3S in Filter(1:1) / (5:1) / (10:1) at 80 days (g/m³)125.0 / 60.28 / 24.23125.0 / 60.28 / 24.23
3B in Filter(1:1) / (10:1) (g/m³)4464 / 8654464 / 865
3DO in Filter(1:1) / (10:1) (g/m³)4.945 / 8.4244.944 / 8.424
3detached solids leaving Filter(10:1) (g/m³)17.97\(b_{det}\sum B_iV_i/Q\) = 17.97

Explore

Troubleshooting

B stays at its initial value.B was created as a Chemical constituent (it then washes out) or the Utilization stoichiometry for B is 0. Or B's initial value is 0: a biofilm needs a seed.
Stage 2: every layer stays at S = 0, or the flux is far from 0.64.A link area was left at its default 1e-09 m², which switches diffusion off; or the diffusion coefficient unit is m²/s instead of m²/day (8e-05 m²/s is 86,400 times too large); or a link length is in the wrong unit (2e-05 m, not 2e-05 ft).
Stage 2: the layers have the bulk concentration.Xf:Concentration was not set in the layers, so nothing reacts.
Stage 3: S drops in the first segment only.The Utilization rate still contains B (thin-film Monod): the biofilm then grows until S = Smin in segment 1. Use a_v*k_f*S.
The Array Generator offers no Time-Dependent flow.Draw the nine links by hand (Links toolbar → Time-Dependent flow) and set area and length on each.

What to submit