Releases: SciML/Sundials.jl
v5.1.0
Sundials v5.1.0
v5.0.0
Sundials v5.0.0
Breaking Changes
Upgrade to Sundials v7
This release updates the underlying Sundials C library from v5 to v7, which introduces significant API changes. This is a breaking change for users directly using the low-level Sundials API.
Key Changes:
-
SUNContext requirement: All Sundials objects now require a
SUNContext
object for creation. This context manages the Sundials environment and must be created before any solver objects. -
Memory management: The new context-based approach improves thread safety and resource management.
Migration Guide for Low-Level API Users:
If you're using the low-level Sundials API directly (not through the DiffEq interface):
# Old code (v4.x) - No context needed
mem_ptr = CVodeCreate(CV_BDF)
mem = Handle(mem_ptr)
# New code (v5.0) - Context required
ctx_ptr = Ref{SUNContext}(C_NULL)
SUNContext_Create(C_NULL, Base.unsafe_convert(Ptr{SUNContext}, ctx_ptr))
ctx = ctx_ptr[]
mem_ptr = CVodeCreate(CV_BDF, ctx) # Context passed as argument
mem = Handle(mem_ptr)
# ... use solver ...
SUNContext_Free(ctx) # Clean up context when done
Automatic handling in high-level interface:
If you're using the standard DiffEq interface (solve(prob, CVODE_BDF())
), no changes are needed. The context is automatically managed internally:
# This continues to work without changes
sol = solve(prob, CVODE_BDF())
Functions affected by context requirement:
- All solver creation functions (
CVodeCreate
,ARKStepCreate
,IDACreate
,KINCreate
) - All vector creation functions (
N_VNew_Serial
, etc.) - All matrix creation functions (
SUNDenseMatrix
,SUNBandMatrix
, etc.) - All linear solver creation functions (
SUNLinSol_Dense
, etc.)
The context is automatically freed when the integrator is garbage collected through the ContextHandle
mechanism.
DAE Initialization Algorithm Changes
The default initialization behavior for DAE problems has changed significantly. This is a breaking change that may affect existing code using IDA.
Previous behavior:
- IDA would automatically attempt to compute consistent initial conditions by default
- This automatic initialization could sometimes produce incorrect results without warning
New behavior:
- The default is now validation-only mode that checks if provided initial conditions are consistent
- If initial conditions are inconsistent, an error is raised with a clear message
- Automatic initialization must be explicitly requested
Migration Guide:
If you have existing code that relies on automatic DAE initialization:
# Old code (v4.x) - automatic initialization was implicit
prob = DAEProblem(f, du0, u0, tspan, differential_vars = differential_vars)
sol = solve(prob, IDA())
You now have several options:
- Use automatic initialization explicitly (recommended for most users):
using DiffEqBase: BrownFullBasicInit
prob = DAEProblem(f, du0, u0, tspan, differential_vars = differential_vars)
sol = solve(prob, IDA(), initializealg = BrownFullBasicInit())
- Provide consistent initial conditions:
# Ensure du0 and u0 satisfy f(du0, u0, p, t0) = 0
prob = DAEProblem(f, du0, u0, tspan, differential_vars = differential_vars)
sol = solve(prob, IDA()) # Will validate and proceed if consistent
- For problems without differential_vars information:
using DiffEqBase: ShampineCollocationInit
prob = DAEProblem(f, du0, u0, tspan) # No differential_vars
sol = solve(prob, IDA(), initializealg = ShampineCollocationInit())
Available initialization algorithms:
DefaultInit()
- Intelligently chooses initialization based on problem type (new default)BrownFullBasicInit()
- Brown's algorithm for index-1 DAEs (requires differential_vars)ShampineCollocationInit()
- Shampine's collocation method (works without differential_vars)CheckInit()
- Only validates initial conditions without modification
Why this change was made:
- Safety: Silent automatic initialization could produce incorrect results
- Clarity: Users now explicitly choose their initialization strategy
- Debugging: Clearer error messages when initial conditions are inconsistent
- Performance: Avoid unnecessary initialization computations when not needed
ModelingToolkit Initialization Support
CVODE and ARKODE now support the initializealg
parameter for parameter initialization compatibility with ModelingToolkit. This enables proper handling of problems with initialization requirements.
# Now supported for ODE problems with initialization needs
sol = solve(prob, CVODE_BDF()) # , initializealg = SciMLBase.OverrideInit()) done by default
Features
- Added support for DiffEqBase initialization algorithms across all Sundials solvers
- Improved callback handling to use callback-specific initialization algorithms
- Enhanced error messages for DAE initialization failures
Dependency Updates
- Sundials_jll: Updated from v5.x to v7.4.1 (major version bump)
- Minimum DiffEqBase version: 6.190.2
- Added NonlinearSolveBase dependency for improved nonlinear solving
- Added LinearSolve dependency for initialization support
- Updated minimum SciMLBase version to 2.119.0
Merged pull requests:
- Apply JuliaFormatter to fix formatting CI (#470) (@ChrisRackauckas)
- Add spell checking configuration (#474) (@ChrisRackauckas)
- Fix spelling errors across codebase (#475) (@ChrisRackauckas)
- Add downgrade CI workflow (#476) (@ChrisRackauckas)
- Fix ModelingToolkit deprecation warnings in tests (#478) (@ChrisRackauckas)
- Apply JuliaFormatter to fix code formatting (#479) (@ChrisRackauckas)
- Update DataStructures.jl compatibility to v0.19 (#480) (@ChrisRackauckas)
- Update Sundials.jl for SUNDIALS 7.4 compatibility (#482) (@ChrisRackauckas-Claude)
- Add ExplicitImports.jl and Aqua.jl quality tests (#483) (@ChrisRackauckas)
- Bump actions/checkout from 4 to 5 (#484) (@dependabot[bot])
- Revert "Bump actions/checkout from 4 to 5" (#485) (@ChrisRackauckas)
- Fix ARKODE mass matrix test comparison (#487) (@ChrisRackauckas-Claude)
- Fix SUNDIALS v7.4 Krylov solver segfaults on macOS (#488) (@ChrisRackauckas)
- Update Tests.yml for different OS (#489) (@ChrisRackauckas)
- Fix SUNSparseMatrix constructor segfault by adding missing SUNContext parameter (#491) (@ChrisRackauckas-Claude)
- Refactor GitHub Actions workflow for tests (#493) (@ViralBShah)
- Update README badges and version in libsundials_common.jl (#494) (@ViralBShah)
- Fix x86 (32-bit) compatibility issues with Int64 conversions (#495) (@ChrisRackauckas-Claude)
- Update SUNContext functions to use libsundials_core (#498) (@ViralBShah)
- Revert "Fix x86 (32-bit) compatibility issues with Int64 conversions" (#500) (@ViralBShah)
- Try fix formatting and downgrade CI (#501) (@ViralBShah)
- ci(tests): update to use centralized workflow (#502) (@thazhemadam)
- feat: add support for OverrideInit and CheckInit (rebased) (#503) (@ChrisRackauckas-Claude)
- Fix deprecation warnings in testsuite (issue #499) (#504) (@ChrisRackauckas-Claude)
- Change default initialization algorithm to intelligent selection (#505) (@ChrisRackauckas-Claude)
- Add NEWS.md documenting v5.0.0 breaking changes (#506) (@ChrisRackauckas-Claude)
Closed issues:
- Kinsol is unstable for multiple variable problems (#220)
- Error with optional flag set on IDA. (#241)
- Structs for the method choices (#242)
- Refactoring (#250)
- Failed ODE does not return the expected retcode (#283)
- Unify Sundials initialization options with the rest of DiffEq (#285)
- LabelledArrays Error (#296)
- CVODE_BDF: Event points are not stored (#309)
- Question about the Cvode(cvode_mem, tout, y0, &t, CV_NORMAL) command (#354)
- Memory leak in threaded calls to CVODE (#388)
- kinsol interface for GMRES missing (#405)
- Update to Sundials 6.5 (#413)
- Sundials not hooked up with MTK custom initialization (#469)
- Test failures on windows (#496)
- Fix CI issues (#497)
- Deprecations in the testsuite (#499)
v4.28.0
Sundials v4.28.0
v4.27.0
Sundials v4.27.0
Merged pull requests:
- Only reexport SciMLBase (#466) (@ChrisRackauckas)
Closed issues:
- LoadError: InitError: could not load library "/cache/julia-buildkite-plugin/depots/5b300254-1738-4989-ae0a-f4d2d937f953/artifacts/cb7fc2801ca0133a5bdea4bc4585d07c08284cfa/lib/libsundials_sunlinsolklu.so" (#465)
v4.26.1
Sundials v4.26.1
Merged pull requests:
- ci: test with
1
,lts
andpre
versions of julia (#462) (@thazhemadam) - Support the expanded change_t_via_interpolation! interface (#463) (@BenChung)
v4.26.0
Sundials v4.26.0
Merged pull requests:
- fix saveat includes save_start for ARKODE (#461) (@oscardssmith)
Closed issues:
- saveat includes save_start and save_end for ARKODE() but not for others (#460)
v4.25.0
Sundials v4.25.0
Merged pull requests:
- Test master (#455) (@ChrisRackauckas)
- Bump julia-actions/setup-julia from 1 to 2 (#456) (@dependabot[bot])
- ci: standardise workflows using SciML's reusable workflows (#457) (@thazhemadam)
- add tstops API (#459) (@isaacsas)
Closed issues:
- Sundials.jl errored during testing. (#450)
v4.24.0
Sundials v4.24.0
Merged pull requests:
- Bump codecov/codecov-action from 3 to 4 (#447) (@dependabot[bot])
- Fix IDA for callbacks that change
p
(#448) (@oscardssmith) - fix test passing integer to differential_vars (#453) (@oxinabox)
Closed issues:
v4.23.2
Sundials v4.23.2
Merged pull requests:
- Fix handling of small timesteps (#423) (@sjdaines)
- Bump actions/cache from 3 to 4 (#443) (@dependabot[bot])
- fix depwarns (#444) (@ChrisRackauckas)
- use
vcat
rather thanappend!
to combined_discontinuities
andtstops
(#445) (@oscardssmith) - Memory-safety and allocations fixes for Handle{T} (#446) (@sjdaines)
Closed issues:
v4.23.1
Sundials v4.23.1
Merged pull requests: