Skip to content

Add DAE initialization support#91

Merged
ChrisRackauckas merged 8 commits intoSciML:masterfrom
ChrisRackauckas-Claude:add-dae-initialization-support
Mar 20, 2026
Merged

Add DAE initialization support#91
ChrisRackauckas merged 8 commits intoSciML:masterfrom
ChrisRackauckas-Claude:add-dae-initialization-support

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

This PR adds comprehensive DAE initialization support to ODEInterfaceDiffEq, following the pattern from Sundials.jl.

New Features

  • Support for NoInit, CheckInit, OverrideInit, and DefaultInit algorithms
  • CheckInit verifies algebraic constraints are satisfied at t0
  • OverrideInit uses SciMLBase's initialization system for ModelingToolkit problems
  • DefaultInit dispatches to OverrideInit if initialization_data exists, otherwise falls back to CheckInit

Implementation

  • New initialize.jl file with initialize_dae! methods for ODEInterfaceIntegrator
  • Modified solve.jl to call initialize_dae! before solving
  • Supports mass matrix DAEs where algebraic equations have zero rows in M

Tests

  • Basic DAE initialization tests (Robertson model with mass matrix)
  • MTK-based initialization tests with @mtkcompile
  • Tests for missing parameters determined via initialization_eqs
  • Pendulum DAE example testing constraint satisfaction

Related

This follows the pattern established in Sundials.jl for DAE initialization support.

ChrisRackauckas and others added 8 commits March 19, 2026 09:29
This PR adds comprehensive DAE initialization support to ODEInterfaceDiffEq,
following the pattern from Sundials.jl.

New features:
- Support for NoInit, CheckInit, OverrideInit, and DefaultInit algorithms
- CheckInit verifies algebraic constraints are satisfied at t0
- OverrideInit uses SciMLBase's initialization system for MTK problems
- DefaultInit dispatches to OverrideInit if initialization_data exists,
  otherwise falls back to CheckInit

Implementation:
- New initialize.jl file with initialize_dae! methods for ODEInterfaceIntegrator
- Modified solve.jl to call initialize_dae! before solving
- Supports mass matrix DAEs where algebraic equations have zero rows in M

Tests:
- Basic DAE initialization tests (Robertson model with mass matrix)
- MTK-based initialization tests with @mtkcompile
- Tests for missing parameters determined via initialization_eqs
- Pendulum DAE example testing constraint satisfaction
DefaultInit now:
1. First runs OverrideInit to compute consistent initial conditions
2. Then runs CheckInit to verify algebraic constraints are satisfied

This matches the behavior in Sundials.jl v5.
- Reformat radau/radau5 keyword constructors to match Runic style
- Accept AbstractMatrix (not just Matrix) for mass_matrix, converting
  to full Matrix for ODEInterface. Fixes Diagonal mass matrices from MTK.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OverrideInit internally solves a NonlinearProblem for DAE initialization.
Without NonlinearSolve loaded, there's no default solver dispatch.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use SciMLStructures.canonicalize to update parameters in-place after
  OverrideInit, so sol.ps[param] reflects the computed values.
- Fix pendulum test to use numeric L value instead of symbolic parameter
  in boolean context.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 22f2431 into SciML:master Mar 20, 2026
4 checks passed
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