# Appendix S Mass Conservation Model

## S.1 Intent

The TUFLOW FV Water Quality (WQ) Module 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 WQ Module, 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.

## S.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 of variable thickness, with 17 fixed and 3 sigma (which span the top portion 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 WQ Module

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.

## S.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 (Section 3.3)

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

## S.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{S.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 (S.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{S.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.

## S.5 Mass conservation performance

### S.5.1 Simulation class: DO

This is the simplest simulation class and it has oxygen as the only mandatory model class. For illustrative purposes, the optional pathogens model class has also been included in this mass balance simulation. The computed variables presented are therefore:

- Dissolved oxygen
- Pathogen 1 (which includes attachment dynamics)
- Pathogen 2 (which excludes attachment dynamics)

The initial conditions are:

- Dissolved oxygen: 8.0 mg/L
- Pathogen 1 alive, attached and dead: 1e6 CFU/100mL, 1e5 CFU/100mL, 1e5 CFU/100mL
- Pathogen 2 alive and dead: 1e5 CFU/100mL, 1e4 CFU/100mL

The relevant fluxes considered are (coloured as

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

- Pathogen 1
Natural mortality Inactivation due to irradiance - Attachment and detachment
Settling

- Pathogen 2
Natural mortality Inactivation due to irradiance Settling

The mass conservation performance of the WQ Module for dissolved oxygen and summed pathogens (i.e. pathogen 1 and pathogen 2 combined) is presented in Figure S.2, via \(DO_{mb}\), \(PTHa_{mb}\) and \(PTHd_{mb}\). Over the duration of the simulation, mass conservation holds to within 0.02%. It is noted that the alive pathogens mass balance (\(PTHa_{mb}\)) is truncated at 2 weeks because alive concentrations are six orders of magnitude lower that initial conditions by this time, and this pushes mass balance percentage error calculations to approach a divide by zero. Dead pathogen mass conservation is less affected because overall changes are approximately one order of magnitude only. Relevant fluxes used to compute this mass conservation, as well as total pathogen mass conservation, are presented subsequently.