Skip to content

Fix RKL1/RKL2 stage times for non-autonomous problems - #3948

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:rkl-stage-times
Jul 22, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:rkl-stage-times

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Important

This PR should be ignored until reviewed by @ChrisRackauckas.

What

RKL1/RKL2 evaluated every interior stage at time t — 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 quadrature u' = cos(t) (it degenerates to forward Euler in t). 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:

problem fixed λ λ ∝ 1/dt (stiff regime)
Prothero–Robinson oop 1.20 → 2.00 1.13 → 2.00
Prothero–Robinson iip 1.20 → 2.00 1.13 → 2.00
quadrature oop 1.00 → 2.00 1.00 → 2.00
quadrature iip 1.00 → 2.00 1.00 → 2.00

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 convergence testset (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

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI triage (2026-07-18): the failing checks here are pre-existing on master (commit 4e1a434, same base as this PR) and unrelated to this diff:

  • downgrade-sublibraries (9 sublibs, none touched by this PR) — also failing on master's own run.
  • sublibrary-ci / lib/OrdinaryDiffEqStabilizedIRK [QA] — ExplicitImports all_explicit_imports_are_public errors for build_nlsolver/nlsolve!/du_alias_or_new/markfirststage!/dolinsolve/update_W! in StabilizedIRK (a sublib this PR does not modify).

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 (lib/OrdinaryDiffEqStabilizedRK Core + QA) pass.

@ChrisRackauckas
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
ChrisRackauckas merged commit 8e3c550 into SciML:master Jul 22, 2026
112 of 133 checks passed
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants