Skip to content

Add a global error interface: has_global_error trait + ODESolution.global_error field - #1531

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:global-error-interface
Aug 17, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:global-error-interface

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Important

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

Summary

Adds a uniform interface for ODE solvers and solver wrappers to report an estimate of the global (accumulated) error of a solution, rather than only controlling local error per step. This is the foundation requested in the GlobalDiffEq review discussion (SciML/OrdinaryDiffEq.jl#3956): a trait for whether a method computes the global error, and a solution field (an array-of-arrays matching u, nothing when the method doesn't compute it).

  • has_global_error(alg) — algorithm trait, default false; true when the algorithm/wrapper populates a global error estimate. Added next to the other algorithm traits, made @public, and documented in docs/src/interfaces/Algorithms.md.
  • ODESolution.global_error — new field, default nothing; when present, an array matching u where global_error[i] is the estimated global error of u[i] at t[i]. Documented in the ODESolution docstring.

Backward compatibility

All defaults are nothing, so existing solutions and constructors are structurally and behaviorally unchanged (the default GE type parameter is Nothing). The field is threaded through:

  • build_solution — new global_error = nothing keyword, passed to the constructor;
  • the ODESolution{T,N}(...) convenience constructor — optional last argument defaulting to nothing, so existing 17-argument positional calls still work;
  • ConstructionBase.setproperties — so @set/@reset preserve global_error;
  • solution_new_original_retcode (direct reconstruction) and solution_slice (slices global_error alongside u).

Only code constructing ODESolution through the fully type-parameterized inner constructor with an explicit 16-parameter/17-field signature would need updating; the standard build_solution and convenience-constructor paths are unaffected.

Minor version bump (3.47.0 → 3.48.0) for the new public API.

How it will be used (follow-ups, not in this PR)

Validation (run locally)

  • Smoke test (built against this branch): trait default false / override true; sol.global_error === nothing by default; populated via the build_solution keyword; preserved through @set/setproperties; sliced correctly by solution_slice. All pass.
  • GROUP=Core SciMLBase test suite: pass — full GROUP=Core suite green ("SciMLBase tests passed"), including the setproperties/@set-heavy Remake group (4430/4430).
  • Runic --check on the changed files.

🤖 Generated with Claude Code

Adds a uniform way for ODE solvers and solver wrappers to report an
estimate of the global (accumulated) error:

- `has_global_error(alg)` trait (default `false`) declaring whether an
  algorithm populates a global error estimate.
- a `global_error` field on `ODESolution` (default `nothing`), an array
  matching `u` with per-time-point global error estimates when present.

The field is threaded through `build_solution` (new `global_error`
keyword, default `nothing`), the convenience constructor (optional last
argument), `ConstructionBase.setproperties` (so `@set`/`@reset` preserve
it), `solution_new_original_retcode`, and `solution_slice` (which slices
it alongside `u`). All defaults are `nothing`, so existing solutions and
constructors are unchanged.

`has_global_error` is made public and documented alongside the other
algorithm traits; the `global_error` field is documented on ODESolution.
Minor version bump for the new public API.

Co-Authored-By: Chris Rackauckas <[email protected]>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 17, 2026 06:40
@ChrisRackauckas
ChrisRackauckas merged commit 1e5b27c into SciML:master Aug 17, 2026
50 of 63 checks passed
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Aug 17, 2026
Migrates the GLEE/MM5GEE solvers onto the SciMLBase global-error
interface (SciML/SciMLBase.jl#1531): has_global_error(alg) = true, and
solving returns an ordinary solution (sol.u and sol(t) are the
solution) with the estimate in sol.global_error. The extended (y, ε)
ArrayPartition solve is split in __solve, and a projecting
interpolation reuses the high-order extended dense output so sol(t)
returns the solution component at full order (values, derivatives, and
the in-place form). global_error_estimate(sol) now returns
sol.global_error. Users no longer see the internal ArrayPartition.

Requires SciMLBase >= 3.48 (compat bumped); depends on
SciML/SciMLBase.jl#1531.

Verified locally against the SciMLBase branch: GLEE test suite 91/91
(including a new interface testset), plus smoke tests of the split
solution, dense output, derivatives, and the in-place interp form.

Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Aug 17, 2026
Migrates the GLEE/MM5GEE solvers onto the SciMLBase global-error
interface (SciML/SciMLBase.jl#1531): has_global_error(alg) = true, and
solving returns an ordinary solution (sol.u and sol(t) are the
solution) with the estimate in sol.global_error. The extended (y, ε)
ArrayPartition solve is split in __solve, and a projecting
interpolation reuses the high-order extended dense output so sol(t)
returns the solution component at full order (values, derivatives, and
the in-place form). global_error_estimate(sol) now returns
sol.global_error. Users no longer see the internal ArrayPartition.

Requires SciMLBase >= 3.48 (compat bumped); depends on
SciML/SciMLBase.jl#1531.

Verified locally against the SciMLBase branch: GLEE test suite 91/91
(including a new interface testset), plus smoke tests of the split
solution, dense output, derivatives, and the in-place interp form.

Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Aug 21, 2026
Migrates the GLEE/MM5GEE solvers onto the SciMLBase global-error
interface (SciML/SciMLBase.jl#1531): has_global_error(alg) = true, and
solving returns an ordinary solution (sol.u and sol(t) are the
solution) with the estimate in sol.global_error. The extended (y, ε)
ArrayPartition solve is split in __solve, and a projecting
interpolation reuses the high-order extended dense output so sol(t)
returns the solution component at full order (values, derivatives, and
the in-place form). global_error_estimate(sol) now returns
sol.global_error. Users no longer see the internal ArrayPartition.

Requires SciMLBase >= 3.48 (compat bumped); depends on
SciML/SciMLBase.jl#1531.

Verified locally against the SciMLBase branch: GLEE test suite 91/91
(including a new interface testset), plus smoke tests of the split
solution, dense output, derivatives, and the in-place interp form.

Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas added a commit to SciML/OrdinaryDiffEq.jl that referenced this pull request Aug 21, 2026
Migrates the GLEE/MM5GEE solvers onto the SciMLBase global-error
interface (SciML/SciMLBase.jl#1531): has_global_error(alg) = true, and
solving returns an ordinary solution (sol.u and sol(t) are the
solution) with the estimate in sol.global_error. The extended (y, ε)
ArrayPartition solve is split in __solve, and a projecting
interpolation reuses the high-order extended dense output so sol(t)
returns the solution component at full order (values, derivatives, and
the in-place form). global_error_estimate(sol) now returns
sol.global_error. Users no longer see the internal ArrayPartition.

Requires SciMLBase >= 3.48 (compat bumped); depends on
SciML/SciMLBase.jl#1531.

Verified locally against the SciMLBase branch: GLEE test suite 91/91
(including a new interface testset), plus smoke tests of the split
solution, dense output, derivatives, and the in-place interp form.

Co-authored-by: ChrisRackauckas-Claude <[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