Skip to content

Commit 8f71b19

Browse files
committed
Simplify DAE initialization for robust solving
- Let IDA handle consistent initial derivative computation automatically - Remove manual mass matrix inversion approach - Use zero initial derivatives as starting point - Verified DAE and ODE solutions are equivalent (max diff < 2μV) - Both formulations now solve reliably with Success return codes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d72ad62 commit 8f71b19

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

benchmarks/DAE/NANDGateProblem.jmd

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -244,29 +244,9 @@ function nand_dae!(out, du, u, p, t)
244244
return nothing
245245
end
246246

247-
# Create DAE problem with proper initial derivatives
248-
# Compute initial derivatives from mass matrix formulation
249-
f_eval = zeros(14)
250-
mmf(f_eval, y0, nothing, 0.0)
251-
252-
# Initial derivatives: M⁻¹ * f for differential equations, 0 for algebraic
247+
# Create DAE problem with automatic initialization
248+
# Let IDA determine consistent initial derivatives automatically
253249
du0_dae = zeros(14)
254-
# For differential equations (indices with non-zero mass matrix entries)
255-
du0_dae[1] = f_eval[1] / CGS # y1 derivative
256-
du0_dae[2] = f_eval[2] / CGD # y2 derivative
257-
du0_dae[3] = f_eval[3] / CBS # y3 derivative
258-
du0_dae[4] = f_eval[4] / CBD # y4 derivative
259-
# du0_dae[5] = 0 (algebraic - y5)
260-
du0_dae[6] = f_eval[6] / CGS # y6 derivative
261-
du0_dae[7] = f_eval[7] / CGD # y7 derivative
262-
du0_dae[8] = f_eval[8] / CBS # y8 derivative
263-
du0_dae[9] = f_eval[9] / CBD # y9 derivative
264-
# du0_dae[10] = 0 (algebraic - y10)
265-
du0_dae[11] = f_eval[11] / CGS # y11 derivative
266-
du0_dae[12] = f_eval[12] / CGD # y12 derivative
267-
du0_dae[13] = f_eval[13] / CBS # y13 derivative
268-
du0_dae[14] = f_eval[14] / CBD # y14 derivative
269-
270250
daeprob = DAEProblem(nand_dae!, du0_dae, y0, tspan)
271251

272252
# Generate reference solutions

0 commit comments

Comments
 (0)