← Module 4 · Modeling Assignment M4 (OpenHydroQual)

One CSTR, three in series, and a plug-flow reactor: removal and tracer response

An illustrated, step-by-step worked example · about 60 minutes · the latest OpenHydroQual · uses Module 4, Sections 2, 4 and 6, and the reaction objects of Modeling Assignment M2

What you will build

The same job done by three different reactors: 200 m³/day of water carrying 50 g/m³ of a substance that decays by a first-order reaction (\(k = 0.2\) d⁻¹), always with a total reactor volume of 1000 m³ (\(\tau = 5\) days, \(k\tau = 1\)). You will see the removal improve from one CSTR to three in series to a plug-flow reactor, and then use a tracer to see why.

StageReactorWhat to look forSaved as
1one CSTR, 1000 m³\(C = 50/(1 + 1) = 25\) g/m³; start-up along \(e^{-(1/\tau + k)t}\)M4_stage1_cstr.ohq
2three CSTRs of 333.3 m³ in series\(50/(1 + 1/3)^3 = 21.09\) g/m³M4_stage2_three_cstrs.ohq
3plug-flow reactor: ten cells of 100 m³\(50/1.1^{10} = 19.28\) g/m³ (ideal PFR: \(50e^{-1} = 18.39\))M4_stage3_pfr.ohq
4tracer step through the CSTR and the plug-flow reactor\(F = 1 - e^{-t/\tau}\) against the ten-tank \(F(t)\)M4_stage4_tracer.ohq

The system

ItemValue
Flow and feed\(Q = 200\) m³/day; Reactant 50 g/m³ (Stage 4 also Tracer 1 g/m³)
Reactionfirst order, rate k*Reactant, \(k = 0.2\) d⁻¹, Reactant −1 (as in M2)
Total reactor volume1000 m³ in every stage: \(\tau = 5\) days, \(k\tau = 1\)
Outleta large Reactor (10⁶ m³), as in M1
Simulation0–30 days (Stages 1–3), 0–20 days (Stage 4)

1Constituent and reaction

Start a new model, load the Mass Transfer plugin, create a constituent Reactant, a Reaction Parameter k = 0.2 and a reaction decay with rate expression k*Reactant and Reactant:Stoichiometric Constant −1 (M2, Steps 1, 3 and 4).

Reaction decay properties
The reaction: 1 Reactant:Stoichiometric Constant −1, 2 Name decay, 3 Rate Expression k*Reactant (shown in parentheses once saved).
A reaction acts in every block. OpenHydroQual applies each reaction in every block that holds the constituent, including the large Outlet. That is harmless for the Outlet (it only collects water), but it matters for where the feed comes from: see the Feed tank in Stage 3.

2The CSTR

Build the tank of M1, Steps 3–5: a Reactor named CSTR with its own constant inflow, a large Reactor named Outlet, and a Fixed flow link from CSTR to Outlet.

CSTR properties
CSTR: 1 Reactant:Concentration 0 (starts clean), 2 Reactant:Constant Inflow concentration 50, 3 Initial Storage 1000 m³, 4 Constant Inflow 200 m³/day.
Fixed flow icon
1 The Fixed flow link (M1, Step 5). Draw it from CSTR to Outlet and set its flow to 200 m³/day.
Stage 1 canvas: CSTR, link, Outlet
1 CSTR, 2 the link (200 m³/day), 3 Outlet (Initial Storage 1e+06 m³).

This is Module 1's tank with Module 2's reaction added, which is exactly the CSTR of Module 4, Section 2.

3Simulation time and time step

General Settings: end time 30 days. Solver Settings: initial time-step 0.01 and maximum time-step increase factor 5.

Solver settings
As in M1: 1 initial time-step 0.01, 2 maximum time-step increase factor 5.

Stage 1One CSTR

Save as M4_stage1_cstr.ohq and run. Plot CSTR → Reactant:Concentration.

Predict first: \(\tau = 1000/200 = 5\) days, \(k\tau = 1\), so the steady state is \(C = 50/(1 + 1) = 25\) g/m³: half is removed. The tank starts clean and approaches 25 g/m³ with the rate \(1/\tau + k = 0.4\) d⁻¹ (Module 4, Section 2): \(C(t) = 25(1 - e^{-0.4t})\).

CSTR reactant concentration rising to 25
The CSTR rises to 25 g/m³: 13.8 at 2 days, 21.6 at 5 and 24.5 at 10. A tracer in the same tank (M1, Stage 1) would take more than twice as long to reach its steady state, because here reaction as well as outflow removes mass.

Stage 2Three CSTRs in series

Save a copy as M4_stage2_three_cstrs.ohq. Replace the single tank by three: rename CSTR to Tank1 and set its Initial Storage to 333.33 m³ (it keeps the inflow of 200 m³/day at 50 g/m³). Add Tank2 and Tank3, each 333.33 m³ with no inflow, and connect Tank1 → Tank2 → Tank3 → Outlet with Fixed flow links of 200 m³/day. The total volume is still 1000 m³.

Three tanks in series
1 Tank1 (with the inflow), 2 Tank2, 3 Tank3, 4 Outlet; every link carries 200 m³/day.
Tank1 properties
Tank1: 1 Reactant:Constant Inflow concentration 50, 2 Initial Storage 333.333 m³, 3 Constant Inflow 200.

Predict with Module 4, Section 4: each tank has \(\tau/3 = 1.667\) days and multiplies the concentration by \(1/(1 + 1/3) = 0.75\):

\[ C_1 = 37.5, \qquad C_2 = 28.13, \qquad C_3 = 50 \times 0.75^3 = 21.09\ \text{g/m}^3 . \]

Put the three tanks on one plot. Right-click Tank1 → Results → Reactant:Concentration and keep that plot window open. Open Tank2's Reactant:Concentration in a second window, right-click its chart → Copy curve, then right-click the chart of the Tank1 window → Paste. Close the second window and do the same for Tank3.

Reactant in the three tanks on one plot
Tank1, Tank2 and Tank3 on one panel (Tank2 and Tank3 pasted into the Tank1 plot window). They settle at 37.5 (along the top of the axis), 28.1 and 21.1 g/m³: each at 75 % of the one before. Each tank downstream also starts later and rises more slowly. The train removes 57.8 % against 50 % for one tank of the same total volume.

Stage 3A plug-flow reactor (ten cells)

Save a copy as M4_stage3_pfr.ohq and delete the three tanks and their links. A plug-flow reactor is modeled as many small CSTRs in series. With ten cells the result is \(50/(1 + 0.1)^{10} = 19.28\) g/m³, close to the ideal PFR's \(50e^{-1} = 18.39\) g/m³.

3a · The Plug flow reactor block

The Mass Transfer plugin has a Plug flow reactor block in the Blocks toolbar: ten equal Reactors (R01 … R10) already joined by Fixed flow links. Click it: it appears on the canvas as a single block, and its ten cells and nine links are listed under it in the Object Browser (named after the block, e.g. PFR__R01 … PFR__R10 for a block named PFR). Set its properties:

Plug flow reactor icon
1 The Plug flow reactor icon (hover to see the name).
Plug flow reactor properties
1 Cross-sectional area of the reactor 10 m² and 3 Length of the reactor 100 m: the volume, 1000 m³, is split into ten cells of 100 m³. 2 Flow rate through the reactor 200 m³/day (the default is 100): the flow on the nine internal links.
If the Plug flow reactor block is missing or will not run in your version, build the chain by hand: ten Reactors named R01 … R10, each 100 m³ with no inflow, joined by Fixed flow links of 200 m³/day (as in Stage 2, but with ten tanks). The reference file M4_stage3_pfr.ohq is built this way, so its results are identical.

3b · Feeding the plug-flow reactor

The Plug flow reactor block has no "Constant Inflow" property, so the feed must enter through a link. Add a small Reactor named Feed: Initial Storage 1 m³, Constant Inflow 200 m³/day, Reactant:Constant Inflow concentration 50. Link Feed → plug-flow reactor (200 m³/day) and plug-flow reactor → Outlet (200 m³/day).

Feed, plug-flow reactor and Outlet
1 Feed, 2 the plug-flow reactor (ten cells), 3 Outlet.
Feed properties
Feed: 1 Reactant:Constant Inflow concentration 50, 2 Initial Storage 1 m³, 3 Constant Inflow 200.
Why a tiny Feed tank, and not a large reservoir like M1's River?
The reaction acts in every block. A large reservoir holding the feed would itself decay at 0.2 d⁻¹, and the feed concentration would fall over the run. The Feed tank has a residence time of 1/200 day (7 minutes), so its own decay is negligible: it passes on \(50/(1 + 0.2/200) = 49.95\) g/m³. It is simply a way to bring the inflow in through a link.

Set the end time to 30 days, save and run. Plot the last cell: right-click the plug-flow reactor → Results → R10 → Reactant:Concentration (if you built the chain by hand, right-click R10 → Results → Reactant:Concentration). Then look along the reactor: plot R01 first, and paste R03, R05, R07 and R10 into the same plot window (open each in its own window, right-click its chart → Copy curve, right-click the R01 chart → Paste).

Reactant in cells R01, R03, R05, R07 and R10 on one plot
Five cells along the plug-flow reactor on one panel: R01, R03, R05, R07 and R10 settle at 45.4, 37.5, 31.0, 25.6 and 19.26 g/m³ (19.28 without the Feed tank's 0.1 % loss). The ideal \(50e^{-0.2t'}\) profile of Module 4, Section 3 gives 45.2, 37.0, 30.3, 24.8 and 18.4 at the same points (\(t' = 0.5, 1.5, 2.5, 3.5, 5\) days).
Question: what do the stepped curves mean?

Each curve is one position along the reactor. (a) How does the steady concentration change from one cell to the next, and by what factor per cell? (b) Why does each cell further downstream start to rise later, and why have all of them levelled off by about 10 days? (c) Each cell is a small CSTR with \(\tau/10 = 0.5\) day. Explain why ten such cells come close to the ideal profile \(50e^{-0.2t'}\), where \(t'\) is the travel time to that point, and what would change with 100 cells.

Stage 4A tracer step test

Save a copy as M4_stage4_tracer.ohq. Add:

  1. a second constituent, Tracer (no reaction: leave it out of the decay reaction, stoichiometric constant 0);
  2. in Feed, Tracer:Constant Inflow concentration = 1: from time zero the feed carries tracer, a step input;
  3. a Reactor Mixed (Initial Storage 1000 m³, Constant Inflow 200 m³/day, Reactant 50 and Tracer 1 in its inflow), with a Fixed flow link Mixed → Outlet of 200 m³/day. It is the CSTR of Stage 1, running side by side.

Set the end time to 20 days, save and run. Plot Mixed → Tracer:Concentration and R10 → Tracer:Concentration (with the Plug flow reactor block: right-click it → Results → R10 → Tracer:Concentration), and put them on one panel: right-click the R10 chart → Copy curve, right-click the Mixed chart → Paste.

Stage 4 canvas with Mixed and the plug-flow train
1 Feed → the ten cells R01 … R10 → Outlet (the reference file uses the hand-built chain; with the Plug flow reactor block this is Feed → PFR → Outlet); 2 Mixed → Outlet, in parallel.
Mixed properties
Mixed: 1 Reactant:Constant Inflow concentration 50, 2 Initial Storage 1000, 3 Tracer:Constant Inflow concentration 1, 4 Constant Inflow 200.
Tracer step response of the CSTR and of the plug-flow reactor on one plot
The CSTR (Mixed) and the ten-cell plug-flow reactor (R10) on one panel. The CSTR responds at once and follows \(1 - e^{-t/5}\) (0.63 at \(t = \tau\)). The plug-flow reactor shows almost nothing for two days, then an S-shaped front centred near \(t = \tau = 5\) days (0.54 at \(t = \tau\)); it overtakes the CSTR just after \(\tau\) and is at 0.99 by 10 days, when the CSTR is still at 0.86. An ideal PFR would jump from 0 to 1 exactly at 5 days.

The mean residence time is 5 days in both, but the spread is very different: variance \(\tau^2\) for the CSTR and \(\tau^2/10\) for ten cells (Module 4, Section 6). That spread is why the CSTR removes less: some of its water leaves almost at once, before it has had time to react.

Checkpoints

Read these from your own runs; small differences in the last digit are normal. Steady-state values agree with the formulas exactly; transient values lag the formula slightly in the first days because of the time step, as in M1.

StageQuantityModelFormula
1CSTR at 2 / 5 / 10 / 30 days (g/m³)13.68 / 21.55 / 24.52 / 25.0013.77 / 21.62 / 24.54 / 25.00
1CSTR storage (m³)10001000
2Tank1 / Tank2 / Tank3 at 30 days (g/m³)37.50 / 28.13 / 21.0937.50 / 28.13 / 21.09
3Feed / R01 / R05 / R10 at 30 days (g/m³)49.95 / 45.41 / 31.02 / 19.2649.95 / 45.41 / 31.02 / 19.26 (ideal PFR 18.39)
4CSTR tracer F at 2.5 / 5 / 7.5 / 10 days0.392 / 0.630 / 0.775 / 0.8630.394 / 0.632 / 0.777 / 0.865
4Ten-cell tracer F at 2.5 / 5 / 7.5 / 10 days0.038 / 0.535 / 0.920 / 0.9930.032 / 0.542 / 0.930 / 0.995

The ten-cell front in the model is a little more spread out than the formula (0.038 against 0.032 at 2.5 days). That is numerical dispersion from the 0.05-day time step, which is a tenth of each cell's residence time. With the maximum time-step increase factor set to 1 (a 0.01-day step; the run takes about half a minute) the model gives 0.033 / 0.540 / 0.928 / 0.995. Module 5 returns to numerical dispersion.

Explore

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

Troubleshooting

A tank empties or overflows.A link's flow does not match the inflow (200 m³/day everywhere in series). In the Plug flow reactor block, its own Flow property must also be 200.
The effluent stays at 50 g/m³.The decay reaction is missing, its Reactant constant is 0, or the rate expression misspells k.
In Stage 3 the effluent slowly falls below 19.3 g/m³.The feed comes from a large reservoir that is itself decaying. Use the 1 m³ Feed tank of Step 3b.
The tracer decays.Tracer has a non-zero stoichiometric constant in the decay reaction; set it to 0.
The Plug flow reactor block cannot be found or gives an error.Build the ten-cell chain by hand (Stage 3 note) or open M4_stage3_pfr.ohq, which contains it.

What to submit