Repository navigation
GlobalDiffEq: add GlobalErrorTransport global error estimation and control - #3956
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
c7c3cb5 to
319106a
Compare
319106a to
94843bc
Compare
|
The GLEE methods should be a solver library. And we should make the global error actually an interface in SciMLBase: a trait for whether a method computes the global error, a global error field (which is nothing when a method doesn't compute it), and then it should be a matching array of arrays. The savevalues on this type of method should properly split the ArrayPartition so that the user gets back a normal solution in The adjoint method could use this same interface just computed differently? |
94843bc to
4fec872
Compare
|
Thanks — this reframes the direction. Summarizing the plan so it's on record, split from this PR: 1. A global-error interface in SciMLBase. Add to SciMLBase:
This is a SciMLBase PR (public API + docs together, minor bump). 2. GLEE as its own solver library, feeding the interface. Move 3. GlobalErrorTransport / GlobalDefectCorrection / GlobalAdjoint on the same interface. These wrappers compute the estimate differently (companion ODE / adjoint) but populate the same 4. Adjoint every-step mode (PR #3953 comment). Extend the adjoint estimator from an endpoint functional to a per-step one by making the loss the sum over saved steps and building the matching adjoint problem, so Proposed sequencing: land the SciMLBase interface first (1), then the GLEE solver library on top of it (2), then migrate the wrappers (3), then the adjoint every-step mode (4). I'll open these as separate PRs and link them here. This PR (GlobalErrorTransport) will be revised to populate Ignore until reviewed by @ChrisRackauckas. |
|
Step 1 of the plan is up: SciML/SciMLBase.jl#1531 adds the global-error interface — a Next: wire the GLEE methods (#3954) to set |
|
Step 2 is up: #4267 migrates the GLEE/MM5GEE solvers onto the interface. Remaining: migrate the |
c63e262 to
8e06bd9
Compare
a1a4852 to
bffe1c3
Compare
bffe1c3 to
3a54c9a
Compare
3a54c9a to
9739299
Compare
Standalone (unstacked) sublibrary addition: 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. gtol-controlled solves tighten local tolerances; global_error_estimate(prob, alg) is the standalone estimator. Carries a self-contained copy of the companion machinery (src/companion.jl) shared with the GlobalDefectCorrection PR. Verified locally on current master: Core (companion estimators 14/14) and QA (23 pass, 1 pre-existing declared broken). Co-Authored-By: Chris Rackauckas <[email protected]>
9739299 to
e4183d8
Compare
|
Superseded by #4492, which unifies the two defect-companion estimators ( |
…4492) Replace the separate GlobalDefectCorrection and GlobalErrorTransport wrappers with a single GlobalErrorEstimation(alg; equation, mode) parameterized by two orthogonal enums: - equation (GlobalErrorEquation): DefectCorrection (nonlinear ε' = f(P+ε) - P') or ErrorTransport (linearized ε' = J(P)ε + d, matrix-free JVP via DifferentiationInterface). - mode (GlobalErrorMode): InterpolatingMode (store the dense solution, integrate the companion in a second pass) or SimultaneousMode (advance the companion inline over each step for O(1) extra memory and no second solve). Both axes share one defect-companion implementation. Supersedes #3956 and #3957. Agent-Harness: Claude Code Agent-Model: claude-opus-4-8 Agent-Session: https://claude.ai/code/session_01MfUh8tgp3iBmMv9nkBqoyY Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Claude <[email protected]>
Independent PR — a single commit on current
master(GlobalDiffEq v1.4.0), with no dependency on the other GlobalDiffEq PRs; reviewable and mergeable on its own. Contains onlyGlobalErrorTransport. (It addssrc/companion.jl, byte-identical to the copy in #3957, so the two still merge cleanly in any order.)Summary
Adds
GlobalErrorTransport— global error estimation andgtol-based control by the linearized error-transport (first variational) equation, addressing SciML/GlobalDiffEq.jl#5 (Shampine 1986 / Berzins 1988 / Lang–Verwer 2007). After a dense forward solve with interpolantP(t), the companion linear ODEε' = J(P(t))ε + d(t)with the dense-output defectd(t) = f(P(t)) − P'(t)is integrated fromε(t₀)=0;‖ε(T)‖₂estimates the endpoint global error. The Jacobian is applied matrix-free via DifferentiationInterface (any ADTypes backend; defaultAutoForwardDiff()).global_error_estimate(prob, alg)is the standalone estimator.Review direction (this is the architectural thread)
Recording the plan from @ChrisRackauckas's comment so it's on record, split out from this PR:
has_global_error(alg)::Booltrait (defaultfalse); asol.global_errorfield (array-of-arrays matchingu,nothingwhen the method doesn't compute it); uniform accessors. (SciMLBase PR; public API + docs together.)savevalues!splits the partitioned(y, ε)ArrayPartitionso the user gets a normalsol.uand theεregister lands insol.global_error;has_global_errorreturnstrue. Documented as an OrdinaryDiffEq.jl feature.GlobalErrorTransport(this PR),GlobalDefectCorrection(GlobalDiffEq: add GlobalDefectCorrection global error estimation and control #3957), andGlobalAdjoint(GlobalDiffEq: add adjoint-based global error control as a SciMLSensitivity extension #3953) compute the estimate differently but populate the samesol.global_error.sol.global_erroralong the trajectory.Sequencing: SciMLBase interface → GLEE solver library → migrate wrappers → adjoint every-step. I'll open these as separate PRs and link them here. This PR will be revised to populate
sol.global_erroronce (1) lands.Validation (run locally, current master)
ODEDIFFEQ_TEST_GROUP=Core: pass — Basic 1/1, Algorithm traits 3/3, Companion error estimators 14/14, BigFloat 2/2.ODEDIFFEQ_TEST_GROUP=QA: pass — 23 passed, 1 pre-existing declared broken.gtol = 1e-7control delivered a true endpoint error of ~1e-8.🤖 Generated with Claude Code