Skip to content

Enable test_sympl_stell to cover the fortnum multiroot quasi path#391

Open
krystophny wants to merge 4 commits into
mainfrom
coverage/quasi-multiroot-golden
Open

Enable test_sympl_stell to cover the fortnum multiroot quasi path#391
krystophny wants to merge 4 commits into
mainfrom
coverage/quasi-multiroot-golden

Conversation

@krystophny

@krystophny krystophny commented Jun 14, 2026

Copy link
Copy Markdown
Member

Merge order

Merge sequence: #390, then #391. This PR carries the test_sympl_stell
multiroot coverage test that stacks on #390 (the MINPACK-to-fortnum
multiroot swap).

Both PRs are based on main individually, so each diff is cumulative against
main and the two overlap. Merge #390 first. Once it lands, this PR's diff
shrinks to its increment: the test_sympl_stell coverage alone.

Enables the test_sympl_stell unit driver (previously dead code behind an unconditional stop) so the quasi symplectic integrators that call fortnum multiroot_hybrids (MINPACK hybrd1 on main) are actually exercised.

Verification

ref-vs-cur on faepop31 deterministic-FP build: multiroot_hybrids called 359952 times on cur; 10 quasi integrator outputs, 375000 values, all match at RTOL 1e-7/ATOL 1e-12 (worst rel 5.9e-8, convergence-tolerance level). Registered as ctest test_sympl_stell (TIMEOUT 120). This is the only reachable path that exercises the MINPACK->fortnum multiroot swap; production simple.in cases use the orbit_timestep_sympl/newton1 path and never call it.

orbit_symplectic_quasi was the sole consumer of the vendored MINPACK
hybrd1. Replace each of the eight hybrd1 calls with fortnum's
multiroot_hybrids (Newton step with a backtracking line search and a
finite-difference Jacobian), which provides the same warm-started,
Jacobian-free root solve the call sites relied on.

Each f_*_quasi residual now conforms to the multiroot_fn_t interface
(assumed-shape x/f, optional ctx, no iflag); state still travels through
the existing module globals f, fs, si. The f_midpoint_quasi double
field evaluation ordering (midpoint stage saved, then endpoint) is
preserved. xtol and ftol are both set to si%rtol to track the former
hybrd1 stopping behavior.

Wire fortnum via CMake FetchContent (GIT_TAG a7faa3c, guarded by
NOT TARGET fortnum) and link it into the simple library. Delete
src/contrib/minpack.f90, minpack_interfaces.f90, and LICENSE.minpack.
fortnum a7faa3c installed its C ABI header from CMAKE_SOURCE_DIR, which
resolves to the consumer tree under FetchContent and failed SIMPLE's
install step. fortnum main now sources the header from PROJECT_SOURCE_DIR
(9595e51); pin to the merge commit that carries the fix.
test_sympl_stell drives the quasi-symplectic steps (timestep_*_quasi),
the only code path that calls the root solver behind the quasi method
(fortnum multiroot_hybrids on this branch, MINPACK hybrd1 on main). The
quasi block sat behind an unconditional stop and the executable had no
add_test, so the solver swap ran zero times in the suite.

Remove the dead stop so the quasi integrators run, set coord_input and
field_input before init_field (now required since the reference-coordinate
init was added), and register test_sympl_stell as an integration test.

Verified on faepop31 deterministic-FP build: the quasi run calls
multiroot_hybrids 359952 times; the run completes in 72 s under ctest.
@krystophny krystophny changed the base branch from drop-bundled-minpack-use-fortnum-multiroot to main June 14, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant