Skip to content

GlobalAdjoint: every-step trajectory scope and step-grid control (closes #4493, #4494) - #4495

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:globaldiffeq-adjoint-modes
Sep 11, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:globaldiffeq-adjoint-modes

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore until reviewed by @ChrisRackauckas. Draft — not ready for merge.

Implements the two GlobalAdjoint follow-ups from the merged adjoint PR (#3953),
as two orthogonal enum options. Closes #4493 and #4494.

What changed

Both reuse the existing machinery: the extension's _adjoint_defect_projection
gains a terminal_time argument, and the autojacvec=false ForwardDiff-Jacobian
default is kept (the RHS reads the solution interpolant, which the VJP backends
mishandle — SciML/SciMLSensitivity.jl#1649).

Verification

Local, Julia 1.12, lib/GlobalDiffEq.

GROUP=Core:

Companion error estimators           |  43  43
Adjoint error estimation and control |  35  35
GLEE solvers                         |  91  91
BigFloat support                     |   2   2
     Testing GlobalDiffEq tests passed

The new mode tests verify (on the linear problem u'=2u, exact error known):
TrajectoryError fills global_error along the path with global_error[1]=0,
global_error[end] ≤ gtol, and each well-resolved per-time estimate (error above
gtol/10) matches the true error to rtol=0.2; StepGridRefinement returns a
successful non-adaptive solution meeting gtol.

GROUP=QA (Aqua + ExplicitImports + JET): Testing GlobalDiffEq tests passed.
Runic: clean.

Note for the reviewer

  • Per-time matching is only asserted above gtol/10. Below that the true
    error is at the adjoint noise floor, so a ratio of two tiny numbers is
    meaningless — not a loosened tolerance hiding a defect (the endpoint estimate is
    validated separately in the existing suite).
  • TrajectoryError costs one reverse-adjoint solve per saved time per sample and
    returns a dense, every-step solution; it is opt-in.
  • New public names get docstrings + docs entries; version bumped 1.6.0 → 1.7.0.

Not verified

Downstream packages, GPU paths, allowed-to-fail CI jobs.

🤖 Generated with Claude Code (model: claude-opus-4-8)
https://claude.ai/code/session_01MfUh8tgp3iBmMv9nkBqoyY

Add two orthogonal enum options to GlobalAdjoint:

  - scope (GlobalAdjointScope): EndpointError (default) fills only
    sol.global_error[end]; TrajectoryError estimates the error 2-norm at every
    saved time via a discrete adjoint cost placed at each t_i, filling
    sol.global_error along the whole trajectory.
  - control (GlobalAdjointControl): ToleranceRefinement (default) tightens local
    tolerances and re-solves adaptively; StepGridRefinement re-solves
    non-adaptively on exactly the accepted step grid (adaptive=false, stepping on
    the adjoint-informed dts) for a reproducible fixed-step schedule.

Both keep the autojacvec=false (ForwardDiff Jacobian) path, since the estimator
differentiates a RHS that reads the solution interpolant (SciML/SciMLSensitivity.jl#1649).

Closes SciML#4493 and SciML#4494.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude <[email protected]>
Agent-Harness: Claude Code
Agent-Model: claude-opus-4-8
Agent-Session: https://claude.ai/code/session_01MfUh8tgp3iBmMv9nkBqoyY
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 11, 2026 10:40
@ChrisRackauckas
ChrisRackauckas merged commit 0f08fbd into SciML:master Sep 11, 2026
127 of 133 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 11, 2026
- Unify companion global error estimators into GlobalErrorEstimation (#4492)
- Add adjoint-based global error control as a SciMLSensitivity extension (#3953)
- ExpRK: cache ishermitian (rebase of #4305, + review fixes) (#4497)
- Mark discrete time-grid search helpers as Enzyme inactive (#4496)
- GlobalAdjoint: every-step trajectory scope and step-grid control (#4495)
- GlobalAdjoint: defer to adjoint_sensitivities default instead of pinning an adjoint (#4498)
- Release GlobalDiffEq 1.7.1 (#4501)
- Fix GlobalDiffEq precompilation on Julia 1.13 and companion accuracy (#4500)
- Make mass-matrix identity/zero/diagonal checks GPU-safe (#4502)
- Fix BDF step rejection for backward-in-time integration (#4503)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 12, 2026
- Release OrdinaryDiffEqBDF 2.4.7 (#4490)
- Unify companion global error estimators into GlobalErrorEstimation (#4492)
- Add adjoint-based global error control as a SciMLSensitivity extension (#3953)
- ExpRK: cache ishermitian (rebase of #4305, + review fixes) (#4497)
- Mark discrete time-grid search helpers as Enzyme inactive (#4496)
- GlobalAdjoint: every-step trajectory scope and step-grid control (#4495)
- GlobalAdjoint: defer to adjoint_sensitivities default instead of pinning an adjoint (#4498)
- Release GlobalDiffEq 1.7.1 (#4501)
- Fix GlobalDiffEq precompilation on Julia 1.13 and companion accuracy (#4500)
- Make mass-matrix identity/zero/diagonal checks GPU-safe (#4502)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 13, 2026
- Unify companion global error estimators into GlobalErrorEstimation (#4492)
- Add adjoint-based global error control as a SciMLSensitivity extension (#3953)
- ExpRK: cache ishermitian (rebase of #4305, + review fixes) (#4497)
- Mark discrete time-grid search helpers as Enzyme inactive (#4496)
- GlobalAdjoint: every-step trajectory scope and step-grid control (#4495)
- GlobalAdjoint: defer to adjoint_sensitivities default instead of pinning an adjoint (#4498)
- Release GlobalDiffEq 1.7.1 (#4501)
- Fix GlobalDiffEq precompilation on Julia 1.13 and companion accuracy (#4500)
- Make mass-matrix identity/zero/diagonal checks GPU-safe (#4502)
- Fix BDF step rejection for backward-in-time integration (#4503)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

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.

GlobalAdjoint: every-step global-error mode (fill sol.global_error along the trajectory)

2 participants