Skip to main content

Python bindings to SUNDIALS differential aglebraic 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 Renewable Energy Laboratory (NREL). 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/NREL/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/NREL/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 Renewable Energy Laboratory (NREL), operated by Alliance for Sustainable Energy, 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.0.tar.gz (55.6 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.0-cp314-cp314-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.14Windows x86-64

scikit_sundae-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (19.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

scikit_sundae-1.1.0-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.0-cp314-cp314-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

scikit_sundae-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (19.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

scikit_sundae-1.1.0-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.0-cp313-cp313-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

scikit_sundae-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (19.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

scikit_sundae-1.1.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

scikit_sundae-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (19.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

scikit_sundae-1.1.0-cp311-cp311-macosx_11_0_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

scikit_sundae-1.1.0-cp311-cp311-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

scikit_sundae-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (18.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

scikit_sundae-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl (15.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

scikit_sundae-1.1.0-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.0.tar.gz.

File metadata

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

File hashes

Hashes for scikit_sundae-1.1.0.tar.gz
Algorithm Hash digest
SHA256 43bf8c4b6d23c95808922da01d38f620f39ed6fc175c10707eec63dc2cf17986
MD5 e73fd8a1ff928d897aa6141fd708fec2
BLAKE2b-256 513d25a52c322b0628ab4ef93333aef9b7a6a3287bb3fd8c8ce983cc78b0b58e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e18bf4e0a02d0f57684401c5ebd7016c057a019d75153d5c46d1e816ddd15176
MD5 8a3c1cec5a9a68e6025ed314c7585805
BLAKE2b-256 8a2420b5ee0dcbd6427aaa6369ca0b3373a8821713fd96fa87ad62a83a015202

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0660c76f58c6cda782ba979d9c441c07d91bbef9bfcb6e177fdb00d3bc27e30b
MD5 ef9b99ada1138a8944b93a04772f1bbd
BLAKE2b-256 1bb69f9303623b5d6ef67013c5ea1350f0f9bd9249347be3273a00d80b5f4452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 2e7a0b080e629015f3f7fa45881cabacb8af387956fb34d34c99964bb4deae42
MD5 4b833379f719acd59cbca29a6976b69a
BLAKE2b-256 16e7adcc46311613dca7982948cb8505f1cb4635173a24a7438c8558d3616973

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07b3c953a8953f45e533f7baa75a124f4c9572cb65d47166a5318490fb4b207d
MD5 d4499e4a57843bebf3a32ce382e673a3
BLAKE2b-256 6d6951cdf01568f4253058f7f741dcce2e47610600d502d71ca8f4285230667c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d54de8730f9f0147b4de7884d88ceb9b37ae6615ee0438eb9fa8a76d6043fb0d
MD5 b44a9f99f4929b645118f25626430819
BLAKE2b-256 29d02cba58634ff7a27d39692b99c2babad9e406a8252189df67a0ac964c968d

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 cdfc05754d33d4495433b1cfd6d46171978c23d4a5d0c1ff8d302b4c95696e57
MD5 9e9ee53c8b4bc765c24c7d4099357dc6
BLAKE2b-256 7610c40f58cecc9b42b6e4428f806b0f7659ae63ec5ee13f1332237f31714900

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5789e7c462ef4af0826b027d4c1a319ee505d56da9716f95541a2ab7168b18ad
MD5 f932893eddc28073cf6929333d9e3b3f
BLAKE2b-256 94bd11322fd8cc5c3a80dddeb31f0e383eb9dcc024cfbe7fae0d78a8a3efa17d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 30f8c261c38fced01e6ff7bcbe659076c0aeeedf6c969f4b00c761714aa91d0d
MD5 86d930211ba6c421b4886c1e0063a979
BLAKE2b-256 02f374025fdc2d491aba04fee7cb80dfb2770c02a1cc64af501d20d05e8d0dea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 600e4c5e13be85dd23f737a1d07b42ec93442311aec60ca45cbf85a86e04efae
MD5 bb606a20fdebfe4dff06821e2cd74f03
BLAKE2b-256 b5eab59271817c2d0ce5b76ab94e2238d825084223af506d612bfc7529f2e0a9

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fe23096d0fe07bb8d6d9b53c084f61b95a8cb1b6773dd62a3cacbc173b648e3c
MD5 5397077a16843accb8705f3f9109352c
BLAKE2b-256 e22a85c42333f3bdd27225894aff0d2f2c24141c774833e7fe8ed173a9980269

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c19e605f79ed437e56eee2905dcc7518944006a3ec43dec525bebc56cb810f72
MD5 111600192a3c0689ec2afcd3ca79e939
BLAKE2b-256 de959b994527cd28863be6e504a6c25ad225247f43871425b3411182250915bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94b69710830b0d40a7df30d32d63cc28788351959caed754dcbdb2caf05d5ee5
MD5 2eca21cd7d52679fe81e85c323b2490c
BLAKE2b-256 78a09fb04f1f01007949dda48167f5f9d3d869be96eac2bb07ee30fb53773e8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3ebbfe9899e9be8c951b3f42bba7ae7200813590ea3280819b1019f054dff2ce
MD5 a9d7ba018f4fc0feb8600a03344471a9
BLAKE2b-256 d95b806eb96a21c8fcb5140208780a495c1223036916e2c517c5ef129737f8aa

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 84b65342d2eeb5b91cc0e986ec9e06007002f938329a30b131f58ffce57afa60
MD5 74f5180fd8069a56120ae891a078f723
BLAKE2b-256 2458e6138763d2569df7bb511bf1b815915290c3e9a334558e7efbc127afa2c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 acc67ff17f647564fb458d43f14790165f159ccae7d09c091ff6da80986677fa
MD5 9f55b0c7223642ab9a21c38f79da3e90
BLAKE2b-256 7fb7945b1e23a5aecd9411fd65c4961626440e3f7d1545543db512f42daf1524

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2851d96e7f43d518c334c9a4bef6254a99c2516297ff546f2f0d4740602f17e5
MD5 db3059639e5de13547c16fcd579d5cb6
BLAKE2b-256 254cad0c75ce51c158a6bfb0d28e3477e59a839b9182947af0caf49d2c756638

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3db49ad69c205796dc2b9144f47b82390a56f39505e32e4f55a1738e854483ae
MD5 4227ff8c25d0f4217ea682793e86f93b
BLAKE2b-256 597029d93cb0e2dc66a69dacd3606ae87f42ed6850de7a84b872bb401f157ed0

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f52e5f3ff5890f9427d5060e445eb20152dc7618891ecc9a9ec1dea88b6874a6
MD5 4be6a3a313aaca12829ea3dd50034ab1
BLAKE2b-256 be025c24b41468fba016f4ec82647aefe7b01395cb41c7748f90de7dffcf53a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9f1d4934074c28252efe1cb8c3723d86372983862b64a3b1c1d1b55ab6125a15
MD5 ff8387486c62ccc9e94c6dd33f82174b
BLAKE2b-256 55b2e5c8abd7e4ce113fd8bf5439ae3fbcb9328d14140c55101c09553e5f16cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 376cab48ce02d99531f3738b77e4531fc30dd05da864d757cb28957c0b305427
MD5 5c67d5410fa704a135235f0ac1ef093c
BLAKE2b-256 ae2ec64306319d7af259280c5bf193d737e4ee6bbea875d8f2d4799b78d97cb0

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