What you will build
A completely mixed 1000 m³ tank with one inflow and one outflow. You will fill it with a tracer, flush it clean, and then add a second inflow from a river and carry temperature as a second "constituent". Every stage is checked against the formulas of Module 1.
| Stage | What changes | What to look for | Saved as |
|---|---|---|---|
| 1 | clean tank, inflow at 50 g/m³ | \(C = C_{\text{in}}(1 - e^{-t/\tau})\), \(\tau = 5\) days | M1_stage1_fill.ohq |
| 2 | tank starts at 50 g/m³, clean inflow | \(C = C_0\,e^{-t/\tau}\) | M1_stage2_flush.ohq |
| 3 | + a river inflow, + temperature | flow-weighted steady state: 26 g/m³ and 16 °C, \(\tau = 2\) days | M1_stage3_mixing_energy.ohq |
The system
| Item | Value |
|---|---|
| Tank | \(V = 1000\) m³, completely mixed, constant volume |
| Inflow (Stages 1–2) | \(Q = 200\) m³/day; tracer \(C_{\text{in}} = 50\) g/m³ (Stage 1) or 0 (Stage 2) |
| Outflow | equal to the inflow, so the volume stays constant: \(\tau = V/Q = 5\) days |
| River inflow (Stage 3) | 300 m³/day at 10 g/m³ and 10 °C; the first inflow is wastewater at 50 g/m³ and 25 °C |
| Simulation | 0 to 30 days (Stage 3: 0 to 20 days) |
OpenHydroQual writes the mass balance of Module 1, Section 2, for every block and every constituent: accumulation = what the links bring in − what they take out + the block's own inflow and sources. You only describe the blocks and links.
Build: 1 Plugin 2 Constituent 3 Tank 4 Outlet 5 Link 6 Settings
Stages: 1 Fill 2 Flush 3 Mixing and temperature Checkpoints Explore Troubleshooting What to submit
1Load the Mass Transfer plugin
Install OpenHydroQual from www.OpenHydroQual.com if you have not already, and start a new model. Open File → Preferences → Add plugin and add Mass Transfer: it provides the Reactor block (a completely mixed tank) and the Fixed flow link.


2Create the tracer (a "constituent")
A constituent is any substance whose mass balance you want. Create it before the blocks, so that every block gets concentration fields for it. Use Add Objects → Chemistry → Chemical constituent.
3Add the tank: a Reactor block
Click the Reactor icon in the Blocks toolbar; a block appears on the canvas. Click it and set its properties in the panel under the Object Browser. Double-click a value to edit it, type the number, and press Enter. The unit is shown in brackets; leave it as it is.
| Property | Value | Meaning | |
|---|---|---|---|
| 1 | Initial Storage | 1000 m³ | the volume of water in the tank, \(V\) |
| 2 | Tracer:Concentration | 0 g/m³ | the initial concentration, \(C_0\): a clean tank |
| 3 | Tracer:Constant Inflow concentration | 50 g/m³ | \(C_{\text{in}}\) of the block's own inflow |
| 4 | Constant Inflow | 200 m³/day | \(Q\), water entering the tank from outside the model |
| 5 | Name | Tank |
The block's inflow brings in mass at the rate \(QC_{\text{in}}\) (OpenHydroQual reports it as "Tracer:Inflow loading"). Remember that g/m³ = mg/L.
4Add somewhere for the water to go: the Outlet
The water leaving the tank needs a destination. Add a second Reactor and make it very large, so that what flows into it changes it very little. It acts as a sink, and its mass at the end of the run tells you how much tracer has left the tank.
5Connect them with a Fixed flow link
Choose the Fixed flow icon in the Links toolbar, then drag from Tank to Outlet. A Fixed flow link moves a set flow of water, and with it mass at the rate \(Q \times C_{\text{Tank}}\), from the first block to the second. This is exactly the "out" term of the mass balance for a completely mixed tank.
Why must the outflow equal the inflow here?
6Simulation time and time step
Expand Settings in the Object Browser.


Why limit the time step? OpenHydroQual solves the balance in small time steps. Over each step it treats the change as if it happened at the end of the step, so a long step makes the curve slightly wrong during the first day, when the concentration changes fastest. With the limit, the error is small; the checkpoints start at day 5.
Stage 1Fill the tank
Save the model (File → Save as, M1_stage1_fill.ohq)). Then press Run Model on the right-hand toolbar and confirm with Yes. The run takes a few seconds.


Read the concentration at 5, 10 and 20 days (hover over the curve, or use the export button in the plot window to save the numbers) and compare with the formula. Also plot the Outlet's Tracer:Mass at 30 days: by the mass balance it should be the 300,000 g that entered (200 m³/day × 50 g/m³ × 30 days) minus the ≈ 49,900 g still in the tank.
Stage 2Flush the tank
Save a copy as M1_stage2_flush.ohq. Change only the tank: its initial concentration becomes 50 g/m³ and its inflow is clean.
Stage 3Two inflows, and temperature
Start from Stage 1 and save a copy as M1_stage3_mixing_energy.ohq. Now the tank also receives water from a river, and you will follow the temperature as well as the tracer.
3a · A heat constituent: Temperature
OpenHydroQual has a constituent made for this: Heat (temperature). Add one with Add Objects → Chemistry → Heat (temperature) (or its icon in the Constituents toolbar) and name it Temperature.
The Heat (temperature) constituent is in the latest OpenHydroQual. If your Chemistry menu does not list it, install the latest version from www.OpenHydroQual.com. is constant, it gives the same temperatures.)
3b · The river and the new flows
Add a third Reactor named River, to the left of the tank. Like the Outlet it is very large, so its concentration and temperature stay at the values you give it. Draw a Fixed flow link from River to Tank.


Before you run, predict the answers with Module 1:
\[ \tau = \frac{1000}{500} = 2\ \text{days}, \qquad C_{\text{ss}} = \frac{200(50) + 300(10)}{500} = 26\ \text{g/m}^3, \qquad T_{\text{ss}} = \frac{200(25) + 300(10)}{500} = 16\ ^\circ\text{C}. \]
Checkpoints
Read these from your own runs; small differences in the last digit are normal. The model lags the formula slightly during the first days because of the time step (Step 6).
| Stage | Quantity | Model | Formula |
|---|---|---|---|
| 1 | Tank C at 5 / 10 / 20 days (g/m³) | 31.52 / 43.17 / 49.07 | 31.61 / 43.23 / 49.08 |
| 1 | Outlet tracer mass at 30 days (g) | 250,100 | 250,100 |
| 2 | Tank C at 5 / 10 / 20 days (g/m³) | 18.49 / 6.83 / 0.93 | 18.39 / 6.77 / 0.92 |
| 3 | Tank C at 2 / 10 / 20 days (g/m³) | 16.32 / 25.81 / 26.00 | 16.44 / 25.82 / 26.00 |
| 3 | Tank T at 2 / 10 / 20 days (°C) | 13.77 / 15.96 / 16.00 | 13.79 / 15.96 / 16.00 |
| 3 | Tank storage (m³), all times | 1000 | 1000 |
Explore
Save a copy with File → Save as and change one thing at a time.
- Same τ, different tank. In Stage 1, double the tank volume and both flows. Check that the curve does not change.
- An unbalanced outflow. In Stage 1, set the link to 150 m³/day. Plot the tank's Storage: it grows by 50 m³/day. Does the concentration still approach 50 g/m³? Why does it approach it more slowly as time goes on?
- A hotter discharge. In Stage 3, raise the wastewater to 35 °C. Predict the new steady temperature with the mixing formula before you run.
- A heater. In Stage 3, set the Tank's Temperature:Heat input to 200 kW. With Example 4c's \(\Delta T = \dot H/(\rho c_p Q)\), predict the new steady temperature (1 kW = 86.4 MJ/day; \(\rho c_p = 4.186\) MJ/(m³·°C); \(Q = 500\) m³/day). The model gives 24.26 °C.
- Heat content. Plot the Tank's Temperature:Heat content (MJ) and check that it equals \(\rho c_p V T\) at the end of the run.
- A worked example to compare with. The OpenHydroQual Examples site has a thermal discharge to a flow-through pond, built with the same Heat (temperature) constituent. Download it, run it, and compare its setup with your Stage 3.
- Mass balance check. In Stage 3, plot the Outlet's Tracer:Mass. After 20 days, compare it with what entered (from both inflows) minus what is in the tank.
Troubleshooting
| The tank concentration stays at 0. | The tank's Constant Inflow or Tracer:Constant Inflow concentration is 0, or you set Tracer:Concentration (the initial value) instead of the inflow concentration. |
| The tank empties or overflows. | The link flow does not match the inflow (Stage 3: 500 = 200 + 300). Plot Storage to check. |
| The curve reaches 50 in a day or two. | The tank volume (Initial Storage) is too small: check it is 1000 m³, not 1000 ft³ (the mouse wheel over a unit box changes the unit). |
| No Reactor or Fixed flow icons. | The Mass Transfer plugin is not loaded (Step 1). |
| The first-day values are a little off. | That is the time step (Step 6). Check the maximum time-step increase factor is 5, and compare from day 5 on. |
What to submit
- Your three
.ohqfiles. - One plot per stage (export or screenshot) with the formula's values marked or tabulated beside the model's, for at least three times.
- For Stage 1, the mass balance at 30 days: mass in, mass in the tank, mass in the Outlet, and the percent difference.
- Short answers (2–4 sentences each): (a) Why does the tank in Stage 3 reach steady state faster than in Stage 1? (b) The heat constituent balances heat content but shows temperature. Why do the temperatures then mix exactly like concentrations, and what would make the model wrong for a real pond? (c) Your result for one Explore item, with a sentence explaining it.
Submit everything in one PDF plus the .ohq files in Brightspace → Assignments → Modeling Assignment M1.