Skip to content

Stabilize orbit recovery and boundary reporting - #503

Merged
krystophny merged 12 commits into
mainfrom
fix/orbit-recovery-stable
Jul 24, 2026
Merged

Stabilize orbit recovery and boundary reporting#503
krystophny merged 12 commits into
mainfrom
fix/orbit-recovery-stable

Conversation

@krystophny

@krystophny krystophny commented Jul 20, 2026

Copy link
Copy Markdown
Member

What changed

  • Keep recursive symplectic retries transactional and retain the intentional
    historical warning-level default with one bounded isolated hold.
  • Try the unchanged adaptive-RK guiding-centre interval first. If the
    conventional B_parallel_star denominator is singular, continue only that
    interval through the established toroidally regularized, axis-local, and
    co-rotating Cartesian recovery cascade.
  • Reject nominally successful recovery states with non-finite phase space,
    impossible pitch, non-positive momentum, or more than 0.5% collisionless
    momentum drift.
  • Return to the requested symplectic method after 256 consecutive safe
    conventional-RK intervals outside the axis/edge hysteresis region.
  • Classify a marker as ORBIT_EXIT_NUMERICAL_CONFINED (code 4) only after all
    recovery paths are exhausted, and only for collisionless guiding-centre
    tracing in warning mode when its last validated normalized toroidal flux is
    below s=0.01. VMEC coordinates already store s; chartmap radii are
    converted as s=rho^2.
  • Keep code 4 unavailable to SPECTRE, W7-X acceptance, collisions, full-orbit
    tracing, strict mode, and every other exit cause. Record it separately in
    NetCDF/results accounting and restart state.

Successful legacy RK intervals, the source ensemble, field, wall, boundary
conditions, symmetry, units, and ordinary Meiss/Boozer symplectic paths remain
unchanged. Intentional deep-passing source screens also remain code 3.

Root cause and bounded fallback

The SQUID failures occur when the conventional guiding-centre factor

B_parallel_star = B + (m/e) p_parallel b dot curl(b)

crosses zero. The release warning policy could leave such a marker frozen
indefinitely; a bounded warning policy exposes the exhausted recovery. Axis
smoothing, denser near-axis reconstruction, Zernike continuation, and naive
curl rescaling do not remove this physical coordinate singularity.

The broad experiment that accepted every finite Newton iterate was rejected:
the exact three-marker SQUID diagnostic exceeded ten minutes instead of the
bounded policy's 43.4 seconds. The final fallback therefore does not advance an
unvalidated state. It closes only an already core-confined marker after all
physical recovery attempts fail, with a separate auditable exit code.

Local validation

  • Candidate: SIMPLE 5a0b7e5de17d154380e68717832c28a7cbf9ffeb and current
    libneo main e2b281b1bc9f9f48f9526622445e0b2c0f8a4984.
  • The full bare fo pipeline passed static analysis, build, the default test
    suite, and lint twice; the final run completed in 314.9 s. No golden record
    changed.
  • Exact W7-X marker 5557 completed 0.1 s with code 0.
  • The exact SQUID diagnostic completed in 43.4 s with codes 4, 4, 2 and zero
    unresolved markers. The code-4 endpoints are at chartmap rho=0.0204 and
    0.0930, hence s=0.00042 and 0.00864; the third marker retains its
    physical wall code 2. Recovery counters match the bounded baseline.
  • The paired 1,024-marker historical runs have zero numerical exits and are
    byte-identical to the preceding physical-recovery candidate: Albert has 958
    physical losses and 66 completions; Meiss--Hazeltine has 966 losses and 58
    completions. Albert differs from the release loss fraction by 1.17 percentage
    points. The larger old Meiss/old-libneo difference predates this patch and the
    old endpoints include severe invariant corruption, so no golden was rewritten
    to conceal it.

Cluster acceptance in progress

The complete paired rerun is live from clean immutable roots with the same
SIMPLE/libneo revisions:

  • JNME on sCluster: build 735896, exact diagnostics 735897, diagnostic gate
    735898, all-case smoke 735899, smoke gate 735900, production array
    735901, and final acceptance 735902. Build, exact diagnostics, and all 14
    smoke cases have passed; full production is running. Each orbit job uses 48
    CPUs and 96 GiB.
  • SPECTRE on institute HTCondor: DAG 156, smoke cluster 157, then all five
    256-marker, 0.3 s production cases. The GNU 14.2 Release binary SHA-256 is
    33f4c760ba4465ce94dc449a9679185776f99cbb2714cc0200cb874b8f1550a5.

Final acceptance requires zero code-102 exits, zero unresolved markers,
unchanged intentional deep-passing screens, the established SPECTRE
populations, and physical loss fractions within one percentage point of the
applicable release or paper reference. This PR remains draft until both full
campaigns pass and the retained historical comparison is explicitly judged.

@krystophny krystophny added the tier/T3 physics or output behavior label Jul 22, 2026
@krystophny krystophny added the size/XL review size over 1000 changed lines label Jul 22, 2026
@krystophny
krystophny marked this pull request as ready for review July 24, 2026 21:58
src/simple_main.f90 conflicted in two initialization sites. PR 503 replaces the
map_boundary_is_lcfs boolean with map_boundary_exit_code and
chart_boundary_kind_effective, whose 'auto' case reproduces the old boolean
exactly; main added invariant_edge_radius for the invariant API. Both are kept:
the boundary classification from this branch, the invariant edge state from
main. map_boundary_is_lcfs survives only in a golden-record reference patch.
@krystophny
krystophny merged commit 69fe8c3 into main Jul 24, 2026
7 checks passed
@krystophny
krystophny deleted the fix/orbit-recovery-stable branch July 24, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL review size over 1000 changed lines tier/T3 physics or output behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant