Mass-conservation verification

Purpose

This case is a controlled closed-box sanity check for the finite-volume transport core. In a closed domain with no emissions and no deposition,

a discrete tracer mass

\[M^n = \sum_p \rho_p\,V_p\,C_p^n\]

should be preserved up to solver / round-off tolerance, provided the boundary flux is zero.

The script verifies three properties:

  1. Advection-only mass conservation under a divergence-free recirculating flow and impermeable (zero normal flux) boundaries.
  2. Global budget closure when adding a known source and a first-order decay sink, consistent with the discrete mass tendency equation.
  3. Constancy preservation for a uniform mixing-ratio field under strongly divergent face velocities.

These checks isolate conservation and sign conventions (source vs. sink) before running real-data workflows (ETEX/CAMS/etc.).

Configuration

The tests use a 96×96×16 grid over a 4 km × 4 km × 0.8 km domain with a circulation scale U0 = 6 m s⁻¹. The run integrates 300 time steps with CFL = 0.45.

The boundary condition is a closed box (impermeable boundaries; zero normal flux). The imposed face-velocity field is constructed to be divergence-free to numerical round-off.

Results

Advection-only mass conservation

We monitor the relative mass error

\[\varepsilon_{\mathrm{mass}}^{n}=\frac{\lvert M^{n}-M^{0}\rvert}{M^{0}}.\]

In the advection-only case (no sources, no sinks), TARSA conserves mass to machine precision. For the reference run, the maximum and end-of-run drift are both

  • max |ΔM/M0| = 1.99×10⁻¹⁶.

The discrete velocity field is divergence-free to numerical round-off:

  • ||∇·u||∞ = 2.52×10⁻¹⁷.

This confirms that the observed conservation is consistent with the flux-form discretisation.

Budget-closure test (source + decay)

A second test adds:

  • a constant volumetric source in one cell, and
  • a uniform first-order decay rate $\lambda$.

The discrete mass tendency should satisfy

\[M^{n+1}-M^{n}=\Delta t\left(\sum_p E_p\,\rho_p V_p-\sum_p \lambda\,C_p^{n}\,\rho_p V_p\right)+\mathcal{O}(\text{solver/roundoff}).\]

For the reference run, the maximum budget residuals are:

  • max |residual| = 7.33×10⁻⁸ (mass units)
  • max relative residual = 3.81×10⁻¹⁶.

Together, these checks indicate that the split explicit advection update preserves discrete mass and closes the global budget to numerical precision.

Why this case matters

  • isolates numerical conservation properties from real-data complications
  • catches boundary-condition mistakes and source/decay sign errors early
  • provides a fast regression test before ETEX, CAPTEX, and CAMS pipelines

How to run

Scripts

Folder: validation/MASS_CONSERVATION

Main script:

  • validation/MASS_CONSERVATION/validation_mass_conservation.jl

Run

julia --project=. validation/MASS_CONSERVATION/validation_mass_conservation.jl

Outputs

The script writes three regression CSVs:

  • validation/MASS_CONSERVATION/out/mass_conservation_constancy.csv
  • validation/MASS_CONSERVATION/out/mass_conservation_advection.csv
  • validation/MASS_CONSERVATION/out/mass_conservation_budget.csv

These are used to track constancy error, conservation drift, and budget residuals across code changes.