Skip to content

Fixing DAEs - #1105

Closed
kanav99 wants to merge 1 commit into
masterfrom
daefixes
Closed

kanav99 wants to merge 1 commit into
masterfrom
daefixes

Conversation

@kanav99

@kanav99 kanav99 commented Apr 8, 2020 •

Copy link
Copy Markdown
Contributor
  • FSAL
  • Callbacks
  • Interpolation

function reset_fsal!(integrator)
# Under these condtions, these algorithms are not FSAL anymore
if integrator.f isa DAEFunction
set_current_du!(integrator, integrator.cache)

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.

This can't be done because historical values are invalid after a discontinuity.

@TobiasFranzBRB

Copy link
Copy Markdown

What is the status of "DABDF2 fails with discrete callbacks"?

@ChrisRackauckas

Copy link
Copy Markdown
Member

Needs someone to fix it.

ChrisRackauckas added a commit that referenced this pull request Jan 25, 2022
@ChrisRackauckas
ChrisRackauckas deleted the daefixes branch January 25, 2022 07:28
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Oct 13, 2025
Resolves issue SciML#1105 in DifferentialEquations.jl

The IMEX method documentation (IMEXBDF, IMEXMultistep, and StabilizedIRK)
incorrectly showed examples using regular ODEProblem with the Lorenz system,
but IMEX methods require SplitODEProblem formulation to split the ODE into
stiff (implicit) and non-stiff (explicit) components.

Changes:
- Created new common_imex_first_steps.jl template with proper SplitODEProblem examples
- Updated IMEXBDF.md to use the new template
- Updated IMEXMultistep.md to use the new template
- Updated StabilizedIRK.md to use the new template

The new examples demonstrate:
1. A reaction-diffusion system with diffusion (implicit) and reaction (explicit) splitting
2. A simple scalar exponential growth example with proper splitting
3. Fixed timestep specification (dt parameter) required by IMEX multistep methods

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/OrdinaryDiffEq.jl that referenced this pull request Jul 23, 2026
…lg collapse target

_homotopy_init_alg hand-rolls exactly NonlinearSolve.FastShortcutHomotopyPolyalg(; autodiff)
(SciML/NonlinearSolve.jl#1105). Once that releases, this body collapses to a call to it.

Comment-only; no behavior change.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GSXiS4u4BaR2RvGFWGEQeH
ChrisRackauckas added a commit that referenced this pull request Jul 23, 2026
…lve → nothing) (#3989)

* Initialize HomotopyProblem init systems by continuation, honoring autodiff

The DAE-initialization OverrideInit path picks the nonlinear algorithm for the init
problem via `default_nlsolve`. A `SciMLBase.HomotopyProblem` (built by ModelingToolkit
when the init system carries Modelica `homotopy(actual, simplified)` operators) must be
solved by continuation, not by a Newton polyalgorithm.

`default_nlsolve` now returns a `HomotopyPolyAlgorithm` (sweep, then pseudo-arclength) for a
`HomotopyProblem`, with the `autodiff` argument threaded into the continuation's *inner
corrector* (`FastShortcutNonlinearPolyalg`) — the differentiation the sweep and the
secant-predictor arclength stage actually use, and where a finite-diff initialization must
avoid dual-numbering a residual that is not ForwardDiff-safe. (A high-level `autodiff` knob
on `HomotopyPolyAlgorithm` itself cannot do this: it lives in NonlinearSolveBase, which
cannot construct the concrete inner solver, so the AD rides on the inner algorithm here.)

Handing a `HomotopyProblem` a plain Newton polyalgorithm instead — as the previous
`AbstractNonlinearProblem` default did — solves only the target-λ system directly (see the
companion `solve(::HomotopyProblem, ::AbstractNonlinearSolveAlgorithm)` in NonlinearSolve),
which on branch selection returns a `Success` retcode on the wrong root (measured `-1.0` vs
the physical `+1.0`).

An `SCCNonlinearProblem` with `HomotopyProblem` blocks is solved with `nothing` so each
block picks its own default (homotopy blocks continue, plain blocks Newton-solve). The
`autodiff` signal cannot be threaded per block from here — `SCCNonlinearSolve` applies one
algorithm to every block — so that is left to a follow-up (routing by block type in
`SCCNonlinearSolve`); the code comment records this.

Adds test/homotopy_default_nlsolve_tests.jl (including a ForwardDiff-hostile residual that
only the finite-diff inner can solve, proving the AD is genuinely threaded).

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

* Cite SciML/NonlinearSolve.jl#1104 as the per-block SCC autodiff follow-up

The SCC homotopy `default_nlsolve` methods return `nothing` (each block picks
its own default) so homotopy blocks continue on the correct branch, at the
cost of the continuation using its default inner corrector instead of the
requested AD backend. #1104 adds the SCCNonlinearSolve per-block routing that
makes returning `FastShortcutNonlinearPolyalg(; autodiff)` here honor autodiff
per block; the NOTE now points at it as the concrete follow-up.

Comment-only; no behavior change.

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

* Note FastShortcutHomotopyPolyalg (#1105) as the _homotopy_init_alg collapse target

_homotopy_init_alg hand-rolls exactly NonlinearSolve.FastShortcutHomotopyPolyalg(; autodiff)
(SciML/NonlinearSolve.jl#1105). Once that releases, this body collapses to a call to it.

Comment-only; no behavior change.

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

* Correct the homotopy-init follow-up notes: blocked on OrdinaryDiffEq LinearSolve-5 migration

The SCC per-block-autodiff flip and the FastShortcutHomotopyPolyalg collapse both need
NonlinearSolve 4.23 / SCCNonlinearSolve 1.14 / NonlinearSolveBase 2.37, which require
LinearSolve 5. OrdinaryDiffEq is capped at LinearSolve "3.75.0, 4" (pinned to
NonlinearSolve <= 4.21), so the follow-ups are blocked on the LinearSolve-5 migration, not
merely on those packages being released (they are). The SCC flip additionally needs a direct
SCCNonlinearSolve dependency (it is a reverse dep of NonlinearSolve). Notes updated to say so.

Comment-only; no behavior change.

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

---------

Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Claude Opus 4.8 (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.

3 participants