Repository navigation
Fix RKG1/RKG2 stage times for non-autonomous problems - #3949
Merged
ChrisRackauckas merged 1 commit intoJul 23, 2026
Merged
Conversation
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-Claude
force-pushed
the
rkg-stage-times
branch
from
July 22, 2026 21:07
e68b7f5 to
4d36748
Compare
RKG1 and RKG2 evaluated every interior stage at time t with no stage-time offsets, so RKG2 dropped from order 2 to order 1 on any time-dependent problem. 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 (c₁ = μ̃₁, cⱼ = μⱼcⱼ₋₁ + νⱼcⱼ₋₂ + μ̃ⱼ (+ γ̃ⱼ for RKG2)), which makes every stage internally consistent; combined with the existing autonomous order conditions this gives 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: RKG2 goes from order ~1.0-1.2 to 2.00 in all eight configurations; RKG1 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
rkg-stage-times
branch
from
July 22, 2026 22:46
4d36748 to
6d8d24e
Compare
ChrisRackauckas
marked this pull request as ready for review
July 23, 2026 00:13
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
Same defect and same construction as the RKL PR (#3948), for the Runge–Kutta–Gegenbauer methods:
RKG1/RKG2evaluated every interior stage at timet, so RKG2 loses an order on any time-dependent problem (order 1.0 on quadratureu' = cos(t), ~1.1–1.2 on Prothero–Robinson). Autonomous problems cannot detect this, which is all the existing tests used.Fix
Track stage times cⱼ through the same three-term recurrence the stage values satisfy (c₁ = μ̃₁, cⱼ = μⱼcⱼ₋₁ + νⱼcⱼ₋₂ + μ̃ⱼ (+ γ̃ⱼ for RKG2)) and evaluate stage j at
t + dt*cⱼ₋₁. Each stage becomes internally consistent, and internal consistency + the verified autonomous order conditions imply the non-autonomous order via the t-augmented autonomous system. The recurrence is a few scalar ops per stage — no measurable cost.Measured convergence orders (before → after)
RKG2, ℓ∞ order over dts = 2⁻¹⁰..2⁻⁵, forced eigenvalue estimates: order 1.0–1.2 → 2.00 in all eight configurations (Prothero–Robinson + quadrature, oop + iip, fixed-λ + λ∝1/dt). RKG1 remains order 1.00 everywhere. Autonomous convergence unchanged.
Tests
Adds an
RKG non-autonomous convergencetestset mirroring the RKL one. Ran locally:ODEDIFFEQ_TEST_GROUP=Core Pkg.test()— 213/213 pass. Runic applied.Part of a stabilized-RK audit; sibling PRs: #3947 (SERK2 in-place fix), #3948 (RKL stage times).
🤖 Generated with Claude Code
https://claude.ai/code/session_015WU5V4PXt8SZ3BpjxdtM7d