Bound SPECTRE canonical construction#484
Merged
Merged
Conversation
fad64c6 to
59f88a4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Risk tier
Correctness contract
Intended behavior change
Make SPECTRE's per-volume Meiss construction bounded and diagnosable. The ODE now returns a catchable status through libneo, reports the failing radial, poloidal, and toroidal indices, and accepts explicit spline-order, step-limit, and relative-tolerance controls. Construction-only transformation arrays and five redundant field-component arrays no longer overlap the retained batch-spline allocation. Explicit
startmode = 2SPECTRE runs now initialize the magnetic-field bounds used only for trapped/passing diagnostics, eliminating non-finite diagnostic output without changing starting points or orbit dynamics.The SPECTRE construction ODE tolerance defaults to
1e-2; tighter settings failed to construct the seven-volume Meiss equilibrium even after one million accepted/rejected steps. The established48 x 48 x 32, quintic non-axisymmetric grid remains the default. Smaller grids and cubic splines are opt-in only.Behavior that must not change
The canonical coordinates remain
(r, theta, zeta)with stacked SPECTRE volume radius and dimensionless angles in radians. Vector-potential, covariant-field, and magnetic-field units are unchanged. The batch spline still stores(A_theta, A_zeta, h_theta, h_zeta, |B|)and uses the same periodicity and per-volume interface boundaries.Default grid dimensions and spline order are unchanged because the lower-grid candidates did not preserve the existing interface-crossing convergence tests. Successful construction remains deterministic and thread-safe; repeated construction produces bit-identical field values and 64 concurrent evaluations reproduce the same finite value.
Numerical invariants
The completed chart retains the existing guiding-center energy, canonical toroidal momentum, crossing landing, step-halving, and particle-accounting checks. The ODE status path returns the last accepted state only on failure and never exposes a partial SPECTRE chart. A failed construction is cleaned up and a later construction can succeed.
Dependency
Requires merged libneo PR #391 (
e451e0a42f5228d85b0479de40aa35db8b48239d), which adds the catchable ODE step-limit status without changing successful integrations.Measured construction envelope
On the seven-volume Meiss equilibrium with 14 fixed markers and identical tracing settings:
48 x 48 x 32, quintic: 5,306.5 MiB peak RSS, 81.33 s, all 14 markers confined, maximum relative energy drift4.39e-824 x 24 x 16, quintic: 779.4 MiB, 27.22 s, maximum Poincare errorsds=1.79e-4,dtheta=7.58e-524 x 24 x 16, cubic: 255.7 MiB, 20.95 s, maximum Poincare errorsds=3.77e-4,dtheta=2.73e-416 x 16 x 16, cubic: rejected (ds=1.77e-2,dtheta=8.11e-3)Despite their smooth-orbit accuracy, both 24-point candidates are kept opt-in because the existing SPECTRE crossing golden tests reject them as global defaults.
Tests added or changed
Verification
Failing before, against main:
The initial lower-default experiment also failed the existing physics gates:
Those defaults were rejected and restored to
48 x 48, quintic. Passing after: