Skip to main content

Python bindings to SUNDIALS differential algebraic equation solvers.

Project description

scikit-SUNDAE

ci   coverage   license   downloads   pypi

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.3.tar.gz (58.5 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.3-cp314-cp314-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.14Windows x86-64

scikit_sundae-1.1.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (20.3 MB view details)

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

scikit_sundae-1.1.3-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.3-cp314-cp314-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

scikit_sundae-1.1.3-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.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

scikit_sundae-1.1.3-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.3-cp312-cp312-macosx_11_0_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

scikit_sundae-1.1.3-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.3-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.3-cp311-cp311-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

scikit_sundae-1.1.3-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.3-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.3-cp310-cp310-macosx_11_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: scikit_sundae-1.1.3.tar.gz
  • Upload date:
  • Size: 58.5 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.3.tar.gz
Algorithm Hash digest
SHA256 e3d06de0da6715d51310b2cea3835c495e6613d8c19ccbbf1f278aabe7e8f3d6
MD5 2ee92d8b2dd0710fdd275efda69c6929
BLAKE2b-256 a22f669f410f7a151874af1d6ff91e3d129bf80f989e92da3fb8c77f8496f718

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 593da130d42b2ba1bee3c6fa3e37e1a4155a504ec5c99a5474ff58b94da656ba
MD5 41923f825d03f65d9ee8cb2609130c91
BLAKE2b-256 f3eb1b24c70ea32ff049c359c71d1f8a355730ca7831ff9e2b87595b6b616094

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.3-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.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bfc172566739c920b6e6916a0695b05dfe4c44d90d815ea40ef6d0581cde3353
MD5 8f09e42b38a9e86e5d44f96716fb23a6
BLAKE2b-256 745a53fc641fa15062136032ffc54f55a9ba6c0a089dabf8bd0b2edce70809c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 56ee83ec591e65424d19e4327f8d31bb667753a94b06ef92c56c956829586624
MD5 477cc9c01d625e43b6c0bd6cc1ca81cb
BLAKE2b-256 07784eaa9e9f37bc939df98ae096201a173329705135d55815b6861d62f4f9d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 502acb40d777f2b50758c754da93d8aa74663bffda63746285ef5dd7cb8e2046
MD5 8dfd446336ac97244212497598fb4c7c
BLAKE2b-256 d74b54493af986ddfdb5c6fcdec49935f2dfcbe5bafd791a410dcc48da4e952f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 440ebf7a3aa1ac1253321dab6a14a29e39b773bd553738cf3789f17a7332012d
MD5 ac9bfb91450f1555d4b13b17ee86a3ef
BLAKE2b-256 1a704f02ce2414fc02838d80b6633325995cfa574b1042f6030a0c3bd0881ce9

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.3-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.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ccce108a19cbbabf180ce4320625b805970d6ed2a115d453cdb2c9e29a961e53
MD5 c96e31e4d9edf7bde49b697361845816
BLAKE2b-256 bf3539ed62e4a7ee41d2a636ecdae837f3011ed977b16931649249df5ed4a333

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4d6d818326d4bff617c21c5c95f18a40fd87b6adff92bc5b19fe05af7de67255
MD5 1499df695f885c9c0fa635be3b4208ae
BLAKE2b-256 eb228d9ee43481d70d49a2d05945ba17a60a1bbef05caeeb2af62f20615ebf48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6fa436b394fd59ee5dfc02a25ec695943768a1d35af55c424132121d4f0bc15
MD5 f4db317f3dc66079ede406f149b35111
BLAKE2b-256 b6921b82abb0eb8c6250cfda905463a6673e6a5fffd38051109b406a4b6c1b63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0414c7d47ff664347406071c1a29cc3ab6575a688d2540e8ca45118b1be329c5
MD5 2b3f4bcd68fd3871464e109c668b6786
BLAKE2b-256 de2f6d36fa7f3d7e8c9b22885fcfe0fe22de468b2e1443d26d9c886b3bf963dc

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.3-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.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 462d0b3004da4c5d7ef016de18219bfd9afd2d7ee0977a50b95087b9c0b404dc
MD5 3c1a4152e8aef95b479c2aa279663d68
BLAKE2b-256 8e9837c54707421b4dc933c6a4fe8410adaa5f642df1415ae9cee6390d6e9226

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 719de2b52268a984f8b88831fe9a47071c669d2b64e1665c4e7ecc0bc1922834
MD5 b1244e0bdc1e06499061ad8bf5743561
BLAKE2b-256 a4a2aa1aafe8e42321bd92b8ada758cb52ceb5d56d51d7943dd1c2860d0fe268

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5867435d8be40b1c24442106b4823bb024905f409c149b439c52e9b657db2177
MD5 40e33b8cbae2aa48af69ca15b43e878a
BLAKE2b-256 e55a36404ebd7d6dee732c7c221607bf47c7a1a07243b1f086fb401101ac5e9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 81749f31abe7fc4119f2dec2a3d19c5edda698622c4e610ab07ac13d374f9b21
MD5 1205ded9bc0789238b44dd3070a7206b
BLAKE2b-256 793df98772b54c196b4b24b7bbd74f9a6beb6970e70acdeb10570c033ed64794

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.3-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.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dd7644f2a7ac0b23f717de358ee5af1df936ec3a9cd7a89e76cd56efe79b730e
MD5 47effe0c6e6951ca4492510f17994580
BLAKE2b-256 83ed65215555674cc7b0a0f8c4ba4695f3399af2ec22e9933bf848f8c8d49c8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 27d560372f9fe8e9ccefc2b435ae06e398f8991779d6035f72bd74f742b0003e
MD5 50f0f07d1bbe0fabae13027778819b57
BLAKE2b-256 c10a4aae2d59a284081bbbd4260790c2f53d8afa46355046c2e6f6c87536bc53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d9f5d3453b46441d9ba3e4b489886d6d93a07d94e87179d22f5f72de19b509d
MD5 63e6c1ce7188be9a2978d7976d8c98ec
BLAKE2b-256 a519a92959704f5a17d53cb2733b10b152f7f984464c7f238c9a8e8268de998c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7d7fc6d79d2f9906407de7c5927c326f08aba0c305cad111aa7de2449d9963ea
MD5 18cb9a23b0bb952a87f733637d5166ef
BLAKE2b-256 eb32379acca4a3ff074235bd758f7481500278802b80a4447ba01bfa51842f64

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.3-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.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9997d6250c395eefab3eed8b345f506b3877756ba022dbdf30857c3c1efb700d
MD5 98dd48083727b913d8c6377d68f0a631
BLAKE2b-256 154a9df504992d20a50d1c2830bde530ea1b63a96d8da2561d5b74cae032c785

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 91c7df6e15506ce85175488cf6fdfaa1d73603d61e0b370446295fd8ba0ff5c3
MD5 238885e03b49b5e3b61f9a80e6a0a703
BLAKE2b-256 96dd93a92e4c97aab5da1969f7df94152ab86a4cc43b01e476573778d16fcba7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2952e40684526347cc12b0e88425e0f9a84a27bbbe90892af5092a889470d3d8
MD5 8cb1029d85b1ec4366d2ef76271d966e
BLAKE2b-256 56187f5ced940afa04ee4ebe11321f7a69ba233a5bbc350d059020b9d83c13ae

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