From 75b694cb97085aecdff11584031cf70d6d947a4d Mon Sep 17 00:00:00 2001 From: StuartBenjamin Date: Thu, 26 Nov 2026 18:09:12 -0500 Subject: [PATCH 1/3] STRIDE - BUGFIX - First ODE step next to a singular surface no longer 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 --- stride/ode.F | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stride/ode.F b/stride/ode.F index be2b8456..d69c96d9 100644 --- a/stride/ode.F +++ b/stride/ode.F @@ -415,6 +415,9 @@ SUBROUTINE ode_run rwork=0 rwork(1)=endPsi rwork(5)=axisPsi*1e-3*psiDirs(iInterval) + !First step no longer than the distance to the surface + IF (ising /= 0) rwork(5)=psiDirs(iInterval)* + $ MIN(axisPsi*1e-3,ABS(startPsi-sing(ising)%psifac)) rwork(11)=rwork(5) CALL SYSTEM_CLOCK(COUNT=sTime) DO WHILE(psiDirs(iInterval)*startPsi From 2f259bd154a61b4d5d6b1a85801560165440f0d3 Mon Sep 17 00:00:00 2001 From: StuartBenjamin Date: Thu, 26 Nov 2026 18:09:12 -0500 Subject: [PATCH 2/3] RDCON - BUGFIX - Restart LSODE after a singular surface with a step no 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 --- rdcon/ode.f | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rdcon/ode.f b/rdcon/ode.f index 81a98070..64d33507 100644 --- a/rdcon/ode.f +++ b/rdcon/ode.f @@ -469,6 +469,7 @@ SUBROUTINE ode_ideal_cross istate=1 istep=istep+1 rwork(1)=psimax + rwork(5)=MIN(rwork(5),dpsi) new=.TRUE. u_save=u psi_save=psifac @@ -544,6 +545,8 @@ SUBROUTINE ode_step istep=istep+1 CALL lsode(sing_der,neq,u,psifac,psiout,itol,rtol,atol, $ itask,istate,iopt,rwork,lrw,iwork,liw,jac,mf) + IF(istate < 0) + $ CALL program_stop("RDCON STOP: LSODE integration failure.") c----------------------------------------------------------------------- c diagnose error. c----------------------------------------------------------------------- From e813d1c259de87163869492774ff374583a616a5 Mon Sep 17 00:00:00 2001 From: StuartBenjamin Date: Thu, 26 Nov 2026 18:09:12 -0500 Subject: [PATCH 3/3] DCON - BUGFIX - Restart LSODE after a singular surface with a step no 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 --- dcon/ode.f | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dcon/ode.f b/dcon/ode.f index 524e7a9e..d87ac822 100644 --- a/dcon/ode.f +++ b/dcon/ode.f @@ -563,6 +563,7 @@ SUBROUTINE ode_ideal_cross istate=1 istep=istep+1 rwork(1)=psimax + rwork(5)=MIN(rwork(5),dpsi) new=.TRUE. u_save=u psi_save=psifac @@ -671,6 +672,7 @@ SUBROUTINE ode_kin_cross istate=1 istep=istep+1 rwork(1)=psimax + rwork(5)=MIN(rwork(5),dpsi) new=.TRUE. u_save=u psi_save=psifac @@ -871,6 +873,7 @@ SUBROUTINE ode_resist_cross istate=1 istep=istep+1 rwork(1)=psimax + rwork(5)=MIN(rwork(5),dpsi) new=.TRUE. u_save=u psi_save=psifac @@ -953,6 +956,8 @@ SUBROUTINE ode_step istep=istep+1 CALL lsode(sing_der,neq,u,psifac,psiout,itol,rtol,atol, $ itask,istate,iopt,rwork,lrw,iwork,liw,jac,mf) + IF(istate < 0) + $ CALL program_stop("DCON STOP: LSODE integration failure.") c----------------------------------------------------------------------- c diagnose error. c-----------------------------------------------------------------------