Repository navigation
Pick the DAE initialization dt by magnitude, not signed min - #4549
Merged
ChrisRackauckas merged 1 commit intoSep 13, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
`min(integrator.dt / 5, dtmax)` returns the operand with the *larger* magnitude when both are negative, so a backward solve got the opposite of what a forward solve gets: with a typical automatic initial dt and dtmax equal to the span, forward selects |dt|/5 and backward selects |dtmax|. No behavioural change is demonstrated: the value is only consumed on the `!isnothing(alg.nlsolve)` branch, and `BrownFullBasicInit(; abstol, nlsolve)` defaults `nlsolve` to `nothing`, so on the default path the expression is dead. Committing it as a sign correction so the two directions agree if that branch is ever reached. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code 2.1.269 Agent-Model: claude-opus-5[1m] Agent-Session: https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE Claude-Session: https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE
ChrisRackauckas
marked this pull request as ready for review
September 13, 2026 06:58
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
- Stop tying the state Jacobian's finite-difference direction to tdir (#4543) - Extend OrdinaryDiffEqCore.dtnew_modification instead of shadowing it (#4547) - Pick the DAE initialization dt by magnitude, not signed min (#4549) - Accept a callable stage predictor on the nlsolve algorithms (#4539) - Run the QA test group last in every sublibrary that ran it first (#4551) - Apply stage limiters in every StabilizedRK method (#4550) 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
- Stop tying the state Jacobian's finite-difference direction to tdir (#4543) - Extend OrdinaryDiffEqCore.dtnew_modification instead of shadowing it (#4547) - Pick the DAE initialization dt by magnitude, not signed min (#4549) - Accept a callable stage predictor on the nlsolve algorithms (#4539) - Run the QA test group last in every sublibrary that ran it first (#4551) - Apply stage limiters in every StabilizedRK method (#4550) - Release OrdinaryDiffEqNonlinearSolve 2.9.8 (#4552) - Declare OrdinaryDiffEqCore.dtnew_modification public (#4553) - Fix baseline spelling and whitespace checks in tests (#4524) - Raise OrdinaryDiffEqNonlinearSolve floor for stage_predictor (#4554) 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses part 1 of #4538. Ignore until reviewed by @ChrisRackauckas. Draft.
What changed and why
at
initialize_dae.jl:223and:347. When both operands are negative — which is every backward-in-time solve, sincedtmaxis sign-converted to matchtdirinsolve.jl—minreturns the operand with the larger magnitude, the opposite of the forward case. With a typical automatic initial dt anddtmaxequal to the span, forward selects|dt|/5(tiny) and backward selects|dtmax|(the whole interval).No demonstrated behaviour change — read this before merging
I could not produce a test that fails without this patch, and I believe the reason is that the value is dead on the default path. It is consumed only here:
and
BrownFullBasicInit(; abstol = 1.0e-10, nlsolve = nothing)defaultsnlsolvetonothing(lib/DiffEqBase/src/dae_initialization.jl:50), so unless a user passes an explicitnlsolvethe branch never runs. Consistent with that reading, applying the patch changes nothing measurable: mass-matrix Robertson with a deliberately inconsistentu0 = [1.0, 0.0, 0.1]underBrownFullBasicInit(), forward versus mirrored-backward, gives byte-identical results before and after —So this is a sign correction shipped on the strength of inspection, not of an observed failure. If you would rather it stayed an issue until someone can exercise the explicit-
nlsolvepath, say so and I will close it.(The
1.110e-16above was my own harness bug, not a library one — I had negated the algebraic constraint row when mirroring, which a constraint should not pick up. With the mirror formulated correctly both solvers are bitwise reversible,u0 diff 0.000e+00. Written up in #4538.)Verification
lib/OrdinaryDiffEqBDF/test/dae_initialization_tests.jlon this branch: passes, 0 failures. This is the file that exercises_initialize_dae!directly.Pkg.test("OrdinaryDiffEqNonlinearSolve")on this branch (Julia 1.10.11):5 passed, 8 failed, 0 errored, 33 broken. All 8 are JET "Solver Type Stability Tests" (ABDF2, QNDF/QNDF1/QNDF2, FBDF, DFBDF, DABDF2, DImplicitEuler, MEBDF2, Rodas4). Master gives the identical5 passed, 8 failed, 0 errored, 33 brokenunderGROUP=QA, so they are pre-existing and untouched by this diff.No new test is added, deliberately: a test that passes with and without the patch would be worse than none.
What I did not verify
nlsolvepath itself (BrownFullBasicInit(nlsolve = ...)), which is the only place the changed expression is reachable. I did not construct a problem that goes down it.pre.Worth pushing back on
dtat all whenalg.nlsolve === nothing, so the dead expression cannot mislead the next reader. I kept the diff to the sign so the two sites stay comparable, but I'd take that change if you prefer it.🤖 Generated with Claude Code (model: claude-opus-5[1m], harness: Claude Code 2.1.269)
https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE