Skip to content

Rosenbrock32: refuse singular mass matrices (#4650) - #4653

Merged
ChrisRackauckas merged 5 commits into
SciML:masterfrom
greekera1000:rosenbrock32-dae-guard
Sep 27, 2026
Merged

ChrisRackauckas merged 5 commits into
SciML:masterfrom
greekera1000:rosenbrock32-dae-guard

Conversation

@greekera1000

Copy link
Copy Markdown
Contributor

Fixes #4650. Depends on #4619 (this branch is built on it; will rebase once it merges).

Rosenbrock32 is unstable on index-1 DAEs in both in-place and out-of-place form. Its 3rd-order update amplifies the algebraic constraint error each step, independent of dt, so round-off eventually forces dt to zero. On the issue's problem with tspan = (0, 3):

in-place out-of-place
tol 1e-6 Unstable (81 acc / 137 rej) Unstable (41 / 301)
tol 1e-8 Unstable (184 / 144) Unstable (147 / 130)

This PR throws an ArgumentError for singular mass matrices, pointing to Rosenbrock23/Rodas5P. Non-singular mass matrices are unaffected.

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

The test block added in #4619 for Rosenbrock32 on this DAE now checks that both forms throw, and that a non-singular mass matrix still solves.

disclosure : the analysis and the pr description were made with the help of claude , under my review and i have understood it

ChrisRackauckas and others added 5 commits September 26, 2026 14:14
inv(integrator.opts.abstol) fails for a vector abstol (inv has no
AbstractVector method), so mass-matrix DAEs errored in the Rosenbrock23/32
error estimate that adds the algebraic-constraint residual. inv.(abstol) is
bitwise identical for scalar abstol and gives elementwise reciprocals for
vector abstol. The Rosenbrock32ConstantCache site also called ifelse on the
differential_vars array unbroadcasted, which errors for any abstol; it now
broadcasts like the Rosenbrock23ConstantCache site.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
Agent-Harness: Devin CLI 3000.11.1
Agent-Model: swe-2-high
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/OrdinaryDiffEq.jl/jobs/4598-devin/log.txt on amdci2.julia.csail.mit.edu
Rosenbrock23 and Rodas5P solve a ROBER mass-matrix DAE with a vector
abstol, in-place and out-of-place; a vector abstol with equal entries must
reproduce the scalar-abstol trajectory bitwise. Rosenbrock32 is covered on
a non-stiff DAE since its DAE error estimate rejects to instability on
ROBER at tight tolerance even with scalar abstol.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
Agent-Harness: Devin CLI 3000.11.1
Agent-Model: swe-2-high
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/OrdinaryDiffEq.jl/jobs/4598-devin/log.txt on amdci2.julia.csail.mit.edu
On current master, OOP Rosenbrock32 is Unstable on the non-stiff DAE at
1e-6 for both scalar and vector abstol; use 1e-4 and require equal-entry
vector abstol to match the scalar trajectory bitwise.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_OrdinaryDiffEq.jl-4619/log.txt on amdci2.julia.csail.mit.edu
Use in-place ./abstol for the DAE algebraic EEst contribution, add a
non-uniform vector abstol regression with a hand-checked atmp scale,
and document the OOP Rosenbrock32 mass-matrix / tol-1e-6 limitation.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/adopt/SciML_OrdinaryDiffEq.jl-4619/log.txt on amdci2.julia.csail.mit.edu
@ChrisRackauckas
ChrisRackauckas merged commit ffbc2cd into SciML:master Sep 27, 2026
21 of 22 checks passed
ChrisRackauckas referenced this pull request Sep 29, 2026
* Bump DiffEqBase to 7.21.3

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqBDF to 2.4.12

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqSDIRK to 2.9.7

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqRosenbrock to 2.7.5

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqLowOrderRK to 2.2.6

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqTsit5 to 2.1.5

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqVerner to 2.4.2

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

* Bump OrdinaryDiffEqSymplecticRK to 2.2.3

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin CLI 3000.11.3 (Mac)
Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@greekera1000
greekera1000 deleted the rosenbrock32-dae-guard branch September 30, 2026 10:14
ChrisRackauckas added a commit that referenced this pull request Oct 11, 2026
… test, ScalarOperator mass matrix in SDIRK, GlobalDiffEq erased callback (#4780)

* Expect Rosenbrock32 to reject the DAE in the inference QA test

#4653 made Rosenbrock32 throw on singular mass matrices, so the DAE pass of
the perform_step! inference test errored at init. Assert the ArgumentError
for that pairing instead of running the inference check.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Gate the despecialized callback-erasure test on _erases_callback_types

Erasure only runs on Julia >= 1.12, so on 1.11 (Downgrade Sublibraries) the
problem comes back unchanged and has no callback kwarg. Test the unchanged
problem there.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Handle scalar mass matrices in the explicit-first-stage FSAL conversion

_mmdiag called diag on the mass matrix, which has no method for a
ScalarOperator or a UniformScaling, so TRBDF2 failed on mass_matrix =
ScalarOperator(λ). Use the scalar itself; it broadcasts in _mmdiv/_mmmul.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Ignore DiffEqBase's empty erased callback in GlobalDiffEq

On Julia >= 1.12 DiffEqBase injects an empty type-erased CallbackSet for
despecialized problems, so haskey(kwargs, :callback) rejected solves that
passed no callback. Only reject non-empty callbacks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Make the kwargs-merging callback helper work without erasure

erased_callbacks assumed every result carries an erased CallbackSet, but
erasure only runs on Julia >= 1.12. On lts the callback stays as given (or is
absent), so read it with get and accept a bare callback.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Apply the empty-callback check to problem kwargs in GlobalDiffEq

get_concrete_problem also writes the empty erased CallbackSet into
prob.kwargs, which _validate_estimation_problem rejected.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Evaluate a time-varying mass matrix at each FSAL conversion's own point

The explicit-first-stage FSAL conversion read a SciMLOperators mass matrix
once per step, at whatever (u, p, t) it last held, and reused that value
for the end-of-step fsallast. A time-varying ScalarOperator then mixes
M(t_n) into a conversion that needs M(t_n + dt). Read the diagonal at
(uprev, t) for the first stage and at (u, t + dt) for fsallast, via the
out-of-place update_coefficients so the operator itself is untouched.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

* Remove the _mmdiag_end method ambiguity on M === I

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DvrkppVVQKnQTGGgmLXhJh

---------

Co-authored-by: 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.

Out-of-place Rosenbrock32 with a mass matrix goes Unstable where in-place converges

2 participants