Skip to content

DCON/RDCON/STRIDE - BUGFIX - First ODE step next to a singular surface no longer than the distance to it - #375

Open
StuartBenjamin wants to merge 3 commits into
PrincetonUniversity:developfrom
StuartBenjamin:bugfix/ode-first-step-at-surfaces
Open

StuartBenjamin wants to merge 3 commits into
PrincetonUniversity:developfrom
StuartBenjamin:bugfix/ode-first-step-at-surfaces

Conversation

@StuartBenjamin

Copy link
Copy Markdown
Collaborator

Problem. DCON, RDCON and STRIDE start every ODE integration with the step psilow*1e-3, including the restart just past each singular surface. When qlow is above q0, the codes move the start of the integration out to q = qlow (ψ ≈ 1e-2 instead of 1e-5). The first step then becomes about 1000 times the singfac_min/|n q'| offset at high-shear surfaces near the edge.

  • The corrector fails 10 times on that first step and the solver gives up. The step size reported at the failure is exactly the first step divided by 4⁹.
  • STRIDE stops with "ZVODE1 integration failure".
  • DCON and RDCON cross the next singular surface from wherever the step failed. The run then either goes on past psilim with wrong energies and zero crossings, or loops on "T + H = T" and never ends.
  • STRIDE runs that do finish can also be off at the first surfaces after a move.

Fix. The first step next to a surface is now no longer than the distance to it: in STRIDE's interval integration and in the DCON/RDCON restarts, as ode_sing_init already does. DCON and RDCON also stop with a message when LSODE fails. Nothing changes where psilow*1e-3 is already the smaller step.

Tested on docs/examples/DIIID_resistive_example (q0 = 1.20) with psihigh = 0.999, n = 1–4 and singfac_min = 1e-4 and 1e-5:

Case develop this branch
qlow = 1.02 (start stays at the axis), 24 runs — energies and RDCON Δ′ the same to 4 digits or better; STRIDE Δ′ the same inside ψ_N = 0.98 and up to a few % on the surfaces beyond it, where the offset is below the old first step
qlow = 1.3, n = 3, singfac_min = 1e-5 STRIDE: ZVODE1 stop; RDCON: LSODE failure, total energy −2.59 all three run; RDCON −1.69
qlow = 1.3, n = 4, singfac_min = 1e-5 STRIDE: ZVODE1 stop; DCON total −0.38, RDCON −3.0e5 (both after an LSODE failure) DCON −2.21 (= the qlow = 1.02 value), RDCON −29.5 (= the singfac_min = 1e-4 value)
qlow = 1.3, n = 2, singfac_min = 1e-4: STRIDE Δ′ against RDCON's Galerkin Δ′ q = 3/2: +1.85 vs −4.73; q = 5/2: −99.6 vs −4597 −4.05; −3524

Run times are unchanged. At tight tolerances (1e-10), develop and this branch give the same energies on the example where both run. On our own equilibria with q0 just below qlow, the fixed codes agree on the ideal energy (DCON / RDCON / STRIDE: 0.678 / 0.679 / 0.675 and 1.224 / 1.225 / 1.225). Their Δ′ agree within 3e-4 inside ψ_N = 0.95.

One restart path still uses the axis step: a Gaussian-reduction restart before the first singular surface. No failure there has been seen.

🤖 Generated with Claude Code

StuartBenjamin and others added 3 commits November 26, 2026 18:09
… than the distance to it

The initial ZVODE step is psilow*1e-3 for every interval. When q0 < qlow moves psilow off the axis (to
q = qlow), that step is ~1e3 times the singfac_min/|n q'| offset at high-shear edge surfaces and the
corrector fails ("ZVODE1 integration failure"). Cap it at the distance to the surface. Unchanged where
psilow*1e-3 is already smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o longer than the offset, and stop on LSODE failure

ode_ideal_cross restarts LSODE with the axis step psilow*1e-3. When q0 < qlow moves psilow off the axis,
that step is ~1e3 times the offset from high-shear edge surfaces and LSODE fails; ode_run then crossed the
next surface from where the step failed, giving wrong energies and zero crossings or a run that never
ends. Cap the restart step at the offset (as ode_sing_init does) and stop when LSODE fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… longer than the offset, and stop on LSODE failure

The ideal, kinetic and resistive crossings restart LSODE with the axis step psilow*1e-3, as in RDCON.
Cap the restart step at the offset (as ode_sing_init does) and stop when LSODE fails instead of crossing
the next surface from where the step failed.

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