Add StiffInitDt: component-wise initial step size algorithm for all implicit solvers#3085
Conversation
b3dab6f to
b8c0e2c
Compare
b4a9325 to
6ec9932
Compare
CI Fix UpdateAddressed the test failures from the IDA-style DAE initial step size changes: Fixes applied:
Remaining known failures (pre-existing, unrelated):
|
6ec9932 to
ec4aed2
Compare
|
Rebased onto latest master (43 commits behind). Most CI failures from the previous run were caused by being behind master (stale formatting before the Runic run, missing STALD code, cache restore infrastructure issues). The rebase should resolve these. |
|
Is this just a better initialization alg? Is there anything stiffness related here? |
|
It's an init dt algorithm that isn't unstable for stiff equations |
|
Right, but is it just better than our current initialization? |
CI Fix: nf stat tracking and DAE guard cleanupPushed a fix for CI failures identified in the previous run: 1. InterfaceIII stats_tests failures (all Julia versions)
2. OrdinaryDiffEqNonlinearSolve sparse_dae_initialization failure
Pre-existing/unrelated failures (not caused by this PR):
|
Not generally, because it requires a few f-evals so it is heavier to do when a non-stiff equation. |
|
It looks like it's only ~a few more f calls if the step size converges quickly. Is that really a problem? |
|
We could look into always doing it. Would take a bit more benchmarking |
a4243bd to
2d80e1a
Compare
b32665f to
2d80e1a
Compare
CI Update - Latest Fixes (commits b3ea865, 2d80e1a)GitHub Actions CI is not triggering for the latest push (may need maintainer approval for fork workflow runs). The following fixes were added to address CI failures from the previous run: Fixes Applied
Verified Locally
Could someone please approve the workflow run or re-trigger CI? |
2d80e1a to
43af816
Compare
Fix: DAEProblem initdt regression and test tolerancesRoot cause analysis for CI failures: InterfaceI (static_array_tests.jl:297) - DFBDF DAE SArray vs ArrayThe initial StiffInitDt commit inadvertently changed the OrdinaryDiffEqNonlinearSolve (newton_tests.jl) - nf count testThe test All fixes verified locally on Julia 1.11. |
60f03e3 to
75e50e5
Compare
Commit 7: Unify initdt to single CVHin algorithm with order dependencePer discussion, unified the initdt system from two algorithms to one: Changes
AlgorithmThe unified algorithm is the CVHin iterative algorithm from SUNDIALS CVODE with one key enhancement: the step size formula uses the method order. For order-1 methods this gives Test results (local, Julia 1.12)
Net diff: -456 lines added, +64 lines → 392 lines deleted |
Replace the Hairer-Wanner initial step size algorithm with the CVODE CVHin algorithm (Hindmarsh et al., 2005) for all deterministic ODE solvers. This fixes issue SciML#1496 where zero initial conditions with tiny abstol produced catastrophically small initial timesteps (~5e-25). CVHin uses component-wise iterative estimation: - Upper bound from most restrictive component: min_i(tol_i / |f₀_i|) - Geometric mean of lower/upper bounds as initial guess - Up to 4 refinement iterations with finite-difference second derivatives - Order-dependent step proposal: h ~ (2/yddnrm)^(1/(p+1)) - 0.5 safety factor with bounds clamping For stochastic problems (g !== nothing), the Hairer-Wanner algorithm with diffusion terms is preserved unchanged. Fixes SciML#1496 Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
7fb9f5a to
4112586
Compare
Rebased onto master (post #3137 stochastic support merge)Key changes in this rebase:
Test results:
Algorithm structure: |
| hnew = convert( | ||
| _tType, | ||
| oneunit_tType * DiffEqBase.value( | ||
| (2 / yddnrm)^(1 / (p_order + 1)) |
Summary
StiffInitDt) based on the CVHin algorithm from SUNDIALS CVODE (Hindmarsh et al., 2005)StiffInitDtinstead of the Hairer-Wanner algorithmDefaultInitDt)Motivation
Fixes #1496. The Hairer-Wanner algorithm uses RMS norms where problematic components get diluted by 1/sqrt(N), producing catastrophically small initial dt (e.g., ~5e-25) for large stiff reactive-transport problems. This causes solvers like FBDF/QNDF to hit MaxIters at t=0.0 while CVODE_BDF succeeds.
Implementation
InitDtAlgabstract type hierarchy withDefaultInitDtandStiffInitDtstructsinitdt_alg(alg)trait dispatches on algorithm type:OrdinaryDiffEqAdaptiveImplicitAlgorithm->StiffInitDt()OrdinaryDiffEqImplicitAlgorithm->StiffInitDt()DefaultInitDt()StiffInitDtalgorithm:linsolvewith try/catch fallback for singular matrices (DAEs)Test plan
Generated with Claude Code