Repository navigation
Extend OrdinaryDiffEqCore.dtnew_modification instead of shadowing it - #4547
Merged
ChrisRackauckas merged 1 commit intoSep 13, 2026
Conversation
The ten `dtnew_modification` methods here (ROCK2, ROCK4, SERK2, ESERK4, ESERK5, RKMC2, RKL1, RKL2, RKG1, RKG2) cap the controller's proposed step at the method's stability limit, but `dtnew_modification` was missing from the module's `import OrdinaryDiffEqCore: ...` list. They therefore defined a *new* function in this namespace rather than extending Core's, and `calc_dt_propose!` - which calls `OrdinaryDiffEqCore.dtnew_modification` - got the generic identity fallback. `has_dtnew_modification(ROCK2())` was `true` while the cap did nothing. OrdinaryDiffEqRKIP imports it correctly. Behaviour change is small: the bound corresponds to the dt at which the required stage count would exceed `max_stages`, and `mdeg` selection in `perform_step!` already tracks the same quantity, so at default settings the cap does not bind. On a 32-point MOL heat problem across ROCK2/ROCK4/RKC/SERK2/RKL2/RKG2 and tolerances 1e-2/1e-4/1e-6, every step count, function count and error is unchanged. With a deliberately reduced stage budget the cap does bind, in the intended direction: RKG2(max_stages=20) at tol 1e-2 goes from max|dt| 3.640e-02 with error 2.830e-03 to max|dt| 3.017e-02 with error 1.731e-03. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code 2.1.269 Agent-Model: claude-opus-5[1m] Agent-Session: https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE Claude-Session: https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE
ChrisRackauckas
marked this pull request as ready for review
September 13, 2026 06:58
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
- Stop tying the state Jacobian's finite-difference direction to tdir (#4543) - Extend OrdinaryDiffEqCore.dtnew_modification instead of shadowing it (#4547) - Pick the DAE initialization dt by magnitude, not signed min (#4549) - Accept a callable stage predictor on the nlsolve algorithms (#4539) - Run the QA test group last in every sublibrary that ran it first (#4551) - Apply stage limiters in every StabilizedRK method (#4550) Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
#4547 made OrdinaryDiffEqStabilizedRK import `dtnew_modification` from OrdinaryDiffEqCore, but the name was never declared `public`, so the sublib's ExplicitImports `all_explicit_imports_are_public` check has failed on master since. Declare it public alongside `has_dtnew_modification`, with a docstring and a docs entry. Agent-Harness: Devin CLI 3000.10.21 Agent-Model: Fusion (Claude Fable 5.1 High + SWE-2 Medium) Agent-Session: local Devin CLI session id five-bladder (no shareable URL) Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
- Stop tying the state Jacobian's finite-difference direction to tdir (#4543) - Extend OrdinaryDiffEqCore.dtnew_modification instead of shadowing it (#4547) - Pick the DAE initialization dt by magnitude, not signed min (#4549) - Accept a callable stage predictor on the nlsolve algorithms (#4539) - Run the QA test group last in every sublibrary that ran it first (#4551) - Apply stage limiters in every StabilizedRK method (#4550) - Release OrdinaryDiffEqNonlinearSolve 2.9.8 (#4552) - Declare OrdinaryDiffEqCore.dtnew_modification public (#4553) - Fix baseline spelling and whitespace checks in tests (#4524) - Raise OrdinaryDiffEqNonlinearSolve floor for stage_predictor (#4554) Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 17, 2026
Ships stage limiters being applied in every StabilizedRK method (#4550) and the dtnew_modification extension fix (#4547). 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 stage limiters being applied in every StabilizedRK method (#4550) and the dtnew_modification extension fix (#4547). 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.
Closes #4535. Ignore until reviewed by @ChrisRackauckas. Draft.
What changed and why
One name added to the import list:
This package defines ten
dtnew_modificationmethods — ROCK2, ROCK4, SERK2, ESERK4, ESERK5, RKMC2, RKL1, RKL2, RKG1, RKG2 — that cap the controller's proposed step at the method's stability limit. Becausedtnew_modificationwas absent from the import list, those definitions created a new function in this namespace instead of extending Core's.calc_dt_propose!callsOrdinaryDiffEqCore.dtnew_modification, got the generic identity fallback, and the cap never ran:OrdinaryDiffEqRKIPimports it correctly, which is how the asymmetry stood out.How much behaviour changes: almost none
The bound is the
dtat which the required stage count would exceedmax_stages, andmdegselection inperform_step!already derives from the sameabs(dt) * eigen_est, so at default settings the cap does not bind. On a 32-point MOL heat problem, every step count, function-evaluation count, return code and error is identical with the cap live and dead:With a deliberately reduced stage budget the cap does bind, and in the intended direction — exactly one row out of ten moves, and it gets more accurate for the same number of steps:
All other reduced-budget rows (ROCK2 max_stages 20 and 12, ROCK4 20, RKL2 21, RKG2 at 1e-3) are unchanged.
Reversal symmetry is unaffected: with the cap now live, 24 forward/mirrored-backward cases across ROCK2/ROCK4/RKC/SERK2/RKL2/RKG2 at two tolerances, in-place and out-of-place, are all bitwise identical — #4536 already made the capped expressions direction-safe, which is why this could be switched on without reintroducing that bug.
Verification
Extends
dtnew_cap_direction_tests.jl(added in #4536) with a testset asserting that Core'sdtnew_modificationis this package's, thathas_dtnew_modificationagrees, and that the cap binds when reached through Core. Its stale "these caps are currently unreachable" note is removed.Failing on master (
git checkout origin/master -- lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl):Full package suite with the fix (Julia 1.10.11):
Minor-bumped to 2.7.0 rather than patch, since a dormant step-size cap becoming active is a behaviour change even though I could not find a default configuration where it alters results.
What I did not verify
pre.ESERK4/ESERK5/RKMC2/RKL1/RKG1at reduced stage budgets, andTSRKC2/TSRKC3(which have nodtnew_modification); the measured sweep covers ROCK2/ROCK4/RKC/SERK2/RKL2/RKG2.Worth pushing back on
importlist in this module now mixes functions that are extended here with ones only called. That is already true of the list, butdtnew_modificationis specifically the kind of name worth a comment so it does not get dropped again. Happy to add one.has_dtnew_modification(alg) === trueshould implyparentmodule-level agreement between the defining package'sdtnew_modificationand Core's. I did not attempt that here.🤖 Generated with Claude Code (model: claude-opus-5[1m], harness: Claude Code 2.1.269)
https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE