# Appendix R Mass Conservation Model

## R.1 Intent

The TUFLOW FV Water Quality Module (WQM) is supported by a downloadable model suite that is intended to provide users with simple three dimensional models that can be used to:

- Assess WQ Module mass conservation performance, and/or
- Support exploration of the features and behaviour of the WQM, and/or
- Use as templates for building water quality control files for other simulations

The suite does not need a licence to execute with either existing or altered water quality parameters.

This Appendix provides background, analysis and windows usage instructions for the mass conservation model. The model suite can be run on either windows or linux, however this document describes only the windows execution process. TUFLOW FV releases from 2022 onward include the WQ Module and therefore can execute this model.

## R.2 Description

The mass conservation model is configured as follows.

- General
- 1 month (745 hours) duration
- Includes salinity, temperature (and heat calculations), sediment and varying numbers of water quality computed variables
- 15 minute output
- 15 minute water quality simulation timestep
- Designed to mimic a deep lake that cools over an autumnal period

- Geometry
- Four three-dimensional flat bottomed columns, with the same bed elevation
- Lateral cell areas each of approximately 10 km\(^2\)
- Depth of 21 metres
- 20 vertical layers, with 17 fixed and 3 sigma (which span the top 4 metres of the water column)

- Boundary conditions
- No inflows, outflows or other flow boundaries
- Meteorological boundaries applied
- Hourly timestep, 15 minute update
- Typical mid latitude autumnal conditions, with rainfall included

- Water quality parameterisation
- WQ Module control files that present the parameters used are included below for each simulation
- Each simulation includes the most complex simulation construction (for each simulation class) so as to stress test all available processes
- Parameters are set to be generally within expected ranges, with some deliberate exceptions designed to illustrate the parameter checking features of the WQM

This setup of essentially stationary water is designed to be challenging for mass conservation. In particular, the exclusion of external flow boundaries (that can reset or overwhelm internal process calculations) is deliberate. These conditions might mimic a low rainfall lacustrine environment.

## R.3 Model suite

The mass conservation model suite comprises six (6) related models. These six models are split into two groups of three, with these groups being identical other than one group using the milligrams per litre (MGL) units system and the other group using the millimoles per cubic metre (MMM) units system.

The three models within each group increase in configurational complexity that matches the three currently available water quality simulation classes. These are (with links to the relevant manual sections):

- Water quality simulation class == DO (Section 3.1)
- Water quality simulation class == inorganics (Section 3.2)
- Water quality simulation class == organics (Section3.3)

Detailed model access and execution instructions are provided in Section R.6.

## R.4 Calculations

The primary calculation used to assess mass conservation for each computed variable \(X\) follows:

\[\begin{equation} X_{mb}(t) = 100 \times \frac{X_{mp}(t) - X_{mi}(t)}{X_{mi}(t)} \tag{R.1} \end{equation}\] where \(X_{mb}(t)\) is the percentage difference between two methods of computing the mass of computed variable \(X\) in the domain:

- \(X_{mp}(t)\): Progressively modifying the initial domain mass by adding to it the sum of the relevant fluxes \(F_i\) at each timestep \(t\). No resetting of this calculation occurs - it is designed (stringently) such that any mass conservation errors will accumulate in time
- \(X_{mi}(t)\): Multiplying the reported concentrations of \(X\) in cell \(j\) of volume \(V_j\) and integrating over the entire model domain at each timestep \(t\). This mass is reset at each timestep and corresponds to the mass reported by TUFLOW FV

\(X_{mp}(t)\) and \(X_{mi}(t)\) are computed as per Equation (R.2). \(F_{i}(t)\) are the relevant fluxes for \(X\) (up to a total number of \(i=NF\) fluxes) and are converted from per area (or per volume) and per time amounts to mass amounts. The number of cells in the domain is \(NC\), and \(\left[X\right]_{j}(t)\) is the concentration of computed variable \(X\) in cell \(j\) at time \(t\). The model contains sigma layers and as such \(V_{j}\) may be time varying.

\[\begin{equation} \left.\begin{aligned} X_{mp}(t) =& \sum_{j=1}^{NC} \left[X\right]_{j}(0) \times V_j(0) + \sum_{i=1}^{NF} F_{i}(t) \\ \\ X_{mi}(t) =& \sum_{j=1}^{NC} \left[X\right]_{j}(t) \times V_j(t) \end{aligned}\right\} \tag{R.2} \end{equation}\]

As a general note, reported fluxes need to be used with care in mass conservation analyses. This is because fluxes are reported as instantaneous values, and are not integrated or accumulated between overall model output file writing timesteps. For example, if water quality calculations are undertaken every 15 minutes but outputs are written every hour, then several water quality calculations are undertaken between reporting. Whilst the hourly output water quality concentrations will correctly reflect the action of fluxes at every 15 minute increment, the output fluxes will be instantaneous, and equal to those that happen to be occurring at the hourly output time. They will not necessarily be reflective of the fluxes that occurred over the course of the preceding hour. Using these fluxes in mass conservation calculations can therefore lead to spurious outcomes. One solution to this matter is to set the output and water quality (and boundary condition update) timesteps to be the same in mass conservation analyses, noting that this may however generate large output files.

Three simulations were executed, with one for each of the DO, inorganics and organics simulation classes. The timeseries of \(X_{mb}(t)\), together with the fluxes used in calculations, are presented below for all relevant computed variables. The WQ Module control file commands are also included for reference. Only the MGL units system predictions and calculations are presented.

## R.5 Mass conservation performance

### R.5.1 Simulation class: DO

The computed variables presented are:

- Dissolved oxygen

The initial conditions are:

- Dissolved oxygen: 8.0 mg/L

The relevant fluxes considered are (coloured as

- Dissolved oxygen
Sediment - Atmospheric (both source and sink)

The mass conservation performance of the WQ Module is presented in Figure R.2, via \(DO_{mb}\). Over the duration of the simulation, mass conservation holds to within 0.011%. Relevant fluxes used to compute this mass conservation are presented subsequently.

Following are the WQ Module control file commands used to generate the above.

```
simulation class == DO
wq dt == 900.0
wq units == mgl
oxygen model == O2
oxygen min max == 0.0, 12.0
oxygen benthic == 4.7, 1.08
end oxygen model
material == default
oxygen flux == -1400.0
end material
material == 1
oxygen flux == -1100.0
end material
material == 2
oxygen flux == -1200.0
end material
material == 3
oxygen flux == -1300.0
end material
```

### R.5.2 Simulation class: Inorganics

The computed variables presented are:

- Dissolved oxygen
- Silicate
- Ammonium
- Nitrate
- FRP
- Adsorbed FRP
- Two phytoplankton groups (one each for the basic and advanced model)

The initial conditions are:

- Dissolved oxygen: 8.0 mg/L
- Silicate: 50.0 mg/L
- Ammonium: 0.15 mg/L
- Nitrate: 0.2 mg/L
- FRP: 0.04 mg/L
- Adsorbed FRP: 0.02 mg/L
- Blue green phytoplankton: 2.0 \(\mu\)g/L (advanced model)
- Blue green internal nitrogen: 0.008 mg/L
- Blue green internal phosphorus: 0.0012 mg/L
- Green phytoplankton: 5.0 \(\mu\)g/L (basic model)

The relevant fluxes considered are:

- Dissolved oxygen
Sediment - Atmospheric (both source and sink)
Nitrification Phytoplankton primary productivity Phytoplankton respiration

- Silicate
Sediment Phytoplankton primary productivity Phytoplankton mortality Phytoplankton excretion

- Ammonium
Sediment Atmospheric (wet and dry deposition) Nitrification Anaerobic oxidation of ammonium Dissimilatory reduction of nitrate to ammonium Phytoplankton primary productivity Phytoplankton mortality Phytoplankton excretion

- Nitrate
Sediment Atmospheric (wet and dry deposition)Nitrification Denitrification Anaerobic oxidation of ammonium Dissimilatory reduction of nitrate to ammonium Phytoplankton primary productivity

- FRP
Sediment Atmospheric Adsorption anddesorption Phytoplankton primary productivity Phytoplankton mortality Phytoplankton excretion

- FRP Adsorbed
Adsorption anddesorption

- Phytoplankton (both groups)
Phytoplankton primary productivity Phytoplankton respiration Phytoplankton mortality Phytoplankton excretion Phytoplankton sedimentation

The mass conservation performance of the WQ Module is presented in Figure R.4, via \(DO_{mb}(t)\), \(Si_{mb}(t)\), \(Amm_{mb}(t)\), \(Nit_{mb}(t)\), \((FRP+FRPAds)_{mb}(t)\) and \(PHY_{mb}(t)\). Over the duration of the simulation, mass conservation holds to within approximately 0.014%. Relevant fluxes used to compute these mass conservations, as well as total nitrogen and total phosphorus mass conservations, are presented subsequently.