Skip to main content

Python bindings to SUNDIALS differential algebraic equation solvers.

Project description

scikit-SUNDAE

CI   tests   coverage   pep8

Summary

scikit-SUNDAE provides Python bindings to SUNDIALS integrators. The implicit differential algebraic (IDA) solver and C-based variable-coefficient ordinary differential equations (CVODE) solver are both included.

The name SUNDAE combines (SUN)DIALS and DAE, which stands for differential algebraic equations. Solvers specific to DAE problems are not frequently available in Python. An ordinary differential equation (ODE) solver is also included for completeness. ODEs can be categorized as a subset of DAEs (i.e., DAEs with no algebraic constraints).

Installation

scikit-SUNDAE is installable via either pip or conda. To install from PyPI use the following command.

pip install scikit-sundae

If you prefer using the conda package manager, you can install scikit-SUNDAE from the conda-forge channel using the command below.

conda install -c conda-forge scikit-sundae

Both sources contain binary installations. If your combination of operating system and CPU architecture is not supported, please submit an issue to let us know. If you'd prefer to build from source, please see the documentation.

Get Started

You are now ready to start solving. Run one of the following examples to check your installation. Afterward, check out the documentation for a full list of options (including event functions), detailed examples, and more.

# Use the CVODE integrator to solve the Van der Pol equation

from sksundae.cvode import CVODE
import matplotlib.pyplot as plt

def rhsfn(t, y, yp):
    yp[0] = y[1]
    yp[1] = 1000*(1 - y[0]**2)*y[1] - y[0]

solver = CVODE(rhsfn)
soln = solver.solve([0, 3000], [2, 0])

plt.plot(soln.t, soln.y[:, 0])
plt.show()

The CVODE solver demonstrated above is only capable of solving pure ODEs. The constant parameters and time span used above match an example given by MATLAB for easy comparison. If you are trying to solve a DAE, you will want to use the IDA solver instead. A minimal DAE example is given below for the Robertson problem. As with the CVODE example, the parameters below are chosen to match an online MATLAB example for easy comparison.

# Use the IDA integrator to solve the Robertson problem

from sksundae.ida import IDA
import matplotlib.pyplot as plt

def resfn(t, y, yp, res):
    res[0] = yp[0] + 0.04*y[0] - 1e4*y[1]*y[2]
    res[1] = yp[1] - 0.04*y[0] + 1e4*y[1]*y[2] + 3e7*y[1]**2
    res[2] = y[0] + y[1] + y[2] - 1

solver = IDA(resfn, algebraic_idx=[2], calc_initcond='yp0')
soln = solver.solve([4e-6, 4e6], [1, 0, 0], [0, 0, 0])

soln.y[:, 1] *= 1e4  # scale y1 so it is visible in the figure

plt.plot(soln.t, soln.y)
plt.legend(['y0', 'y1', 'y2'])
plt.show()

Notes:

  • If you are new to Python, check out Spyder IDE. Spyder is a powerful interactive development environment (IDE) that can make programming in Python more approachable to new users.
  • Check the solve_ivp documentation from scipy or the scipy-dae package repository if you are looking for common examples to test out and compare against. Translating an example from another package can help you learn how to use scikit-SUNDAE before trying to solve more challenging problems.

Citing this Work

This work was authored by researchers at the National Laboratory of the Rockies (NLR). If you use use this package in your work, please include the following citation:

Randall, Corey R. "scikit-SUNDAE: Python bindings to SUNDIALS Differential Algebraic Equation solvers [SWR-24-137]." Computer software, Oct. 2024. url: https://github.com/NatLabRockies/scikit-sundae. doi: https://doi.org/10.11578/dc.20241104.3.

For convenience, we also provide the following for your BibTex:

@misc{Randall-2024,
  title = {{scikit-SUNDAE: Python bindings to SUNDIALS Differential Algebraic Equation solvers [SWR-24-137]}},
  author = {Randall, Corey R.},
  doi = {10.11578/dc.20241104.3},
  url = {https://github.com/NatLabRockies/scikit-sundae},
  month = {Oct.},
  year = {2024},
}

You should also cite SUNDIALS following their recommendations here. Lastly, if you use the sparse linear solver, please cite the SuperLU_MT library using their reference guide.

Acknowledgements

scikit-SUNDAE was originally inspired by scikits-odes which also offers Python bindings to SUNDIALS. The API for scikit-SUNDAE was mostly adopted from scikits-odes; however, all of our source code is original. If you are comparing the two:

  1. scikits-odes: includes solvers from daepack, scipy, and SUNDIALS. The package only provides source distributions, so users must configure and compile SUNDIALS on their own; however, this gives users maximum flexibility to compile against SUNDIALS builds with their choice of precision, optional solvers, etc.
  2. scikit-SUNDAE: only includes SUNDIALS solvers. Provides sparse solvers, more flexible events function capabilities (e.g., direction detection and terminal flags), and scipy-like output not available in scikits-odes. Both binary and source distributions are available; however, we prioritize compatibility with SUNDIALS releases on conda-forge over general user-compiled builds.

Our binary distributions include pre-compiled dynamic SUNDIALS libraries that also reference libraries like SuperLU_MT, OpenBLAS, and LAPACK. These are self-contained and will not affect other, existing installations you may already have. To be in compliance with each library's distribution requirements, all scikit-SUNDAE distributions include a summary of all licenses (see the LICENSES_bundled file). Note that we only link against and distribute packages with a BSD-3 license. Some solvers and options, like KLU, have LGPL licenses and are therefore not compatible to implement nor distribute.

Contributing

If you'd like to contribute to this package, please look through the existing issues. If the bug you've caught or the feature you'd like to add isn't already reported, please submit a new issue. You should also read through the developer guidelines if you plan to work on the issue yourself.

Disclaimer

This work was authored by the National Laboratory of the Rockies (NLR), operated by Alliance for Energy Innovation, LLC, for the U.S. Department of Energy (DOE). The views expressed in the repository do not necessarily represent the views of the DOE or the U.S. Government.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit_sundae-1.1.2.tar.gz (58.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

scikit_sundae-1.1.2-cp314-cp314-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.14Windows x86-64

scikit_sundae-1.1.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scikit_sundae-1.1.2-cp314-cp314-macosx_11_0_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ x86-64

scikit_sundae-1.1.2-cp314-cp314-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

scikit_sundae-1.1.2-cp313-cp313-win_amd64.whl (8.3 MB view details)

Uploaded CPython 3.13Windows x86-64

scikit_sundae-1.1.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scikit_sundae-1.1.2-cp313-cp313-macosx_11_0_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

scikit_sundae-1.1.2-cp313-cp313-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

scikit_sundae-1.1.2-cp312-cp312-win_amd64.whl (8.3 MB view details)

Uploaded CPython 3.12Windows x86-64

scikit_sundae-1.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scikit_sundae-1.1.2-cp312-cp312-macosx_11_0_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

scikit_sundae-1.1.2-cp312-cp312-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

scikit_sundae-1.1.2-cp311-cp311-win_amd64.whl (8.3 MB view details)

Uploaded CPython 3.11Windows x86-64

scikit_sundae-1.1.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scikit_sundae-1.1.2-cp311-cp311-macosx_11_0_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

scikit_sundae-1.1.2-cp311-cp311-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

scikit_sundae-1.1.2-cp310-cp310-win_amd64.whl (8.3 MB view details)

Uploaded CPython 3.10Windows x86-64

scikit_sundae-1.1.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scikit_sundae-1.1.2-cp310-cp310-macosx_11_0_x86_64.whl (15.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

scikit_sundae-1.1.2-cp310-cp310-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file scikit_sundae-1.1.2.tar.gz.

File metadata

  • Download URL: scikit_sundae-1.1.2.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for scikit_sundae-1.1.2.tar.gz
Algorithm Hash digest
SHA256 1ab42c7bacdc9f2641773c3e750eecfa55a7c48e314dceac975c1e66f2051e3c
MD5 b23ed3b98667efaed8c26e079adee03e
BLAKE2b-256 4081e9fff21a99d50f5f53504f8d833da7abb793f4e0f57e266e4d728edff471

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 b3ce36723e8ae63f24360a87bd44178418982103a7fd0377d90d6839c19614c2
MD5 deb721e6ceab5de330cd93a347f1a7ff
BLAKE2b-256 eb10a1d2c8ee33d4421f754fa4dec9709b24c9a329a2e049e785b8266ef03a62

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce204b15babc4bab5ce1f656e95c58e5025064018dc4f3560cf8bbc55e353c15
MD5 7217cf13ce63109150d150d2825e8a34
BLAKE2b-256 ab2dcf6d5e915d8e1f23c18a47e543668cc6f1f4be7fef81d40821be6e8200ee

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp314-cp314-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ccdd9878eeb86a14b148ae4240fad895c5635cef1dd72472e5a33ba34a7dca90
MD5 396b130fc6081ada661e7562c0c93e4d
BLAKE2b-256 bde7a48c90b80058da877bd0a10192c1d0410bea912210ebd608ed0e5ab57eda

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aba6b3f8be7f48421f255557178548638f794e76106e36b14fd5b60a35ad24cd
MD5 8bfe1401cf9d0665810fd242839663b4
BLAKE2b-256 ea1f247c99d0d9e556fd68c53127301928291d4b1d393682de67bbf9b4be3ecd

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f16bdcb7406c81515d8a3159273a947b13d4343a674818aa2522a845632e20f3
MD5 56ae69741c91bc531df8ecf4007a33d0
BLAKE2b-256 595fa9a05df6d1aaf851cb16faebfd4443bcb0143983d795b676244328fb9d33

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 324535a8a780a494d3bec81614b7e5fc34d5d1feb53ef5530779601ed8a91053
MD5 25e9c2ba2bb1970257b3a4d05ae22a6a
BLAKE2b-256 fc8c167a87965059d72ebd7423ea58332bf5ae996d47362e1e5d84ccb5fee7cc

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 020f8c133d6f304370604926f0e58dc11ad90c7db68f06cfb60b58a7ed269a1d
MD5 cc8a90bb58820c92009df2db7d487e68
BLAKE2b-256 a230cc0dfac417110996125dcc212a05bc542eaead2a1755f95ad983457ec586

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f565da070030ae52fbfec2b1c9bf06c13766ca1700b130dc97a23fefc7c95a8
MD5 bb08ffc41b6533085cb863b68cca273e
BLAKE2b-256 0cbe4553c2bad5405552a6636064cea834a703422531c5328995b17acc740dd5

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 07f77ad3027938739f541eed40b3535c25ad4fc05ba8d4d31f90a80ee30b81f1
MD5 9e6ba815aee8f979b585df99e5c0c085
BLAKE2b-256 99df83e6d564859316f611c9c8da6e6cb49b1652504e418ce4d48d88307ed3f2

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 be21d7cc2f73248c54c4b79d58ae3f26fa49215e703ff6aaee1d5b99fe465f9a
MD5 5d689881eb6a76ef42d160a7bc1ad494
BLAKE2b-256 10ec9000e2f75312382eaff2723457961340c3ffbda549b3cf7da0c74e0566d9

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 995c88cd30f55f9913a2051c9d1accde630f833b03b346020d023ba6cfd998dc
MD5 d8854d945e56e99001a483e814792c3c
BLAKE2b-256 d6e2dd8d14a8ec9411a99fd9d634fa0ed0b146bebe4a68f7677e8b0f980271fc

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5251363a1e7ccec1ab2cda4a35e7d2781581afb8c2cda17b7f2d7f290cd42280
MD5 62be78d0c03c779a0315efc0f9479e41
BLAKE2b-256 8611cc5e24f0fd88f0137bf729a7981dcda9423d3e6bebbda8c1513fb3f440b8

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8da73c4d3c8a356a96134a61f103f0b8720535cccb691b573e31acbc44bf2188
MD5 07212cdb406151966732e75a05b7c219
BLAKE2b-256 857ef04c65c2061bafaaa091eda9b56e0248400e02c61c4408ab74daa1e8acc0

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64a375ca8eca365f00fdc488c9ba7f4e735d88153d4ce05aa9372b45bef2f9f3
MD5 49172fe4b108d92abc9d134c5975ea96
BLAKE2b-256 8b733e3131fdc8e75e5ee0bbe73f9db460c79b202fba900d9c09497400c9890f

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 87cac679ff2fe96fc641036a1bfe9e4643b667f69335ffdda59104f20af10705
MD5 6c7f554ea5dcaa08d5720ff081687159
BLAKE2b-256 f2dcac1fe37155f5e57f860431ab1ff798fd3033010e5d284675f0a54bb28702

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67c0083a7660c8f0dcbfabc27e518173fb2eaa1b073d9c20bfa41f0e7fdf1e37
MD5 8cd1fd2d7af13ea031d9f3c70143a163
BLAKE2b-256 025961a5e5c37d7f60875b8d6001df7fc71e619ebdb3aeeea43e1f232a845ad5

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 02e5eb863aa404a3e119b07347007a1e4d6a3700ad402b5211c1e0c6b725b3aa
MD5 64ff4f1dc035da04defd54a2f384f405
BLAKE2b-256 e6bed781eed4abf280a018f551649d0a2be96057b4013b2775a696f15cea3b5c

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 237f39c13a29e908745326ad48c9a021ca606a07464d4b4aa0d49628ec182cbb
MD5 c01b4cc3499d72f6e68e4b9fae71a673
BLAKE2b-256 d395dc7bc69458b3f558a4d4d372ced8b13d8d317f6d6f81e516c208dbaa4850

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 229343db1fe9a94ea20b13ae629fc70ab201b84708746bbd7285c7ed129f80e4
MD5 d6a1b994424021a4cb3e20cadc1a84bf
BLAKE2b-256 25683cdb36807933116df565b8d722ccc8ed53aef6b1f29b48bd893af80e54f8

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd97ca63ed69003ad840c6f2d43070ae2445eb2e74214e13cc706f6f609831f2
MD5 2a800d36f161c9c52575ef93bc5dd770
BLAKE2b-256 dac9cd840967a91d652939e980bacd99ec1392d645a824307752e63e6866cd37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page