Skip to main content

SUNDIALS bindings to 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])

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: A scikit with Python bindings to SUNDIALS Differential Algebraic Equation solvers [SWR-24-137]." Computer software. 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: A scikit with 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},
  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.4.tar.gz (36.1 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.0.4-cp313-cp313-win_amd64.whl (506.6 kB view details)

Uploaded CPython 3.13Windows x86-64

scikit_sundae-1.0.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (605.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.4-cp313-cp313-macosx_11_0_x86_64.whl (537.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

scikit_sundae-1.0.4-cp313-cp313-macosx_11_0_arm64.whl (476.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

scikit_sundae-1.0.4-cp312-cp312-win_amd64.whl (508.4 kB view details)

Uploaded CPython 3.12Windows x86-64

scikit_sundae-1.0.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (600.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.4-cp312-cp312-macosx_11_0_x86_64.whl (537.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

scikit_sundae-1.0.4-cp312-cp312-macosx_11_0_arm64.whl (477.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

scikit_sundae-1.0.4-cp311-cp311-win_amd64.whl (524.6 kB view details)

Uploaded CPython 3.11Windows x86-64

scikit_sundae-1.0.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (607.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.4-cp311-cp311-macosx_11_0_x86_64.whl (544.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

scikit_sundae-1.0.4-cp311-cp311-macosx_11_0_arm64.whl (482.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

scikit_sundae-1.0.4-cp310-cp310-win_amd64.whl (525.6 kB view details)

Uploaded CPython 3.10Windows x86-64

scikit_sundae-1.0.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (609.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.4-cp310-cp310-macosx_11_0_x86_64.whl (546.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

scikit_sundae-1.0.4-cp310-cp310-macosx_11_0_arm64.whl (484.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

scikit_sundae-1.0.4-cp39-cp39-win_amd64.whl (527.4 kB view details)

Uploaded CPython 3.9Windows x86-64

scikit_sundae-1.0.4-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (611.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl (548.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

scikit_sundae-1.0.4-cp39-cp39-macosx_11_0_arm64.whl (485.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for scikit_sundae-1.0.4.tar.gz
Algorithm Hash digest
SHA256 f32d23812bccdff57bb61412f8213d59eb833e15860552e5afa64eee6dc1e5a2
MD5 278998db6b4f8a03bef4b1087912a0da
BLAKE2b-256 a2ce65af63705b8250717f8b979748e5da7d2c81e31f5c8f4d91397c425adf02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 faf5da39fce59f6722d7850a1cdbd4103e87ef63797005c58b04c0f18a12963c
MD5 41c592e06625ec0b35cb6c19fa75cd30
BLAKE2b-256 c3bf96f080318327b1d3c3aba3e488dd260fecaeac4e940abdaa7c8b372b3646

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 544b6acd18015d2c009109bcc7e5aadaa9ddd43822d5e2d9302f48f50cc191a8
MD5 6958023752636ab51ab74a5c6c6753ff
BLAKE2b-256 5c32505253a2ae351923654da149f0fb477b0c8a8c337fb8b91394543f9d499e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 df94a965acc7c3898029077ec251c174f6de07a1d13528887e79b6616f26c30b
MD5 207b752dd87a7422fed20cc8b30f28e8
BLAKE2b-256 c43d82d2d862792c92cb3a20448035b369a56f8482e69a2a30982005c0b96b82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba003d29f536f408dc669f14b3ea63f9679c96ce389e4e2b69aca988178a464c
MD5 002fdc7525c16b7ff173954a6950a311
BLAKE2b-256 7a12a4ed58c3b1b0733366f329b6188e6f5b4d0d8fb3e8d4e1b61157415980b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 686d906c46f25b2f49d4f35662d8bd328772004935a8c409d69fb2af4fe18014
MD5 75a51c2111cfbf852ce8ebdd663b3f49
BLAKE2b-256 f1f8a3623f0cc5a3051ea9b720f05f60b5c62123fd22ba31df0e2212dd4a9cc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 23d2f3bfbd7e654352b38a3c94e138ca9796b49295fc0dd741f7f15b671bbab0
MD5 31bf08efef1d7b3e98cf19f63467a31b
BLAKE2b-256 07f8c02f50816031707420c0ff879ec03c9cf52d6bc95a616203526b15692322

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 59862cf74175b630f4100eaade75d9253e796b7bcc2c9c6893db08ed2da1a064
MD5 3b1e1b3896912d70008988e41ea7d4ed
BLAKE2b-256 0b0707b3dea1f6c79aaba5b4b818a435fb2fc599fd6c1b1bf869551828e5b548

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7bb2e4802db51bc797d4fff47fda192676189a35fd8fa300cdd6cb1bf70c94d6
MD5 2e968eec74eb21d933501ae52f1f530f
BLAKE2b-256 b1258969dee8d7fdef32e35d0462a5db29f7fb6b31699b118f5434b660fc470e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d21a46a65ae97d76b9a7a8b3dc8f07c43d4f38c61cd3e76fb88275bb28401d01
MD5 b4d678441318aace9762050f14a756c7
BLAKE2b-256 eb274855f03892162a07fd20c7716231db6b36f103ef4fd924b5f5f84dba037c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b5c8244cc7065a624c3a361751e1cb86fc599759fd2391491253f6832387793d
MD5 9a333bfb980573e79a6aceed48ee5a5f
BLAKE2b-256 cbda5b6a5d9e59f58c597b3428585433efcb14bf31458be62a45cb9a85295465

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4a0f8699b4cf984374d8eac4e6e91640ab6a8fe6f402494a6bf5679752cd86e0
MD5 566f9e8090bbffaff8734d673f84fdde
BLAKE2b-256 944489ecbdff7c706bbb8fd91ee94e1472a10aaa9651c2a549109e6660553f51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 52ebf7bb159051a46fd92f1d638e83ad874d14f7f25c6fe16d6e0bf53c5add75
MD5 75a4f53fa14d7de26fea8a717e132a5d
BLAKE2b-256 d9e53e7af4f9fab21ddf6d2db04d6d7e9354cf4d972309e06c532f22f545c85d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5aa65475ef72a53855e3668741fa5923e6d2091c14a9fd5a00b713188aee97f8
MD5 33833a17180ad56e408452c8b29ddeb8
BLAKE2b-256 2cd02f0f6f28f7ce638d8ac69f67d475a8173e24dcf8031eeed73aeec230462b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0df6fe921249d046e107072a16836a116a857a3d39682aab825eb9f50a22f3e0
MD5 635233b8a3f3869e2f96a9c04ac10ac3
BLAKE2b-256 6fc5b2934c13013df66b15f04ad8e89847db9e4d52008539a7615cad69392212

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a12e3b4fd762bd6f9760e9f4de0c195d445511c07f63c253e7b642be7010d87d
MD5 6030c1fabfbd211fc56b1bf1354cce3a
BLAKE2b-256 e608a70a4f2a145c54633d2fa2cc09b4f7d62407743a5a86c11c139a622de0de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 51bfe90dba587324e105efbf023ae9bac19696668b50cd96d915b14b1bd80872
MD5 b2641b550f12fe5ac95593cd96bfa338
BLAKE2b-256 d5e91aa71388c24f8368232a7710dc47ab6f6fbcba62f44f5c90c9fd5b0dc5e0

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.4-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 40e79ae2aee72d72ba06616560d7f367f931f06f18c4c79c407e802234d2308b
MD5 69919b4248b984b61b1f4ff0d2e34729
BLAKE2b-256 e72c726103a20fba13c92b4d9fe72a3cda43d83ecd5f03a038e0f66922bd4dc7

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.4-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e19ccfa8186a4904cac6e72d4749b154a447dc5cc8fe5fcfde17f6fa366b4ee3
MD5 3edceb774e7b1433b63c09d7b4a50c87
BLAKE2b-256 f8def380bd9b6f49477ec58fe82941da2c95fde775c5da82650485ee7da91a1b

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 000694c749e762cb1d49a79e5456c5076727d35b33efe2a38d59f6e4d3be84e7
MD5 6d16344023153e25fecba11be1666d14
BLAKE2b-256 05674c61615bbdcff2937903a0e6fff9dae02353068c5672a1a7087bc4745ddc

See more details on using hashes here.

File details

Details for the file scikit_sundae-1.0.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for scikit_sundae-1.0.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2456ee0b71f871154e55e14e82f894d30b88c1ea2dcfc3f9aec35c64211f4eb7
MD5 e0d538d77ce4078981efee6e7ba91199
BLAKE2b-256 bff516233211b1980e8770e5845fe7b5815901167eeb745145db9a07c230575a

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