Skip to content

Commit 29143d3

Browse files
Add DAE initialization algorithms: DefaultInit, BrownBasicInit, ShampineCollocationInit
- DefaultInit: Smart default that chooses between OverrideInit and CheckInit - BrownBasicInit: Brown et al. (1998) method for algebraic variable initialization - ShampineCollocationInit: Shampine (2001) collocation method for full initialization These algorithms provide standard, well-documented methods for DAE initialization with proper citations to the original papers. References: - Brown et al., SIAM J. Sci. Comput. 19(5), 1495-1512 (1998) - Shampine, SIAM J. Sci. Comput. 22(6), 2007-2026 (2001) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9f284fd commit 29143d3

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

src/DiffEqBase.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ include("stats.jl")
141141
include("calculate_residuals.jl")
142142
include("tableaus.jl")
143143
include("internal_itp.jl")
144+
include("dae_initialization.jl")
144145

145146
include("callbacks.jl")
146147
include("common_defaults.jl")

src/dae_initialization.jl

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# DAE Initialization Algorithms
2+
# The base types are in SciMLBase, we just add the specific algorithms here
3+
4+
import SciMLBase: DAEInitializationAlgorithm, initialize_dae!
5+
6+
"""
7+
struct DefaultInit <: DAEInitializationAlgorithm
8+
9+
The default initialization algorithm for DAEs. This will use heuristics to
10+
determine the most appropriate initialization based on the problem type.
11+
12+
For Sundials, this will use:
13+
- `OverrideInit` if the problem has `initialization_data` (typically from ModelingToolkit)
14+
- `CheckInit` otherwise
15+
"""
16+
struct DefaultInit <: DAEInitializationAlgorithm end
17+
18+
"""
19+
struct BrownBasicInit <: DAEInitializationAlgorithm
20+
21+
The Brown basic initialization algorithm for DAEs. This implementation
22+
is based on the algorithm described in:
23+
24+
Peter N. Brown, Alan C. Hindmarsh, and Linda R. Petzold,
25+
"Consistent Initial Condition Calculation for Differential-Algebraic Systems",
26+
SIAM Journal on Scientific Computing, Vol. 19, No. 5, pp. 1495-1512, 1998.
27+
DOI: https://doi.org/10.1137/S1064827595289996
28+
29+
This method modifies the algebraic variables and their derivatives to be
30+
consistent with the DAE constraints, while keeping the differential variables
31+
fixed. It uses Newton's method to solve for consistent initial values.
32+
33+
This is the default initialization for many DAE solvers when `differential_vars`
34+
is provided, allowing the solver to distinguish between differential and algebraic
35+
variables.
36+
"""
37+
struct BrownBasicInit <: DAEInitializationAlgorithm end
38+
39+
"""
40+
struct ShampineCollocationInit <: DAEInitializationAlgorithm
41+
42+
The Shampine collocation initialization algorithm for DAEs. This implementation
43+
is based on the algorithm described in:
44+
45+
Lawrence F. Shampine, "Consistent Initial Condition for Differential-Algebraic
46+
Systems", SIAM Journal on Scientific Computing, Vol. 22, No. 6, pp. 2007-2026, 2001.
47+
DOI: https://doi.org/10.1137/S1064827599355049
48+
49+
This method uses collocation on the first two steps to find consistent initial
50+
conditions. It modifies both the differential and algebraic variables to satisfy
51+
the DAE constraints. This is more general than BrownBasicInit but may be more
52+
expensive computationally.
53+
54+
This method is useful when you need to modify all variables (both differential
55+
and algebraic) to achieve consistency, rather than just the algebraic ones.
56+
"""
57+
struct ShampineCollocationInit <: DAEInitializationAlgorithm end
58+
59+
export DefaultInit, BrownBasicInit, ShampineCollocationInit

0 commit comments

Comments
 (0)