S.4 Calculations

The primary calculation used to assess mass conservation for each computed variable \(X\) is a comparison between two independent calculations of instantaneous mass in the model as 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 (column ‘MF_PCT_ERROR’ in mass flux output csv files) 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\) (column ‘MF_WQ_MASS’ in mass flux output csv files). 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\) (column ‘FV_WQ_MASS’ in mass flux output csv files). 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}\]

None of the quantities above need to be computed by the user - all are output directly in files created when the Massbalance output block is called (see Section 4.9.2):

Output == Massbalance
  Output Interval == 900.00
End Output

As a general note, reported fluxes often need to be interpreted 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 cumulative action of fluxes at every 15 minute increment, the on-the-hour 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.