All Projects → SciML → Sundials.jl

SciML / Sundials.jl

Licence: BSD-2-Clause license
Julia interface to Sundials, including a nonlinear solver (KINSOL), ODE's (CVODE and ARKODE), and DAE's (IDA) in a SciML scientific machine learning enabled manner

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Sundials.jl

diffeqr
Solving differential equations in R using DifferentialEquations.jl and the SciML Scientific Machine Learning ecosystem
Stars: ✭ 118 (-29.34%)
Mutual labels:  ode, differential-equations, ordinary-differential-equations, dae, differential-algebraic-equations, scientific-machine-learning, sciml
Differentialequations.jl
Multi-language suite for high-performance solvers of differential equations and scientific machine learning (SciML) components
Stars: ✭ 2,023 (+1111.38%)
Mutual labels:  ode, differential-equations, differentialequations, dae, differential-algebraic-equations, scientific-machine-learning, sciml
DiffEqParamEstim.jl
Easy scientific machine learning (SciML) parameter estimation with pre-built loss functions
Stars: ✭ 36 (-78.44%)
Mutual labels:  ode, differential-equations, ordinary-differential-equations, differentialequations, dae, differential-algebraic-equations
DiffEqPhysics.jl
A library for building differential equations arising from physical problems for physics-informed and scientific machine learning (SciML)
Stars: ✭ 46 (-72.46%)
Mutual labels:  ode, differential-equations, ordinary-differential-equations, differentialequations, scientific-machine-learning, sciml
SciMLBenchmarks.jl
Benchmarks for scientific machine learning (SciML) software and differential equation solvers
Stars: ✭ 195 (+16.77%)
Mutual labels:  ode, differential-equations, differentialequations, dae, scientific-machine-learning, sciml
DiffEqSensitivity.jl
A component of the DiffEq ecosystem for enabling sensitivity analysis for scientific machine learning (SciML). Optimize-then-discretize, discretize-then-optimize, and more for ODEs, SDEs, DDEs, DAEs, etc.
Stars: ✭ 186 (+11.38%)
Mutual labels:  ode, differentialequations, dae, sensitivity-analysis, scientific-machine-learning, sciml
MultiScaleArrays.jl
A framework for developing multi-scale arrays for use in scientific machine learning (SciML) simulations
Stars: ✭ 63 (-62.28%)
Mutual labels:  ode, differential-equations, differentialequations, dae, scientific-machine-learning, sciml
DiffEqGPU.jl
GPU-acceleration routines for DifferentialEquations.jl and the broader SciML scientific machine learning ecosystem
Stars: ✭ 131 (-21.56%)
Mutual labels:  ode, differential-equations, differentialequations, dae, scientific-machine-learning, sciml
GlobalSensitivity.jl
Robust, Fast, and Parallel Global Sensitivity Analysis (GSA) in Julia
Stars: ✭ 30 (-82.04%)
Mutual labels:  ode, differential-equations, ordinary-differential-equations, sensitivity-analysis, scientific-machine-learning, sciml
DiffEqDevTools.jl
Benchmarking, testing, and development tools for differential equations and scientific machine learning (SciML)
Stars: ✭ 37 (-77.84%)
Mutual labels:  ode, differential-equations, dae, scientific-machine-learning, sciml
sciml.ai
The SciML Scientific Machine Learning Software Organization Website
Stars: ✭ 38 (-77.25%)
Mutual labels:  ode, differential-equations, dae, scientific-machine-learning, sciml
DiffEqUncertainty.jl
Fast uncertainty quantification for scientific machine learning (SciML) and differential equations
Stars: ✭ 61 (-63.47%)
Mutual labels:  ode, differential-equations, differentialequations, scientific-machine-learning, sciml
AMICI
Advanced Multilanguage Interface to CVODES and IDAS
Stars: ✭ 80 (-52.1%)
Mutual labels:  ode, differentialequations, cvode, sensitivity-analysis, idas
DiffEqCallbacks.jl
A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers
Stars: ✭ 43 (-74.25%)
Mutual labels:  ode, differential-equations, dae, scientific-machine-learning, sciml
BoundaryValueDiffEq.jl
Boundary value problem (BVP) solvers for scientific machine learning (SciML)
Stars: ✭ 23 (-86.23%)
Mutual labels:  differential-equations, differentialequations, scientific-machine-learning, sciml
CellMLToolkit.jl
CellMLToolkit.jl is a Julia library that connects CellML models to the Scientific Julia ecosystem.
Stars: ✭ 50 (-70.06%)
Mutual labels:  ode, differential-equations, scientific-machine-learning, sciml
owl ode
Owl's Differential Equation Solvers
Stars: ✭ 24 (-85.63%)
Mutual labels:  ode, differential-equations, sundials
dae-cpp
A simple but powerful C++ DAE (Differential Algebraic Equation) solver
Stars: ✭ 33 (-80.24%)
Mutual labels:  ode, differential-equations, dae
RootedTrees.jl
A collection of functionality around rooted trees to generate order conditions for Runge-Kutta methods in Julia for differential equations and scientific machine learning (SciML)
Stars: ✭ 24 (-85.63%)
Mutual labels:  differential-equations, scientific-machine-learning, sciml
SciPyDiffEq.jl
Wrappers for the SciPy differential equation solvers for the SciML Scientific Machine Learning organization
Stars: ✭ 19 (-88.62%)
Mutual labels:  differential-equations, scientific-machine-learning, sciml

Sundials.jl

Join the chat at https://gitter.im/JuliaDiffEq/Lobby Build Status Coveralls

Introduction

Sundials.jl is a Julia package that interfaces to the Sundials library (see source). Sundials (the C library and this package) provides the following:

  • CVODES - for integration and sensitivity analysis of ODEs. CVODES treats stiff and nonstiff ODE systems of the form y' = f(t,y,p), y(t0) = y0(p), where p is a set of parameters.
  • ARKStep - for integration of non-stiff, stiff, and mixed mode ODEs via split, linearly-implicit form, implicit, and IMEX Runge-Kutta methods on ODEs of the form My' = f_E(t,y,p) + f_i(t,y,p), y(t0) = y0(p) for a set of parameters p.
  • ERKStep - for integration of non-stiff, stiff, and mixed mode ODEs via split, linearly-implicit form, implicit, and IMEX Runge-Kutta methods on ODEs of the form y' = f(t,y,p), y(t0) = y0(p) for a set of parameters p.
  • IDAS - for integration and sensitivity analysis of DAEs. IDAS treats DAE systems of the form F(t,y,y',p) = 0, y(t0) = y0(p), y'(t0) = y0'(p)
  • KINSOL - for solution of nonlinear algebraic systems. KINSOL treats nonlinear systems of the form F(u) = 0

Note that CVODES and IDAS contain all functions provided by CVODE and IDA (for integration without sensitivity analysis). If you need to use the latter, you can set enable_sensitivities=false in deps/build.jl and (re)build the package.

Installation

Within Julia, use the package manager:

Pkg.add("Sundials")

This should download and install the Sundials libraries and register the package. On Windows precompiled binaries are used, while on Unix and OSX Sundials is built from its sources (provided the necessary tools are available). If you have Sundials already installed, make sure that Julia can find it, e.g., via

push!(Base.DL_LOAD_PATH, "/opt/local/lib")

before you install the package. Downloading and/or re-building of the library can be triggered by Pkg.build("Sundials") if anything goes wrong.

To test the installation use

Pkg.test("Sundials")

which currently runs some of the examples in the examples directory.

Common Interface API

This package is part of the JuliaDiffEq common interface. This is documented in the DifferentialEquations.jl documentation. Thus the ODE tutorial applies. For example, the Lorenz attractor can be solved with CVODE_Adams as follows:

using Sundials
function lorenz(du,u,p,t)
 du[1] = 10.0(u[2]-u[1])
 du[2] = u[1]*(28.0-u[3]) - u[2]
 du[3] = u[1]*u[2] - (8/3)*u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)
prob = ODEProblem(lorenz,u0,tspan)
sol = solve(prob,CVODE_Adams())
using Plots; plot(sol,vars=(1,2,3))

Sundials.jl exports the CVODE_BDF, CVODE_Adams, and ARKODE methods for ODEs which are documented in the ODE Solvers page, and IDA which is documented in the DAE solvers page. Additionally, the ARKODE method can be used on SplitODEProblems to solve ODEs in IMEX form.

KINSOL High Level API

Along with the ODE solvers, Sundials contains the KINSOL nonlinear solver. It's called via:

kinsol(f, y0::Vector{Float64};
                userdata::Any = nothing,
                linear_solver=:Dense, jac_upper=0, jac_lower=0)

where f(res,y) is an in-place function that computes the residual f(y)-res=0, and KINSOL attempts to find y such that res=0. This method is generally quite fast and the choice linear_solver=:Band is well-suited for problems with a banded Jacobian (you must specify the upper and lower band sizes). However, this is not as robust as many other techniques like trust-region methods, and thus we recommend NLsolve.jl for more general nonlinear solving.

Direct API

This package closely follows the Sundials C API. At a slightly higher level, many (but not all) Sundials.jl functions support passing Julia objects (like Arrays) instead of Sundials objects (like N_Vectors). The Julia package Clang.jl was used to wrap Sundials. This directly uses Sundials' headers sort-of like SWIG. Thus the general C documentation is the documentation for the direct API. See the test directory for usage examples of the direct interface.

For the wrapping code, see src/wrap_sundials.jl. Because of Clang.jl, Sundials.jl provides almost full coverage of the Sundials library (the serial version). A few things to note:

  • Macros like DENSE_ELEM are not available.
  • Nothing is exported from the module. You need to put Sundials. in front of everything.
  • The parallel versions of Sundials which require different N_Vector types have not been wrapped.

Citing

If you use this library, please cite both Sundials and the JuliaDiffEq project.

@article{rackauckas2017differentialequations,
  title={Differentialequations. jl--a performant and feature-rich ecosystem for solving differential equations in julia},
  author={Rackauckas, Christopher and Nie, Qing},
  journal={Journal of Open Research Software},
  volume={5},
  number={1},
  year={2017},
  publisher={Ubiquity Press}
}

@article{gardner2022sundials,
  title={Enabling new flexibility in the {SUNDIALS} suite of nonlinear and differential/algebraic equation solvers},
  author={Gardner, David J and Reynolds, Daniel R and Woodward, Carol S and Balos, Cody J},
  journal={ACM Transactions on Mathematical Software (TOMS)},
  publisher={ACM},
  year={2022},
  doi={10.1145/3539801}
}

@article{hindmarsh2005sundials,
  title={{SUNDIALS}: Suite of nonlinear and differential/algebraic equation solvers},
  author={Hindmarsh, Alan C and Brown, Peter N and Grant, Keith E and Lee, Steven L and Serban, Radu and Shumaker, Dan E and Woodward, Carol S},
  journal={ACM Transactions on Mathematical Software (TOMS)},
  volume={31},
  number={3},
  pages={363--396},
  year={2005},
  publisher={ACM}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].