Skip to content

STRIDE - ENHANCEMENT - Count the fixed-boundary zero crossings (nzero), as RDCON does - #364

Draft
StuartBenjamin wants to merge 3 commits into
PrincetonUniversity:developfrom
StuartBenjamin:psfc/stride-zero-crossing-pr
Draft

StuartBenjamin wants to merge 3 commits into
PrincetonUniversity:developfrom
StuartBenjamin:psfc/stride-zero-crossing-pr

Conversation

@StuartBenjamin

Copy link
Copy Markdown
Collaborator

Problem. STRIDE declares nzero but never sets it, so it gives no fixed-boundary (internal) ideal stability verdict: "Fixed-boundary mode unstable" is never printed and stride.nc has no nzero. Its free-boundary energy does not catch internal modes either. On a DIII-D shot with q_min ≈ 1.02, STRIDE's total1 stays positive on runs that RDCON finds fixed-boundary unstable at n = 1. Testing only at the interval boundaries would be cheap but inexact, because two crossings inside one interval cancel.

Fix. A new switch, calc_nzero in stride_params (default f), turns the count on. It needs asymp_at_sing = t and no Riccati integration. With it off, STRIDE is bitwise the same as before.

How the count works:

  • During the parallel pass: each interval counts the zero crossings of its own principal solution at every ODE step. This uses the inertia of U₂ᴴU₁, from an LDLᴴ factorization; crit is evaluated only on the few steps where the inertia changes.
  • After the stitch: ode_zero_crossings adds the crossings of the axis solution beyond those, from each interval's end data alone. These are the negative eigenvalues of dir·X_sᴴP₁₂⁻¹X_e, a Morse-index split that holds for F̄ > 0.
  • Next to a singular surface: the intervals there start from the asymptotic solutions, so their propagator is too ill-conditioned for that split. There the axis solution itself is integrated and counted at every step.
  • At the singular surfaces: they are crossed as in RDCON's ode_ideal_cross.

nzero is written to stride.nc and drives the existing message. Δ′ and the energies are bitwise unchanged.

Test, with calc_nzero = t (vs develop) Result
docs/examples DIII-D and Solovev resistive, n = 1–4 (8 runs) all STRIDE outputs bitwise; nzero 0, as RDCON; wall time +0 to +41 %
DIII-D shot 174956 with q_min ≈ 1.02, 7 equilibria, n = 1–4 (26 runs) nzero = RDCON on 25 runs; all other STRIDE outputs bitwise; wall time +16 %

The 26th run is a case where RDCON itself is unreliable: it reports 67 to 71 crossings at n = 2, starting exactly on the q = 3/2 surface. There STRIDE gives 0.

🤖 Generated with Claude Code

StuartBenjamin and others added 3 commits October 31, 2026 16:58
…), as RDCON does

STRIDE declared nzero but never set it, so it had no internal (Newcomb) stability verdict. During the parallel pass each interval now counts the zero crossings of its own principal solution (inertia of U^H X by LDL^H at every step; crit is checked only where the inertia changes). After the stitch, ode_zero_crossings adds the crossings of the axis solution beyond those, from the interval's end data alone (negative eigenvalues of X_s^H P12^-1 X_e, a Morse index split valid for F > 0), crossing singular surfaces as RDCON's ode_ideal_cross. This counts every crossing, also two in one interval, with no extra integration. nzero goes to stride.nc and drives the existing "Fixed-boundary mode unstable" message; it needs asymp_at_sing. Delta' and the energies are bitwise unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ution itself there, and cross the surfaces as RDCON

The propagator of an interval that starts from the asymptotic solutions is ill-conditioned, so its end-data correction gave false crossings (174956_1131 n = 3, 4). Those intervals now integrate the axis solution and count it at every step. The surface crossing zeroes the resonant components of every column, as RDCON's ode_ideal_cross does. sing_derFM takes any number of columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (default off)

The count adds about 16 % to the wall time, so it runs only when asked. With calc_nzero = f STRIDE is bitwise the same as before and writes no nzero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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