Files
MeanField/experiments/README.md

74 lines
3.4 KiB
Markdown

# Accuracy experiments
This directory is deliberately separate from `tests/`. It uses Catch2 only as
an MPI-aware runner, selector, configuration host, and failure reporter. A run
fails only when the calculation is invalid (for example, non-finite output or a
failed linear solve); measured accuracy is written as data, not as a regression
tolerance.
`experiment_main.cpp` registers the `experiment` Catch2 reporter. It collects
rows recorded with `record_experiment_result` and writes one wide CSV table on
MPI rank zero. Each row carries sweep parameters and numerical metrics, so
results can be plotted or compared across commits.
The initial budget has three sweeps at fixed mesh and polynomial orders:
1. linear-solver tolerance: `1e-8`, `1e-10`, `1e-12`, `1e-14`;
2. production quadrature boost: `0`, `4`, `8`;
3. reference-space decomposition: numerical field/potential error, analytic
projection error, and numerical-to-projection gap.
Run only the budget and choose its output path with:
```text
./mean_field_experiments --experiment-output gravity_budget.csv --catch2 "[accuracy]"
```
## Stellar-equilibrium null-space experiments
`stellar_null_space_experiments` is a dedicated diagnostic executable rather
than an ordinary verification or validation test. It constructs the analytic
`n = 3` Lane-Emden seed, probes the three computational translations and three
computational rotations, and compares the Jacobian before and after the strong
centering-row replacement. It records total and residual-block response norms,
the isolated centering contribution, and centered finite-difference errors.
The experiment prints rank-zero progress messages while it builds the seed,
solves its gravity field, and completes each rigid-mode case. Run it with:
```text
mpirun -np 1 ./cmake-build-debug-homebrew/stellar_null_space_experiments \
--experiment-output stellar_null_space.csv \
--catch2 "[null_space][rigid_motion]"
```
The rotation sweep includes zero rotation and a spherical-state diagnostic at
half the Keplerian angular speed. The rotating result is an operator-symmetry
probe, not a definitive rotating-equilibrium null-space measurement.
The gravity-completed probe solves the linearized mixed gravity subsystem for
the gravity-gradient and gravity-potential variations accompanying each rigid
displacement. It then measures the complete equilibrium response with and
without the centering rows:
```text
mpirun -np 1 ./cmake-build-debug-homebrew/stellar_null_space_experiments \
--experiment-output gravity_completed_null_space.csv \
--catch2 "[null_space][gravity_completed]"
```
The gravity solver prints its convergence summary, while the experiment prints
the current mode and completed-case count. This probe prepares each rotation
state only once and does not repeat the expensive nonlinear finite-difference
calculations from the original rigid-motion diagnostic.
A whole-Jacobian dense singular-value experiment is intentionally deferred.
The checked-in `sandbox.smesh` is too large for a useful dense SVD, and the
current matrix-free root operator does not provide a transpose action needed by
a scalable smallest-singular-value method.
The executable needs the same dependencies, generated module mapping, and
configuration registration as the existing Catch2 test executable. Add
`experiment_main.cpp` and `gravity_accuracy_budget.cpp` as a second executable
next to that target; do not add them to the ordinary test executable.