Skip to content

The regression testbench

MultiFlow comes with a regression testbench in testcases/. Before a change is merged into master, the testbench builds MultiFlow in the configurations of about 25 representative cases, runs them (several also in parallel), and checks the results. A full run takes one to two hours on a workstation.

The testbench is primarily a regression test: it checks that the code still produces the results it produced before, not that these results are physically correct. Physical verification and validation are done in the publications and in the dedicated suites of some models (see Front tracking). A passing testbench is necessary for a change, but it does not prove that the change is correct for every model and every configuration.

Groups of test cases

Group Cases What is tested
Single-phase flow and solvers LDC, SOLVER, VISCOELASTIC the incompressible flow solver, the pressure-velocity coupling and linear solvers, restarts, viscoelastic flow
DEM DEM, DEM-SKIN, DEM-MOVINGWALLS, DEMSQ, DEMSQC, DEMMS, DEMMS-SKIN, DEM-BODIESRANKS, DEM-RESTART, DEM-RESTART-WEAR, DEM-ROTATINGFRAME, DEM-UNITTESTS spheres, superquadrics and multi-sphere bodies, neighbour lists, STL walls, wear, rolling resistance, restarts, parallel consistency, the contact functions
CFD-DEM and IBM FB, FB-FILTER, FB-IRL, IBM, MOVEIBM-RESTART fluidized beds with the unresolved CFD-DEM coupling, the immersed boundary method for resolved particles
Front tracking FT, FT_Sharp_CSF, FT_Sharp_Integral, MFTL-ADAPTER rising bubbles with the classic and the sharp front-tracking methods, the MFTL2 integration layer
Code quality and memory FORMAT, TIDY, VALGRIND, build warnings formatting, static analysis, memory errors and leaks, zero-warning builds

Kinds of checks

The testbench combines several kinds of checks:

  • Comparison with stored references. The HDF5 output (fields, particles) is compared element by element with reference files. Floating-point values pass if |test - ref| <= ABS_TOL + REL_TOL*|ref| (by default REL_TOL = 1e-4, ABS_TOL = 1e-7); integers and strings must be equal. Parallel runs have their own references, because the ordering of the cells in the HDF5 files depends on the partitioning.
  • Consistency checks without a stored reference. A restarted run must reproduce the continuous run; runs on different numbers of processors must agree (bitwise, or to round-off); two methods that must give the same answer (e.g. neighbour lists with and without a skin) are compared with each other.
  • Unit and verification tests. Small programs that drive individual functions (the DEM contact laws, the front-tracking adapter) and compare them with closed-form or brute-force answers.
  • Static and memory checks. Every case must compile without a single warning; the sources must be formatted; clang-tidy must find nothing beyond a reviewed list of accepted findings; two DEM runs are checked with valgrind.

Running the testbench

The testbench is driven by one script:

cd $MF3_DIR
testcases/TESTS/dotests.sh                    # full run: formatting check and every case
testcases/TESTS/dotests.sh --list             # the names of the cases, with a one-line description
testcases/TESTS/dotests.sh LDC IBM            # selected cases only, exactly as in the full run
testcases/TESTS/dotests.sh --workdir DIR FT   # use DIR (outside the repository) for the builds and reports

Each case is configured and built from scratch as a Debug build, with the compile options of that case (see Compile options), in testcases/TESTS/BUILDS; the build directory is removed after the case. MFTL2 and IRL are switched on only for the cases that need them. Before the first case that needs MFTL2, the testbench builds and installs MFTL2 from its current sources (testcases/buildmftl2.sh), so that every result is obtained with an MFTL2 that matches its sources. One work directory can be used by only one run at a time; use --workdir to run two testbenches side by side.

Requirements. Besides the usual libraries (Obtaining the code) the testbench needs python3 with numpy and h5py, mpirun, clang-format and clang-tidy, and optionally valgrind with a PETSc build for it (see Code quality and memory).

The environment. The testbench does not use the environment of your shell. It sources testcases/TESTS/setupenvironment.sh, which fixes the paths of the reference machine, so that every run uses the same libraries:

export PETSC_DIR="/usr/local/petsc"
export PETSC_ARCH="linux-gcc-dev"                  # a PETSc debug build
export MPI_HOME="/usr"
export MF3_DIR="$HOME/git/Code/multiflow"
export MFTL2_SRC="$HOME/git/Code/MFTL2"            # MFTL2 sources, built and installed by testcases/buildmftl2.sh
export MFTL2_ROOT="$MFTL2_SRC/install"
export IRL_DIR="$HOME/git/Code/interface-reconstruction-library"
export MFIRL_C_DIR="$HOME/git/Code/multiflow-irl-c-interface"

On another machine, adapt these paths (in a local, uncommitted copy) to your installation. Note that the testbench uses a PETSc debug build (linux-gcc-dev, see Configure and build PETSc).

Results

The reports are written to the work directory (testcases/TESTS, or DIR/TESTS with --workdir DIR) and are reset at the start of every run:

File Content
RESULTS.txt one line per check (PASS, FAIL, WARNINGS, NOT-VALIDATED, SKIPPED, NOTE), the build configuration and run command of each case, and a summary
SIMULATION_ERROR.txt failed runs and the detailed reports of failed comparisons
MAKE-ISSUES.txt every build with warnings or errors
CMAKE-ERRORS.txt failed CMake configurations
ISSUES.txt, AFFECTED-FILES.txt files that are not formatted, with their diffs
TIDY-ISSUES.txt clang-tidy findings that are not in the reviewed baseline

The exit status of dotests.sh summarises the run:

Status Meaning
0 every executed check passed and was validated
1 a check failed (configuration, build or build warning, simulation, comparison, formatting, static analysis)
2 nothing failed, but at least one comparison is not validated (e.g. a reference is missing)
3 usage error (unknown case or option, invalid work directory)
4 another run is using the work directory

Reference data

The reference results are not part of the repository. They are kept in a shared directory of the group; another directory can be given with MF3_TEST_REFDIR=DIR, but a run with this setting is never reported as validated (exit status 2). A missing reference is reported as NOT-VALIDATED, never as a pass.

References are changed only deliberately, by a person, with testcases/TESTS/regenerate_baselines.sh, and every regeneration is recorded (branch, commit, MFTL version, PETSc arch, rank counts) in REGEN_PROVENANCE.txt in the reference directory. A failed comparison is to be diagnosed: a genuine regression, an intended change of the numerics, round-off from a different MPI decomposition, or an outdated reference. It is never fixed by updating the reference or loosening the tolerances without that diagnosis.

Front-tracking references. The references of FT, FT_Sharp_CSF and FT_Sharp_Integral depend on the MFTL version that produced them; they were regenerated with MFTL2 on 2026-11-09. The testbench reads the provenance of the reference and reports a comparison against a reference of MFTL1 (or of unknown origin) as NOT-VALIDATED.

Adding a test case

A test case is a directory in testcases/ with an input file (.mf) and the USER*.c files of the case (see Input file and Compiling the code), and a block in testcases/TESTS/dotests.sh that configures, builds, runs and checks it. Keep the cases small (seconds to a few minutes), use as few time-steps as are needed to exercise the feature, and test both a serial and a parallel run when the feature involves communication. Add the same case to regenerate_baselines.sh and create its reference files deliberately.