Skip to main content

SUNDIALS bindings to differential aglebraic equation solvers.

Project description

Logo

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, checkout 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])

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 project is tracked in NREL's software records under SWR-24-137. If you use use this package in your work, please include the following citation:

Placeholder... waiting for DOI.

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

@misc{Randall2024,
  title = {{scikit-SUNDAE: Python bindings to SUNDIALS DAE solvers}},
  author = {Randall, Corey R.},
  doi = {placeholder... waiting for DOI},
  year = {2024}
}

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 iterative solvers and some optional solvers (e.g., LAPACK). The package only provides source distributions, so users must configure and compile SUNDAILS on their own.
  2. Scikit-SUNDAE: includes more flexible events function capabilities (e.g., direction detection and terminal flags), scipy-like output, and provides both binary and source distributions. Iterative and optional solvers are not available.

Our binary distributions include pre-compiled dynamic SUNDIALS libraries. These are self-contained and will not affect other, existing installations you may already have. To be in compliance with SUNDIALS distribution requirements, all scikit-SUNDAE distributions include a copy of the SUNDIALS license.

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.0.0rc1.tar.gz (34.9 kB view details)

Uploaded Source

Built Distributions

scikit_sundae-1.0.0rc1-cp313-cp313-win_amd64.whl (521.5 kB view details)

Uploaded CPython 3.13 Windows x86-64

scikit_sundae-1.0.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (621.0 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc1-cp313-cp313-macosx_11_0_x86_64.whl (555.5 kB view details)

Uploaded CPython 3.13 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl (487.3 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc1-cp312-cp312-win_amd64.whl (523.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

scikit_sundae-1.0.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (626.3 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc1-cp312-cp312-macosx_11_0_x86_64.whl (559.6 kB view details)

Uploaded CPython 3.12 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl (492.0 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc1-cp311-cp311-win_amd64.whl (534.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

scikit_sundae-1.0.0rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (625.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc1-cp311-cp311-macosx_11_0_x86_64.whl (564.1 kB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl (496.9 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc1-cp310-cp310-win_amd64.whl (535.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

scikit_sundae-1.0.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (625.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc1-cp310-cp310-macosx_11_0_x86_64.whl (564.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl (497.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc1-cp39-cp39-win_amd64.whl (536.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

scikit_sundae-1.0.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (626.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc1-cp39-cp39-macosx_11_0_x86_64.whl (564.3 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc1-cp39-cp39-macosx_11_0_arm64.whl (497.4 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

Details for the file scikit_sundae-1.0.0rc1.tar.gz.

File metadata

  • Download URL: scikit_sundae-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for scikit_sundae-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 2c28880290c8e609ec26826466cef97ab3cc3b6a93e54f89cd3ad3100a5da01b
MD5 8d1ef2b558d7a9b0c5d848e65478fa6e
BLAKE2b-256 5c16d19ab624a08073283fd35b86100508a3965fd42987dce67c18ba0b68354b

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 65affbe74b607cc3fa5165036f73c247a146daa386b43a8c63de5ae619ca1677
MD5 efc37982f2e34e2c047b190a9d8651a4
BLAKE2b-256 5464926149c02c204ed2a8d26da8ef7a30dc2c2abb0100562dd8777cf8d97c4f

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d06eae19a9f8749a9a4f0bee45cd158e6e33b06b124a53b301e9b83bd7bdecc
MD5 9d1973abe56ef3f98a5a513a5b629dac
BLAKE2b-256 53e62d812da8cf1b151763f0117a3ee0094b5b001faa7c3cb44eda3c1e7a35e2

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 6923bc33bdb29475a727749d42948d4464e69e38efbc2ce694dec0869b9dd330
MD5 571be3da94fb8383c9ffec108143349a
BLAKE2b-256 758e9633084dcf7d6902c9ac1cf4b04afba8bf9e80c79c5e412fe8580363a82c

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d72f88a5842c725b7f92b82e387091343c88be1c3f9c57925c7acaacd1f8d868
MD5 33c3b682f9b03beb4cdfcb01fda85668
BLAKE2b-256 d3b211e24de4f687f426c27041bb61c0f21c775115e333cf4bbaefee710e8c7d

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 135439671f5bb8db04ba78c664e181b07ddda223e1b3d111117dd765ff1dcf8a
MD5 0882384e57fb743940d21fa117f06feb
BLAKE2b-256 eff274cd4365de460c4f2ac5a60a2195b4581a9c708c6f2450ef19d7a39e2b71

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61c74d57ec74dcc93ab33d5180e48ae42551ea1c1062f3258ead3dbb95e363cb
MD5 dffe5c516a9b131b4baf95bd08ee3004
BLAKE2b-256 fcbab20f2129e82be25d46f8a2d4f70a15ca0bb73444a6c9653f700652cd0ff8

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 80d09566b6c2923b54db0fe14a3dfa0f3e30ebee22af8617fd3bbca889389682
MD5 5768ca47f3f64f46ca7f8b453f978ea9
BLAKE2b-256 9c8aa4f4e9205ad2545a3f44000ee35ebb23ddf9a218d65777e44b8bec978bfb

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1208e2e7dcc469bbfd81efb59259b0ebfb772e1f12c12dd88104c41453ce9ea1
MD5 1b27f4d5ed4c5f1ea0d147a3bbf4960a
BLAKE2b-256 264552f70497b2fdf26bc5758e2966f9689fe92f1e7d72941af86f215b8dba0c

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 353efe6ea18f40a17773656e56aca6fc172ca5b2b712ae3923a01d6204fffa7c
MD5 9978b219a6afd4ea90d1df2bc08c733c
BLAKE2b-256 c917b8a2c914323152b0187972d20339b70cae2cf3cba806b09a3c4622156512

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a4cd93585b8c272d11750db69659d65630d7cefbfb194cc48a312e2e664ccce
MD5 dde0a85464f99abd602fd3b61f14b7cb
BLAKE2b-256 80e212ed8b2b7bec71979a6acb62ea92597dc0eb4776acbfd7d79bb07446060c

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8f2bdd33303d2dc6bc48bffc260aea1306003e04e00f650674f0dbf295adb2b4
MD5 b25ae579f3790c4f9f762ca916ae51ef
BLAKE2b-256 620abfb40839455d07384c9ffbc439c7e3bb3b9a104bf1b483110e98c479dead

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 586016c40a2715244bff09e1f4d3bf2fbb503d72e2ea8057a9ba5145a23a3c53
MD5 144c301c6541e5c79e00cd008612bcad
BLAKE2b-256 c4be182af2f8cd95f6e2396a2933525f88651a518d98d95abc53bcdf7e436dd6

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9826ba8bc74c1df06bf45e58f63f4084f7d59f9134a7fafa1e557745351b5b5c
MD5 40bb92e036bc42056903ff8f40064733
BLAKE2b-256 575ad5860f2cde6dddedec2d623e9832aa6415c78a8cf2a1002ae2c82408c779

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d94bfe1b48c1c3d9f8d2417c809771bd634b695aca59a6a8d7d41fb037610d7b
MD5 22cc2795b8cc55422b82671d76f78c8f
BLAKE2b-256 47b7b9a6998e19db753fa134c50d48cbcd3c95c65740d8fe1f0d006c11a73e89

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 6126628a4068cd011330db2ba1075b8169ba2f2279b8404f40935b1a0c102a76
MD5 91e7d59a68eb4a01fd3c5e0fb66c52c9
BLAKE2b-256 c64b6e78c32e17231b30bcefb93d2cfba3ffa421b976b8ce89fe26e15588eb66

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3388e8058150b3f1cd50ebdf65bae5f7f4094876432f4edbbffcf2f5b54b9d0c
MD5 5662f27ca076660c2da493c8c7346cd1
BLAKE2b-256 46886845bb596074faa9df7a1ee33e6c8f946d1333366a2b004b46083f056e6d

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 23d3c98bd0affbea9c389093946c90fcc560742e48accb7758d102141b9f65ef
MD5 dbc3af5a076ea519a7fdde9d3e4f246c
BLAKE2b-256 9f757f63aca6ad5ba8cc9a46945aa9d413203d88b6eaa85ea115dd0a9ccf0a6b

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 902781cc1526602d9ab40fa320a51d00a3f8628ee059b9ad4a3420b39c5e9f12
MD5 81633791dbebbd978f699b0ef8f7697a
BLAKE2b-256 51f3b48fe952d11b7f970380fdb3ae41ca6c35ef44ae5b364cdc60aad23ae5c3

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9aac8f258cf23df4681ae3caf01e0abb79ac633c82848c59522377ee17760937
MD5 975462fea364c51926ea084a41546f9c
BLAKE2b-256 d36a7a8f1ae3c07b1a868b7c87869068a459cae8bedb6fdea8c5af0dbc391067

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.0rc1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 66b86125853c09edb20ec434eec0bc0111fc7ed3beba8230fbeccb48d4a2a965
MD5 f23021fe654cd71bc361e92e2a5ea180
BLAKE2b-256 9d60ef4ca8861741c14326b39602d04bc540d51894be8de1c64440e2bc9224d0

See more details on using hashes here.

Supported by

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