Skip to content

Testing

The suite has two tiers. The fast one runs in well under a minute and is meant to be run before every commit. The slow one produces the convergence and balance-closure evidence, and is run deliberately.

Both need a CUDA build, which is the only configuration the suite supports.

Fast tier

make test-fast

This builds a separate binary, guernica-tests, that links the solver's own object files and calls the operators directly, then runs two short end-to-end cases: smoke_transient (a short transient run with a collision operator) and smoke_steady (a few hundred steady iterations with walls). The unit tests cover:

  • the phase-space layout, the velocity grid, and the velocity-moment quadrature,
  • the GLL-DGSEM advection operator, against free-stream preservation and against the exact derivative of a polynomial of degree at most p,
  • the BGK operator, against conservation and the Maxwellian fixed point,
  • the anisotropic perturbed Maxwellian, against its moment neutrality,
  • the FFT charge-exchange operator, against a direct convolution computed without any transform, against the single-precision path, against particle conservation, and for convergence of the discrete rate between two Maxwellians with the velocity grid,
  • the wall operator: specular, absorbing, emitting, and partially specular walls, and the wall flux diagnostics,
  • the collision container used by the steady solver,
  • the unit normalization ([units] mass_amu),
  • the analytic profile types, against their closed forms,
  • config parsing and the validation rules that reject a bad case.

make test-unit runs only the unit binary. It accepts the usual doctest flags, so a single case can be run by name:

./guernica-tests --test-case="*charge exchange*"

Verification tier

make test-verify

Five cases:

Case What it demonstrates
v1_h_refinement The advection error falls as h^(p+1) under mesh refinement.
v2_p_refinement The error falls faster than any power of the order on a fixed mesh.
v3_steady_balance The particle and energy budgets close at a converged steady state.
v4_collision_properties Mass, momentum and energy survive the time integration, and entropy never falls.
v5_moment_neutral_relaxation A moment-neutral perturbation of a Maxwellian relaxes under BGK with the invariants flat and entropy monotone (a short version of configs/bgk_verification.cfg).

The advection cases advect a periodic profile for exactly one period, so the exact solution at the final time is the initial condition and the error is the difference between two fields on identical degrees of freedom. No analytic solution has to be evaluated on the DG basis.

Each case writes a JSON file into verification_results/ holding the numbers it measured, not merely whether it passed, so a run leaves a record that can be compared against a later one.

Meshes are generated rather than committed. tests/tools/make_mesh emits the uniform Cartesian families the cases need into their own run directories, which live under test_runs/. make clean-tests removes the test binaries, test_runs/ and verification_results/.

What is not covered

  • The CPU and OpenMP builds. Everything here runs on the CUDA build, so those two configurations have no guard.
  • The four non-FFT charge-exchange models, recombination, the Voronov ionization model, the volume source, ion-recycling walls, and plasma-interface leakage. Constant-rate ionization appears only in the steady balance case.
  • The resume and restart path.