Repository navigation
Fix NordsieckBDF trial-step interpolation for delay equations - #4575
Merged
ChrisRackauckas merged 1 commit intoSep 17, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
DelayDiffEq consumes the step's interpolation data inside perform_step! (advance_or_update_ode_integrator! and the fixed-point history refresh), before the adaptive acceptance controller runs. NordsieckBDF only published integrator.k on acceptance, so delayed RHS evaluations inside the current step saw the previous step's committed polynomial. Produce the trial interpolant on demand instead: while the Nordsieck array is in the predicted state (cache.predicted), a requested rebuild of the step's columns (always_calc_begin, or force_calc_end as DelayDiffEq's advance/update pass) yields the corrected trial polynomial zn[j] + l[j]*acor — exactly what nordsieck_complete! commits on acceptance. Evaluation-only callers keep the committed columns, so mid-step integrator(t) and saved-solution interpolation are unchanged. Also make nordsieck_predict! idempotent: DelayDiffEq's fixed-point iteration re-invokes perform_step! on the same uncommitted step, and zn must not be Pascal-shifted again while already predicted. Builds on the approach in SciML#4559 by moving the trial/committed split into _ode_addsteps! and covering the lag < dt fixed-point path. Co-Authored-By: Sven Zenker <[email protected]> Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.10.27 Agent-Model: SWE-2 Max Agent-Session: local session transcript /home/crackauc/.local/share/devin/cli/summaries/history_fa4fe6012694472c.md
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 17, 2026
Ships the NordsieckBDF trial-step interpolation fix for delay equations (#4575) and the roundoff-tolerant SBDF dt-change reset (#4574). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL)
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 17, 2026
Ships the NordsieckBDF trial-step interpolation fix for delay equations (#4575) and the roundoff-tolerant SBDF dt-change reset (#4574). Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL) Co-authored-by: Claude <[email protected]>
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.
Summary
Supersedes #4559 with a different mechanism for the same bug (credit to @svenzenker for identifying and first fixing it).
The bug: DelayDiffEq consumes the step's interpolation data inside
perform_step!—advance_or_update_ode_integrator!copiesintegrator.kinto the history integrator right after the step, and the fixed-point iteration refreshes it per iteration — all before the adaptive acceptance controller runs in_loopfooter!.NordsieckBDFonly publishedintegrator.kon acceptance (step_accept_controller!→nordsieck_complete!), so a delayed RHS evaluation inside the current step saw the previous step's committed polynomial — stale by a step and at the wronghscale.The fix: produce the trial interpolant on demand in
_ode_addsteps!instead of publishing eagerly inperform_step!:cache.predictedholds (post-perform_step!, pre-acceptance),znis the uncommitted trial state. A rebuild request (always_calc_begin, orforce_calc_end— which DelayDiffEq'sadvance_ode_integrator!/update_ode_integrator!pass) materializes the corrected trial polynomialzn[j] + l[j]*acor— bit-for-bit whatnordsieck_complete!commits on acceptance, so trial and post-acceptancekagree exactly.always_calc_begin = force_calc_end = false:integrator(t),sol(t),get_du) keep the committed columns — mid-step interpolation semantics are unchanged, and saved dense output can't be overwritten by trial data while the HistoryODEIntegrator shares the cache forDefaultCache/CompositeCacheconfigs.NordsieckBDF/DNordsieckBDF, constant and mutable caches, via the existingUniondispatch.Also fixed (pre-existing, exposed by #4559):
nordsieck_predict!is now idempotent via thepredictedflag. DelayDiffEq's fixed-point iteration forlag < dtre-invokesperform_step!on the same uncommitted step; without the guard,znis Pascal-shifted once per iteration and the trial polynomial driftsk·dtforward. This is thelag < dtcase #4559 leaves broken — measured error ~0.1 there vs ~8e-9 here.Differences vs #4559: trial
kis generated on demand in_ode_addsteps!rather than eagerly inperform_step!(soperform_step!itself is net unchanged, rejection/retry semantics untouched, and the corrected DAE variants come along through the shared methods), and thelag < dtfixed-point path is fixed rather than regressed.Test plan
New DelayDiffEq regression
test/integrators/nordsieck.jl(registered in theIntegratorsgroup): exact-solution DDEu' = -e^{-lag} u(t-lag)withlag = 0.2(saved-history path) andlag = 0.02(fixed-point path), in-place/out-of-place RHS, with/without a continuous callback; asserts a rejection occurs, dense output matchesexp(-t), and the callback fires once nearlog(2).master, the new testset fails 20/40 — both the stale long-delay interpolation (sol err ~1.8e-3, history err ~1.6e-2, event time off ~3.4e-3) and thelag < dtfixed-point drift.NordsieckBDF trial-step history40/40; also 40/40 inside the fullGROUP=IntegratorsDelayDiffEq run.mid-step interpolation still sees committed datapins the evaluation-only contract: astep_limiterprobe callsintegrator(t)/integrator.sol(t)mid-step — 6/6 pass; without theforce_calc_endgate it fails 4/6 and permanently corrupts saved dense output (post-solve err ~2e-2).GROUP=CoreOrdinaryDiffEqBDF: all pass (incl. Nordsieck BDF 140/140, DAE init/convergence/event/nlsolve).GROUP=IntegratorsDelayDiffEq: all pass.GROUP=QAOrdinaryDiffEqBDF and DelayDiffEq: pass.typos-clean;git diff --checkclean.pre/ downstream groups not run locally.🤖 Generated with Devin — Devin CLI 3000.10.27 (model: SWE-2 Max). Local session, transcript:
/home/crackauc/.local/share/devin/cli/summaries/history_fa4fe6012694472c.md