Skip to content

3rd and 4th order methods - #109

Open
oscardssmith wants to merge 6 commits into
mainfrom
feat/higher-order-splitting
Open

oscardssmith wants to merge 6 commits into
mainfrom
feat/higher-order-splitting

Conversation

@oscardssmith

Copy link
Copy Markdown
Member

@termi-official termi-official linked an issue Aug 4, 2026 that may be closed by this pull request

@termi-official termi-official left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks already not bad! I left some comments. I think my main gripe is that we probably do not stress the rejection logic really hard right now. I think we should especially try to find ways to trigger step rejections mid way on some recursive split with different mixes of adaptivity and no adaptivity to see if the failure paths behave correctly and we do not get stuck in some faulty loops again. I had this problem in the past that a failing subintegrator was not handled correctly and we had to wail until the outer intergrators's dt starves slowly.

Comment thread src/utils.jl Resolved
Comment thread src/solver.jl Resolved
Comment thread src/solver.jl Resolved
Comment thread docs/src/api-reference/index.md Resolved
@termi-official

Copy link
Copy Markdown
Collaborator

Rebase and missing files?

oscardssmith and others added 5 commits August 9, 2026 16:50
Implements the practical parts of Auzinger, Hofstaetter, Ketcheson & Koch,
BIT 57:55-74 (2017): coefficient-table splitting schemes and the section 3
adjoint-pair local error estimator.

Backward substeps. Every real splitting scheme of order three or above has
negative coefficients, so some substeps run against the tree's direction --
previously unsupported, because a child's direction is fixed at construction
and the stepping loop re-signs dt back before perform_step! sees it.
reverse_direction! flips a leaf's tdir, dt, dtcache, dtpropose and dtmax and
rebuilds its tdir-keyed heaps. A splitting node needs different handling: its
heap stores raw times with the direction in the heap's type, so keys cannot be
re-signed and only behind-times are dropped, and the reversal recurses into the
subtree because add_tstop! propagates to descendants eagerly.

Coefficient tables. SplittingCoefficients holds an s-by-N table as nested
NTuples, checking each operator's consistency condition at construction. Ruth3
is the first table (exactly rational, order 3). One generic _perform_step!
walks stages by operators and skips zero coefficients. LieTrotterGodunov and
StrangMarchuk keep their hand-written steps.

AdjointPair(base) averages a base scheme of odd order p with its adjoint for a
solution of order p+1, and takes half their difference as the error estimate
driving the controller. Even-order bases are rejected: their leading error
terms are equal rather than opposite, so averaging would raise no order and the
difference would not be an error estimate. The adjoint reverses the base's
whole flat sequence of flows, reusing the same table.
AdjointPair(LieTrotterGodunov(...)) is PalindromicPairLieTrotterGodunov, which
a test asserts to the bit.

Also fixes a pre-existing bug the new schemes exposed: the snap window absorbing
child clock drift was scaled by the child's own dt, which after a substep can be
arbitrarily small and collapse the window below the drift it must absorb. It now
uses the outer step size, the scale the drift accumulated against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Yoshida's triple jump, derived in this package's stage convention rather than
transcribed: composing three Strang steps of lengths w1*h, w0*h and w1*h and
merging the adjacent operator-1 flows gives four stages and eight flow
evaluations rather than nine. The merge zeroes the last stage's second
coefficient, so this is also the first table to exercise the zero-coefficient
skip in the generic step. Measured order 4.02, 4.00, 4.00 over dt 0.2 to 0.025.

w0 is negative and large: the second operator's cumulative time reaches 1.35*h
before returning through -0.35*h, so this leans hard on backward substeps.

Being of even order, Yoshida4 cannot serve as an AdjointPair base, which is now
asserted alongside the StrangMarchuk case.

Ruth3's two-operator restriction is factored into a shared helper, since
Yoshida4's table is also AB only.

Also adds the three bibliography entries the docstrings had been citing without
defining -- Rut:1983:cim, Yos:1990:cho and AuzHofKetKoc:2017:psm -- which would
have failed the docs build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The citation key AuzHofKetKoc:2017:psm splits into Auz/Hof/Ket/Koc, and typos
reads "Ket" as a misspelling of "Kept" or "Key". Added alongside the existing
"Tro" exception for the Trotter key.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread src/utils.jl Resolved
Comment thread docs/src/topics/time-integration.md Resolved
Comment thread docs/src/devdocs/index.md Resolved
Comment thread src/integrator.jl Resolved
Comment thread src/integrator.jl Resolved
@oscardssmith oscardssmith mentioned this pull request Aug 11, 2026
@oscardssmith
oscardssmith force-pushed the feat/higher-order-splitting branch from a114f12 to 8e837e1 Compare August 11, 2026 10:37

@termi-official termi-official left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, thanks! We need to wire #112 first tho because upstream broke the FSAL logic.

I left a comment on one of the bot-generated comments which we might want to fix before the merge, too.

Comment thread src/integrator.jl
end
function try_snap_children_to_tstop!(integrator::SplitSubIntegrator, tstop)
if abs(tstop - integrator.t) < _snap_window(integrator.t, tstop, integrator.dt)
# `scale` is the *outer* step size, and stays the outer one all the way down the tree.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to elaborate the variable name, then we probably want to use a different, more descriptive name here.

@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated review from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris. It is posted so that you can act on it. Chris or a maintainer may disagree.

Verdict: changes needed before merge (reviewed at 8e837e1).

Adds coefficient-driven Ruth3 and Yoshida4 splittings, adaptive AdjointPair, and backward substeps. Request changes because Yoshida4 fails with Float32 time, direction reversal discards scheduled discontinuities, and the branch needs reconciliation with current main.

Risk assessment

  • Risk: medium
  • Blast radius: Yoshida4 users with Float32 time; higher-order and nested solves with scheduled stops/discontinuities; existing PalindromicPairLieTrotterGodunov users if the solver-file conflict loses current main's API.
  • Evidence: All 10 reported head checks succeeded: Core on Julia lts/1/pre, QA on Julia 1, Documentation, Downgrade, Runic Format Check, Runic Suggestions, Spell Check with Typos, and test detection. Current main 619b927 also has successful corresponding Core, QA, Documentation, Downgrade, and Runic checks, plus x86 Core. There are no failing head CI checks to classify. Local GROUP=Core julia +1.12 --project=repo -e 'using Pkg; Pkg.test()' passed seven files (362 assertions), then stopped in consistency.jl with 24 passes and three FSAL failures (4 == 3, 4 == 3, 3 == 2). The unchanged FSAL test on current main passed 4/4 with the same OrdinaryDiffEqCore 4.18.0 dependency. Separate Julia 1.12 runs passed convergence (153), failure escalation (20), and saving/interpolation (153) assertions. Observed Float64 convergence rates were Ruth3 3.033/3.017, Yoshida4 4.004/4.001, and AdjointPair(Ruth3) 3.976/3.986. Local Runic check exited 0. Additional mixed-adaptivity probes recovered transient failures and stopped permanently failing adaptive children with Unstable after two iterations. The full Core suite did not complete past its first failing file; local QA/docs were not rerun.
  • Merge: needs changes (findings 1–3).

Maintainer context: termi-official requested stronger nested rejection coverage, table documentation, and cleanup, then approved this exact head on 2026-08-17 conditional on the FSAL prerequisite. That prerequisite, #112, merged on 2026-08-24 but is absent from this head. No dependencies were added, existing assertions were not weakened, and the new algorithm names have docstrings and documentation entries.

Findings

  1. src/solvers/tables.jl:75 — Yoshida4 widens Float32 substep times and fails on the first outer step. Its coefficients are fixed Float64 constants, so coefficient * dt is Float64 even for Float32 integrators. On Julia 1.12.7 and 1.13.0, the following throws AssertionError: (parent.t=0.1 != child.t=0.26756036); the second child is at 0.16487926. Lie–Trotter, Strang, and Ruth3 succeed on the same problem. A local control using the identical Yoshida table converted to Float32 succeeds at t=1.0, with u=Float32[0.049787086]. Construct coefficients/substep durations in the integrator's time type and add Float32 forward/backward regression coverage.

    using OrdinaryDiffEqOperatorSplitting, OrdinaryDiffEqTsit5
    import SciMLBase as S
    f = GenericSplitFunction((
        S.ODEFunction((du,u,p,t) -> (du .= -u)),
        S.ODEFunction((du,u,p,t) -> (du .= -2u))), ([1], [1]))
    S.solve(OperatorSplittingProblem(f, Float32[1], (0f0, 1f0)),
        Yoshida4((Tsit5(), Tsit5())); dt=0.1f0, adaptive=false, verbose=false)
  2. src/utils.jl:333 — Temporary direction reversal permanently deletes future scheduled stops. _reverse_time_heap! discards keys behind the temporary direction; reversing back cannot recover them. With Ruth3, dt=0.1, and tstops=[0.37,0.8], both leaves lose every pending stop after the first step while the root retains [0.37,0.8,1.0]. With d_discontinuities=[0.37], the leaf discontinuity heap also becomes empty. A Tsit5 step-limiter probe on u′ = t < 0.37 ? 1 : 2 plus a zero second operator records a substep from 0.3204166666666667 to 0.3729166666666667, crossing the explicitly scheduled discontinuity; Lie–Trotter and Strang record no crossing. Preserve the canonical scheduled times across temporary reversals and rebuild the active queues for each direction, including boundaries crossed again on a backward stage. Add a regression that checks actual child substep boundaries, not only the root's final stop.

  3. src/solvers/adjoint_pair.jl:62 / deleted src/solver.jl — Reconcile with current main before merging. GitHub reports CONFLICTING; local git merge-tree --write-tree origin/main HEAD confirms a modify/delete conflict in src/solver.jl. Main added the public local_extrapolation keyword and its cache/stepping behavior to PalindromicPairLieTrotterGodunov, which the moved implementation lacks. Port that behavior into the new solver file while resolving the conflict. Also bring in the FSAL prerequisite: current main's _suppress_duplicate_fsal_reeval! makes all four existing FSAL assertions pass, whereas this head fails three under current dependencies. Rebase, preserve the public option, and rerun Core/QA/docs on the integrated result.

Local evidence is retained in the scratch directory: core-review.log, remaining-review.log, fsal-base-review.log, float32-review.log, float32-confirm.log, discontinuity-review.log, failure-review.log, and runic-review.log. No GitHub writes were performed; both repository checkouts remain clean.

Produced by an AI agent — harness: Codex CLI (Mac) 0.156.1 · model: gpt-6-astra.
Conversation: local session ID 01a0ded2-5b4a-78d1-9961-7dd5600075ce (no published conversation URL).

Push a fix and the PR is reviewed again automatically at the new head.


🤖 Posted by an AI agent — harness: Claude Code · model: claude-opus-5-5[1m] (fleet master); review by Codex CLI (Mac) 0.156.1 / gpt-6-astra
Conversation: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 on Chris's Mac (session ID, no URL)

This branch has not been deployed

No deployments
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.

Palindromic pair based algorithms

3 participants