Repository navigation
Fix RKL1/RKL2 stage times for non-autonomous problems - #3948
Merged
ChrisRackauckas merged 1 commit intoJul 22, 2026
Merged
Conversation
This was referenced Jul 18, 2026
Member
Author
|
CI triage (2026-07-18): the failing checks here are pre-existing on
A separate investigation of the master failures is underway and will be filed as its own issue/PR. All checks that exercise this PR's code ( |
ChrisRackauckas
marked this pull request as ready for review
July 22, 2026 20:52
RKL1 and RKL2 evaluated every interior stage at time t with no stage-time offsets, so RKL2 dropped from order 2 to order 1 on any time-dependent problem (it degenerates to forward Euler in t on u' = g(t)). The existing convergence tests only use autonomous problems and could not see this. Track the stage times cⱼ through the same three-term recurrence the stage values satisfy, which makes every stage internally consistent and reproduces the closed forms from Meyer, Balsara & Aslam (2014): cⱼ = (j² + j)/(s² + s) for RKL1 and cⱼ = (j² + j - 2)/(s² + s - 2) for RKL2. Internal consistency plus the existing autonomous order conditions implies the non-autonomous order via the t-augmented autonomous system. Measured with forced eigenvalue estimates in both the classical (fixed λ, dt -> 0) and stiff (λ ∝ 1/dt, constant stage count) regimes, on a Prothero-Robinson problem and on pure quadrature u' = cos(t), in-place and out-of-place: RKL2 goes from order ~1.0-1.2 to 2.00 in all eight configurations; RKL1 stays at order 1.00; autonomous convergence is unchanged. Adds these as tests. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_015WU5V4PXt8SZ3BpjxdtM7d
ChrisRackauckas-Claude
force-pushed
the
rkl-stage-times
branch
from
July 22, 2026 21:06
5ac99af to
89f7fd2
Compare
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
Aug 3, 2026
SERK2 passed each f evaluation the time of the stage it was *producing* rather than the stage it was *evaluating at*, an off-by-one in the same family as the RKL/RKG fixes in #3948/#3949. Stage j of block i sits at t + (j^2 + (i-1)*internal_deg^2)*alpha*dt, but f is applied to the previous stage, so the correct argument uses (j-1)^2, and the leading Euler stage of each block sits at the last stage time of the previous block. Reconstructing the tableau confirms the coefficients themselves are correct: for every mdeg in the tableau, sum(B) = 1, sum(b) = 1 and sum(b .* c) = 0.5 exactly with the internally consistent stage times, while the times the code passed gave 0.5 + O(1/mdeg) - breaking the second-order condition by a fixed amount and dropping the observed order to ~1. On dts = 2^-10..2^-5 with forced eigen_est, order on a Prothero-Robinson problem goes 1.01 -> 2.00 and on pure quadrature u' = cos(t) 0.80 -> 2.00, in-place and out-of-place alike. Autonomous convergence is unchanged. Fixes #3950 Claude-Session: https://claude.ai/code/session_01QPE849e5oSrZreh3mkE8AJ Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[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.
Important
This PR should be ignored until reviewed by @ChrisRackauckas.
What
RKL1/RKL2evaluated every interior stage at timet— no stage-time offsets at all. On any time-dependent problem RKL2 loses an order: measured order ~1.1–1.2 on a Prothero–Robinson problem and exactly 1.0 on pure quadratureu' = cos(t)(it degenerates to forward Euler int). Autonomous problems — the only thing the existing convergence tests use — cannot see this.Fix
Track stage times cⱼ through the same three-term recurrence the stage values satisfy (initialized with c₁ = μ̃₁, updated cⱼ = μⱼcⱼ₋₁ + νⱼcⱼ₋₂ + μ̃ⱼ (+ γ̃ⱼ for RKL2)), and evaluate stage j at
t + dt*cⱼ₋₁. This makes each stage internally consistent and reproduces the closed forms from Meyer, Balsara & Aslam (JCP 2014): cⱼ = (j²+j)/(s²+s) for RKL1, cⱼ = (j²+j−2)/(s²+s−2) for RKL2. Internal consistency + the already-verified autonomous order conditions give the non-autonomous order via the t-augmented autonomous system.Measured convergence orders (before → after)
RKL2, ℓ∞ order over dts = 2⁻¹⁰..2⁻⁵, forced eigenvalue estimates:
RKL1 remains order 1.00 everywhere (it is first order by design; correct stage times still improve the constant). Autonomous convergence unchanged (2.00 / 1.00).
Tests
Adds an
RKL non-autonomous convergencetestset (Prothero–Robinson + quadrature, oop + iip, both eigenvalue regimes). Ran locally:ODEDIFFEQ_TEST_GROUP=Core Pkg.test()— 213/213 pass. Runic applied.Part of a stabilized-RK audit; sibling PRs: SERK2 in-place fix, RKG1/RKG2 stage times (same construction).
🤖 Generated with Claude Code
https://claude.ai/code/session_015WU5V4PXt8SZ3BpjxdtM7d