Skip to content

GlobalDiffEq: add adjoint-based global error control as a SciMLSensitivity extension#3953

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:globaldiffeq-adjoint
Draft

GlobalDiffEq: add adjoint-based global error control as a SciMLSensitivity extension#3953
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:globaldiffeq-adjoint

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.

Now rebased onto master#3929 (the repo transfer) has merged, so this PR is the base of the remaining GlobalDiffEq stack. The single commit here is the only change; review it directly.

Summary

Adds GlobalAdjoint and adjoint_error_estimate — adjoint-based a posteriori global error estimation and control (Cao and Petzold, SISC 26(2), 2004; closes SciML/GlobalDiffEq.jl#4). This is SciML/GlobalDiffEq.jl#56 carried into the monorepo, restructured as the package extension GlobalDiffEqSciMLSensitivityExt on SciMLSensitivity + QuadGK weakdeps so the base sublibrary stays light.

Differences from GlobalDiffEq.jl#56:

  • The SciMLSensitivity/QuadGK-touching internals (ODEAdjointProblem construction, defect quadrature, the default sensealg) moved into the extension; the algorithm struct, validation, fixed-parameter SciMLStructures wrapper, orthogonal-direction sampling, and the gtol control loop stay in the package.
  • sensealg defaults to nothing and resolves to SciMLSensitivity.QuadratureAdjoint(autojacvec = true) when the extension is loaded; solving without the extension raises an ArgumentError instructing to run using SciMLSensitivity, QuadGK.
  • Otherwise the public API and semantics are identical, and the test suite is the same plus an invalid-sensealg constructor check.

Version 1.3.0 (new public API), matching the bump proposed in GlobalDiffEq.jl#56.

Validation (run locally)

  • ODEDIFFEQ_TEST_GROUP=Core julia --project=lib/GlobalDiffEq -e 'using Pkg; Pkg.test()': pass — Basic 1/1, traits 3/3, Adjoint estimation and control 14/14, BigFloat 2/2
  • ODEDIFFEQ_TEST_GROUP=QA julia --project=lib/GlobalDiffEq -e 'using Pkg; Pkg.test()': pass — 22 passed, 1 pre-existing declared broken
  • The adjoint estimate/control tests verify the estimator against the analytic solution of a linear problem (ratio within 15%), gtol-controlled solves meeting a 1e-6 endpoint error, callable parameters, and the argument validation paths.

🤖 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>
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.

Global error estimation and control via adjoints

2 participants