Skip to content

GlobalDiffEq: add GlobalDefectCorrection global error estimation and control#3957

Draft
ChrisRackauckas-Claude wants to merge 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:globaldiffeq-correction
Draft

GlobalDiffEq: add GlobalDefectCorrection global error estimation and control#3957
ChrisRackauckas-Claude wants to merge 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:globaldiffeq-correction

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jul 18, 2026

Copy link
Copy Markdown
Member

Important

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Stacked on #3956 (transport) — the tip of the remaining GlobalDiffEq series: adjoint (#3953) → GLEE (#3954) → MM5GEE (#3955) → transport (#3956) → this. #3929 (repo transfer) has merged and this branch is rebased onto master; only the top commit is new here. Merge the base PRs first.

Summary

Adds GlobalDefectCorrection — global error estimation and gtol-based control by solving for the correction (defect correction), addressing the SciML/GlobalDiffEq.jl#3 method family (Zadunaisky 1976; Dormand–Duckers–Prince 1984; the per-step dense-output form of Dormand–Lockyer–McGorrigan–Prince 1989; asymptotic validity under adaptive stepping by Calvo–Higham–Montijano–Rández 1996).

  • After a dense forward solve with interpolant P(t), the nonlinear companion ODE ε' = f(P(t) + ε) − P'(t) is integrated from ε(t₀) = 0; ‖ε(T)‖₂ estimates the endpoint global error. Unlike GlobalErrorTransport this needs no Jacobian, only f evaluations on perturbed arguments, and it is the generic coefficient-free realization of the Dormand–Prince triple idea for any dense-output solver.
  • Same API contract as the previous PR: standalone global_error_estimate(prob, alg; ...), and gtol-controlled solve via the shared refinement loop from src/companion.jl.

This completes the stacked series; after it merges, SciML/GlobalDiffEq.jl can be archived pointing at the monorepo, and SciML/GlobalDiffEq.jl#56 closed. Of the issue tracker, SciML/GlobalDiffEq.jl#2 (multistep GEE) is intentionally left unimplemented: the referenced Farzi (IJNAO 2016) construction reads the global error of a k-step LMM block from the Butcher-tree truncation error of a composite RK method, which requires the elementary differentials of f — impractical as a general-purpose runtime estimator.

Version 1.7.0.

Validation (run locally)

  • ODEDIFFEQ_TEST_GROUP=Core julia --project=lib/GlobalDiffEq -e 'using Pkg; Pkg.test()': pass — Basic 1/1, traits 3/3, Adjoint 14/14, GLEE 37/37, Companion estimators 28/28, BigFloat 2/2
  • ODEDIFFEQ_TEST_GROUP=QA julia --project=lib/GlobalDiffEq -e 'using Pkg; Pkg.test()': pass — 22 passed, 1 pre-existing declared broken
  • On Lotka–Volterra against a 1e-13 reference: estimate/true-error ratios within 10% at tolerances 1e-4 and 1e-6 (measured 0.998–1.000), in-place and out-of-place; gtol = 1e-7 control delivered a true endpoint error of 9.9e-9; argument-validation paths tested.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MfUh8tgp3iBmMv9nkBqoyY

Carries SciML/GlobalDiffEq.jl#56 (GlobalAdjoint, adjoint_error_estimate;
Cao and Petzold 2004, closes SciML/GlobalDiffEq.jl#4) into the
monorepo, restructured as the package extension
GlobalDiffEqSciMLSensitivityExt on SciMLSensitivity + QuadGK weakdeps.
sensealg defaults to nothing and resolves to
QuadratureAdjoint(autojacvec = true) when the extension loads; solving
without the extension raises an instructive error. Public API and
semantics otherwise match the original PR.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Implements the explicit general linear methods with built-in global
error estimation from Constantinescu (2016), SIAM J. Numer. Anal. 54(6)
(arXiv:1503.05166; PETSc's TSGLEE23/TSGLEE24/TSGLEE35), addressing
SciML/GlobalDiffEq.jl#6 and SciML/GlobalDiffEq.jl#22, as proper
OrdinaryDiffEqCore algorithms. The methods propagate the partitioned
state (y, ε) where ε is an asymptotically correct global error
estimate; solve/init on plain ODEProblems transparently extend to the
ArrayPartition form and global_error_estimate(sol) extracts the
estimates. The per-step ε increment is an asymptotically correct local
error estimate driving standard step-size adaptivity. The paper's
method A4 is defective as printed (violates b·c = 1/2, converges at
order 1, absent from PETSc) and is deliberately not implemented.

Verified locally on the unstable Prince42 problem: solution orders
2/2/3, estimate accuracy orders 3/3/4, est/true-error ratio 1.00.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Adds the DOPRI5-based order-5 scheme with cheap global error estimation
of Makazaga and Murua (BIT 43, 2003) as another tableau in the GLEE
general linear framework (SciML/GlobalDiffEq.jl#6, the coefficient-
complete published representative of the Dormand-Duckers-Prince RK
triple family). Stages 1-7 are the standard DOPRI5 stages, three extra
stages propagate an order-6 companion solution, and a generic
solution-stage FSAL detection reuses stage 7's evaluation for fsallast,
giving exactly 9 function evaluations per step (verified by an nf
accounting test). The tableau was verified with exact rational
arithmetic against the order and independency conditions.

Verified locally on the unstable Prince42 problem: solution order 5,
estimate accuracy order 6, est/true-error ratio 1.04, 9.01 f-evals/step.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Implements the linearized error-transport estimator
(SciML/GlobalDiffEq.jl#5; Shampine 1986 / Berzins 1988 / Lang-Verwer
2007): after a dense forward solve, the companion linear ODE
ε' = Jε + d(t) driven by the dense-output defect d(t) = f(P(t)) - P'(t)
is integrated for the endpoint global error, with matrix-free
Jacobian-vector products through DifferentiationInterface (autodiff
accepts any ADTypes backend, default AutoForwardDiff). gtol-controlled
solves tighten local tolerances via the shared refinement loop in
companion.jl, mirroring GlobalAdjoint. global_error_estimate(prob, alg)
is the standalone estimator, also added for GlobalAdjoint as an alias
of adjoint_error_estimate.

Verified locally on Lotka-Volterra vs a 1e-13 reference: estimate to
true-error ratios 0.995-0.999 at tolerances 1e-4/1e-6, and gtol=1e-7
control yields 9.8e-9 final error.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Implements solving-for-the-correction (SciML/GlobalDiffEq.jl#3 family;
Zadunaisky 1976, Dormand-Duckers-Prince 1984, Dormand-Lockyer-
McGorrigan-Prince 1989, validity under adaptive stepping by
Calvo-Higham-Montijano-Randez 1996): the nonlinear companion ODE
ε' = f(P + ε) - P' driven by the dense-output defect, requiring no
Jacobian. Same estimator and gtol-control API as GlobalErrorTransport
via the shared companion machinery.

Verified locally on Lotka-Volterra vs a 1e-13 reference: estimate to
true-error ratios 0.998-1.000 at tolerances 1e-4/1e-6, and gtol=1e-7
control yields 9.9e-9 final error.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
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