Skip to content

End Meiss lines behind the wall where h_phi vanishes - #783

Merged
krystophny merged 5 commits into
mainfrom
fix/meiss-behind-wall
Nov 9, 2026
Merged

krystophny merged 5 commits into
mainfrom
fix/meiss-behind-wall

Conversation

@krystophny

@krystophny krystophny commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Risk tier

  • T3: physics, output behavior, coordinate convention

Correctness contract

Intended behavior change

On a wall chart that reaches past the wall, the radial Meiss ODE $\lambda' = -h_r/h_\varphi$ has no solution where $h_\varphi = \mathbf b\cdot\mathbf e_\varphi$ changes sign. On the W7-X KJM map2disc chart (LCFS + 0.8 m) in the frozen-current field of W6 t = 1.05 s this happens on 1588 of 4032 radial lines between the wall and the chart edge, and init_meiss stopped with "Meiss transformation ODE failed".

With wall_input set, a line now ends at the last node where $|h_\varphi| \ge 0.1,|h_\varphi(r_\text{min})|$; $\lambda$ and $\chi$ are held from there (cut_line). Along the W7-X Meiss lines the smallest ratio met before the wall is 0.21, except on one line that runs through an opening of the STL wall and never meets it. A marker beyond the end of a line of its grid cell therefore stops as a numerical domain exit (orbit_exit_code 101) instead of being traced in a non-canonical field (beyond_meiss_cut, checked after the wall query of each symplectic microstep, also for Albert via its Meiss radius). Initialisation reports how many ended lines meet the wall first.

The line through the node where $A$ is gauged to zero starts with $\chi = \chi' = 0$; with a purely relative error scale its first step fell to roundoff (W7-X: ierr = 1 at node 2 of $\theta = 0$, $\varphi = 0$ with a smooth right-hand side). The ODE call now passes libneo's scale_floor, set to 1e-6 of the change of $\lambda$ and $\chi$ over one grid interval, so it prevents the underflow without relaxing the requested tolerance (test_spectre_freeboundary still sees its step-limit failure).

Behavior that must not change

Without wall_input no line is cut and an ODE failure still stops initialisation.

Coordinate / unit conventions

Unchanged.

Numerical invariants

The canonical form holds up to r_cut(i_th, i_phi); no marker is traced beyond it.

Tests added

  • unit: test_meiss_line_cut (chart whose outer surfaces tilt toroidally, $h_\varphi \propto B_0R_0 - B_z d\rho^6\sin\varphi$): some lines end, none before $r = 0.85$, the canonical field stays finite on them, and a point past an end lies outside the domain. It does not compile without the change.

Golden-record impact

  • unchanged
  • changed: the floor can change Meiss and Albert transformations at the level of the ODE tolerance; the merge queue's golden records decide.

Verification

The Meiss tests (test_meiss_line_cut, test_field_can_meiss_config, test_chartmap_wall_losses, test_profile_radius_meiss*) pass locally with GCC 16. The W7-X numbers come from diagnostics on sCluster in the W6 t = 1.05 s frozen-current field.

Chris&AI

On a wall chart that extends past the wall, h_phi = b . e_phi can change
sign between the wall and the chart edge, and the radial Meiss ODE fails
there (W7-X KJM chart: 1588 of 4032 lines, all at least 0.2 in r behind
the wall). With a wall, a line now ends at the last node where |h_phi|
is at least 0.2 of its first value, and initialisation checks that every
ended line crosses the wall before that node.
The line through the node where A is gauged to zero starts with chi = 0
and chi' = 0; with a purely relative error scale the step fell to
roundoff and the W7-X wall-chart construction failed at its first node.
@krystophny krystophny added tier/T3 physics or output behavior size/M review size up to 300 changed lines labels Nov 9, 2026
@krystophny
krystophny added this pull request to the merge queue Nov 9, 2026
@krystophny
krystophny removed this pull request from the merge queue due to a manual request Nov 9, 2026
In W7-X one Meiss line runs through an opening of the STL wall before
h_phi vanishes, so the wall alone does not keep markers inside the valid
canonical domain. Markers beyond the end of a line of their grid cell now
stop as numerical domain exits, and initialisation reports such lines
instead of stopping. The cut fraction drops to 0.1: the smallest ratio
met before the wall on any other W7-X line is 0.21.
@krystophny
krystophny added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
A unit floor removed the accuracy demanded of SPECTRE constructions in
SI units (test_spectre_freeboundary expects a step-limit failure at
ode_relerr 1e-4). The floor is now 1e-6 of the change of lambda and chi
over one grid interval.
@krystophny
krystophny added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 342f10b Nov 9, 2026
13 checks passed
@krystophny
krystophny deleted the fix/meiss-behind-wall branch November 9, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M review size up to 300 changed lines tier/T3 physics or output behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant