Skip to content

Optimizations to Discontinuity Detection Scheme - #3720

Merged
oscardssmith merged 17 commits into
SciML:masterfrom
Shreyas-Ekanathan:disco-optimizations
Jul 29, 2026
Merged

Optimizations to Discontinuity Detection Scheme#3720
oscardssmith merged 17 commits into
SciML:masterfrom
Shreyas-Ekanathan:disco-optimizations

Conversation

@Shreyas-Ekanathan

Copy link
Copy Markdown
Contributor

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
      contributor guidelines, in particular the SciML Style Guide and
      COLPRAC.
  • Any new documentation only uses public API

Additional context

Optimizations:

  • Add a tstop on the first identification of a discontinuity to help with step-resizing and prevent excessively large steps after finding a discontinuity. This should help us not take unreasonable steps, as Oscar suggested, and helps with error resetting after passing a discontinuity (since we are effectively in a new regime) to begin stepping anew.
  • Shrink the solve window for the interval nonlinear problem after finding a discontinuity
  • Move _ode_addsteps! out of the zero_func_struct call and only call it once per discontinuity detection run

Comment thread lib/OrdinaryDiffEqBDF/src/controllers.jl Outdated
Comment thread lib/OrdinaryDiffEqCore/src/integrators/controllers.jl
Comment thread lib/OrdinaryDiffEqCore/src/integrators/type.jl
Comment thread lib/OrdinaryDiffEqCore/src/disco.jl Outdated
Comment thread lib/OrdinaryDiffEqCore/src/disco.jl Outdated
is_disco = integrator.is_disco_step
if is_disco
integrator.is_disco_step = false
cache.nconsteps = 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this line doing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's not a standard timestep BDF shouldn't really count this step towards its order selection logic right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisRackauckas thoughts on this? I don't know how we want disco to interact with BDF well enough here.

Comment thread lib/OrdinaryDiffEqBDF/src/controllers.jl Outdated
Comment thread lib/OrdinaryDiffEqCore/src/integrators/controllers.jl Outdated
@oscardssmith

Copy link
Copy Markdown
Member

is this ready to merge?

@Shreyas-Ekanathan

Copy link
Copy Markdown
Contributor Author

is this ready to merge?

yes should be

@oscardssmith

Copy link
Copy Markdown
Member

any idea why so much CI is failing?

@Shreyas-Ekanathan

Copy link
Copy Markdown
Contributor Author

any idea why so much CI is failing?

Honestly not sure, it seems pretty random. I pushed another small fix for what I could see that is disco's fault, the remainder appears unrelated

@oscardssmith
oscardssmith merged commit fd3f95b into SciML:master Jul 29, 2026
217 of 256 checks passed
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Jul 30, 2026
The disco-optimizations merge (SciML#3720) landed three files that Runic rejects, so
format-check has been failing on master for every PR since. Whitespace and line
wrapping only; `runic --check .` is clean across the repo afterwards.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DKB6v14nZHZPYtKiLsPLDT
ChrisRackauckas added a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Jul 31, 2026
Six floors on master permit dependency versions that lack symbols the code
references. AutoMerge has been rejecting the OrdinaryDiffEqBDF 2.4.1 and
OrdinaryDiffEqSDIRK 2.8.2 registrations since 2026-07-29 for two of them.

DiffEqBase floors (Core, Differentiation, NonlinearSolve)

  All three require SciMLBase = "3.40", but the first DiffEqBase permitting
  SciMLBase 3.40 is 7.10.0. With a DiffEqBase floor of "7"/"7.8" the resolver
  has no solution at all — `Pkg.instantiate()` on any of the three fails with
  an unsatisfiable DiffEqBase. Raised to "7.10".

OrdinaryDiffEqBDF and OrdinaryDiffEqFIRK -> OrdinaryDiffEqCore "4.12"

  Both read integrator.is_disco_step and integrator.disco_checkpoint. Those
  ODEIntegrator fields arrived with the DISCO work merged 2026-07-29 (SciML#3720)
  and are not in any released Core; the first to carry them is 4.12.0. Against
  Core 4.11.0 BDF fails to load with

    FieldError: type OrdinaryDiffEqCore.ODEIntegrator has no field `is_disco_step`

  FIRK's master tree already diverges from the registered 2.5.0 (which predates
  the field use), so it is bumped to 2.5.1 to make the corrected floor
  releasable.

OrdinaryDiffEqSDIRK -> OrdinaryDiffEqNonlinearSolve "2.6"

  Imports can_smooth_est, added in SciML#3823. The version carrying it was never
  registered (ONLS goes 2.5.0 -> master 2.6.0), so against any released ONLS
  SDIRK fails to load with

    UndefVarError: `can_smooth_est` not defined in `OrdinaryDiffEqSDIRK`

Audit method, since this class keeps recurring (SciML#2600, SciML#4078, SciML#4079)

  Diffed the ODEIntegrator struct between the registered Core 4.11.0 tree and
  master for added fields, then grepped every sublibrary for accesses to them;
  and cross-referenced every qualified access and explicit import name against
  the registered OrdinaryDiffEqCore 4.11.0 and OrdinaryDiffEqNonlinearSolve
  2.5.0 trees. No sublibrary references a Core *name* absent at 4.11.0 — the
  only Core gaps are the two struct fields — and can_smooth_est is the only
  NonlinearSolve gap.

Verified locally: SDIRK loads against the in-tree ONLS, and BDF loads and
solves (FBDF on a scalar decay problem returns 0.36790983175798864).

Metadata-only apart from the FIRK version bump.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZqxphdTA1MydR1WXye9Jc
ChrisRackauckas added a commit that referenced this pull request Jul 31, 2026
…es (#4084)

* Correct dependency floors blocking the pending base and solver releases

Six floors on master permit dependency versions that lack symbols the code
references. AutoMerge has been rejecting the OrdinaryDiffEqBDF 2.4.1 and
OrdinaryDiffEqSDIRK 2.8.2 registrations since 2026-07-29 for two of them.

DiffEqBase floors (Core, Differentiation, NonlinearSolve)

  All three require SciMLBase = "3.40", but the first DiffEqBase permitting
  SciMLBase 3.40 is 7.10.0. With a DiffEqBase floor of "7"/"7.8" the resolver
  has no solution at all — `Pkg.instantiate()` on any of the three fails with
  an unsatisfiable DiffEqBase. Raised to "7.10".

OrdinaryDiffEqBDF and OrdinaryDiffEqFIRK -> OrdinaryDiffEqCore "4.12"

  Both read integrator.is_disco_step and integrator.disco_checkpoint. Those
  ODEIntegrator fields arrived with the DISCO work merged 2026-07-29 (#3720)
  and are not in any released Core; the first to carry them is 4.12.0. Against
  Core 4.11.0 BDF fails to load with

    FieldError: type OrdinaryDiffEqCore.ODEIntegrator has no field `is_disco_step`

  FIRK's master tree already diverges from the registered 2.5.0 (which predates
  the field use), so it is bumped to 2.5.1 to make the corrected floor
  releasable.

OrdinaryDiffEqSDIRK -> OrdinaryDiffEqNonlinearSolve "2.6"

  Imports can_smooth_est, added in #3823. The version carrying it was never
  registered (ONLS goes 2.5.0 -> master 2.6.0), so against any released ONLS
  SDIRK fails to load with

    UndefVarError: `can_smooth_est` not defined in `OrdinaryDiffEqSDIRK`

Audit method, since this class keeps recurring (#2600, #4078, #4079)

  Diffed the ODEIntegrator struct between the registered Core 4.11.0 tree and
  master for added fields, then grepped every sublibrary for accesses to them;
  and cross-referenced every qualified access and explicit import name against
  the registered OrdinaryDiffEqCore 4.11.0 and OrdinaryDiffEqNonlinearSolve
  2.5.0 trees. No sublibrary references a Core *name* absent at 4.11.0 — the
  only Core gaps are the two struct fields — and can_smooth_est is the only
  NonlinearSolve gap.

Verified locally: SDIRK loads against the in-tree ONLS, and BDF loads and
solves (FBDF on a scalar decay problem returns 0.36790983175798864).

Metadata-only apart from the FIRK version bump.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZqxphdTA1MydR1WXye9Jc

* Also floor Differentiation and NonlinearSolve on Core 4.12 / Differentiation 3.6

Same rule as the DiffEqBase floors in the previous commit, applied to the
sibling dependencies rather than DiffEqBase: a package requiring
SciMLBase = "3.40" cannot resolve against any sibling version whose own compat
caps SciMLBase below 3.40.

  OrdinaryDiffEqDifferentiation -> OrdinaryDiffEqCore "4.12"
  OrdinaryDiffEqNonlinearSolve  -> OrdinaryDiffEqCore "4.12"
  OrdinaryDiffEqNonlinearSolve  -> OrdinaryDiffEqDifferentiation "3.6"

The released Core tops out at 4.11.0, which declares SciMLBase = "3.39", and the
released Differentiation at 3.5.0. With the old "4" / "4.6" / "3" floors both
packages are unresolvable:

  Unsatisfiable requirements detected for package OrdinaryDiffEqCore:
    restricted to versions 4 by OrdinaryDiffEqDifferentiation, leaving 4.0.0 - 4.11.0
    restricted by compatibility requirements with SciMLBase to versions: uninstalled

Exactly four packages on master require SciMLBase 3.40 — DiffEqBase,
OrdinaryDiffEqCore, OrdinaryDiffEqDifferentiation, OrdinaryDiffEqNonlinearSolve
— so only their sibling floors need this treatment. Packages that still allow
SciMLBase 3.39 resolve fine against the older siblings and are left alone.

This fixes the release order: DiffEqBase 7.10.0 (registered), then
OrdinaryDiffEqCore 4.12.0, then OrdinaryDiffEqDifferentiation 3.6.0, then
OrdinaryDiffEqNonlinearSolve 2.6.0, then the blocked BDF and SDIRK.

Verified locally: Core 4.12.0 with [sources] stripped resolves against
registry-only dependencies (picking DiffEqBase 7.10.0) and loads; ONLS and
Differentiation instantiate and load in-tree. Their registry-only check has to
wait until Core 4.12.0 is actually registered.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
ChrisRackauckas added a commit that referenced this pull request Aug 1, 2026
The disco-optimizations merge (#3720) landed three files that Runic rejects, so
format-check has been failing on master for every PR since. Whitespace and line
wrapping only; `runic --check .` is clean across the repo afterwards.



Claude-Session: https://claude.ai/code/session_01DKB6v14nZHZPYtKiLsPLDT

Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.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