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). The project is tracked in NREL's software records under SWR-24-137 and has a DOI available for citing the work. 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.},
  year = {2024},
  doi = {placeholder... waiting for DOI},
  url = {https://github.com/NREL/scikit-sundae},
}

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.0rc2.tar.gz (35.0 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.13 Windows x86-64

scikit_sundae-1.0.0rc2-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.0rc2-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.0rc2-cp313-cp313-macosx_11_0_arm64.whl (487.4 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc2-cp312-cp312-win_amd64.whl (523.2 kB view details)

Uploaded CPython 3.12 Windows x86-64

scikit_sundae-1.0.0rc2-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.0rc2-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.0rc2-cp312-cp312-macosx_11_0_arm64.whl (492.0 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc2-cp311-cp311-win_amd64.whl (534.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

scikit_sundae-1.0.0rc2-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.0rc2-cp311-cp311-macosx_11_0_x86_64.whl (564.2 kB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

scikit_sundae-1.0.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (625.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc2-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.0rc2-cp310-cp310-macosx_11_0_arm64.whl (497.4 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

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

File metadata

  • Download URL: scikit_sundae-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 35.0 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.0rc2.tar.gz
Algorithm Hash digest
SHA256 644c5518203bc935c0ce242db004747caed53fe80ba6dd5ca2c550cfb2a82978
MD5 5a8092252bb94d6aee19d63036e883b6
BLAKE2b-256 22c33915f63f5c681dac059aa0f840af862b6507449f9e02cf4f85ba63fdc1b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 04c31d46d7b7eee712b93d0c09cadb04347ed6ad6b8d0e315229b3f21609de4e
MD5 3345c7c4328e3a175a1b1744a5531753
BLAKE2b-256 e453b0a1c07953eaf5df1c1c8812332d05402c297adffa9ad3c9bb92f3076005

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3ab34acef71d4f9ceffa2049b880f8e81b2cbfac4fca404bcbb9891a2e3c2d1
MD5 199cb8c8f2502d78b37218958696269b
BLAKE2b-256 82efa1637bb8f7bdf7f5138f1b7210397fbc597e553d6f9c89a510f4236d7113

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 7d3594d6eae2270b84e820bac3efe1e10fdef64137f644772b7732bc2eaed946
MD5 2756034aea4abe427f4597a62d114088
BLAKE2b-256 850e21fa77a7cba4d195658c3088d70cc56359f123745f8c837cff40d393d3d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d533920822cf9d57b423a4d168ca443e0d9f0331112efd8b047da9bf827d1f7
MD5 ffc6f1e34410e7477209066977234c57
BLAKE2b-256 152c85ba4993d933be29a08416e5916e503f1f863dcc14498cd50b62321a8ff4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0f99011d199ff1b889b31273dcb0c22cf5521a6635b67acbf547bfa9a5324283
MD5 77c6d25ff360ca72cb458b7d3566db3a
BLAKE2b-256 bfb6fc53ef10f1d3c5291b98947363aea928b2b5277f4d1f51dbe3f9b5e70c20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 832a4793dcc274b918615b4553b4ee3de3b34add54b1e026ce04da6c15f8b5cf
MD5 9264a1794f0df33c61d045ed844304e8
BLAKE2b-256 4b25aa26fc83fb8363a4959fe60b01655620b61d67f93ea57803c5e9da7e43bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f5ad8aa0650d6594ba202e500d2745ea7e036b14859fc42b3edd7973d1924567
MD5 c5d1761d1f94f68314cb47309c57d831
BLAKE2b-256 70d09a0cb1fec5517a2cb00f046be9d20aea1e6eb1839a3a775ff70d7579a2a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd54bc6af4e7337d7a563279ccae957ed5d216a7b3eb330f77378820cd9b49e5
MD5 ab5d3961f8a128d117b33ab63193abb7
BLAKE2b-256 914dcf46e675df0bdf8b0de26691de97184b94fe00a4f870a9293831aefe7023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cf42cb3fd08a306fb9a2a5302c0d402e15cc925caedd71777ee6c27f48554a33
MD5 ba8def45904bbbc6060fa450dfa7b906
BLAKE2b-256 84ae35fb81df9decc29401e0f08f074887a3c7e1a4ca5233634027b2890dc3dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1a0c35d7a16575c5c0d1dd8f6ecd22358c38389d311c36ed11696ba92679fcc
MD5 cc808f26b51e6948a84bc59bd138b60c
BLAKE2b-256 5f90d1ca2625e0f4354ecad4dad34acd2ce1bd55c12fa7b9f0265030a4038f28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ec7be549b744bd0d5ac6f5426f83012e1f2d6ce307fa66b8122c025ea3389ce6
MD5 734c74f3150e5edcbee2a0425f4b9ae1
BLAKE2b-256 cb3c52efa908edc2c3b51bdb92de12897f69c8900be4ea06429af0ff2d850256

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02815ca10e35929a3c9abc03c44fe9136e867d076f91143804586e97b9332d18
MD5 96b8f4f526eb705c90d5fd33dcecaf5d
BLAKE2b-256 c9b032b8549135ea917380ecc46478643d2928a6984d5eb34e545828d9462668

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b040a7f7cd13bd21cadbe9de27906d5ef5f94eb717161ec398ca1415b633dc2e
MD5 27c54096a5d8efc0552833bc5b8bedb4
BLAKE2b-256 5b95b0ed93de1d80eea5e9f04d01f4be9f53c17c75d39746ff84995947e15593

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 91fb9ef2ba3b90497f53c3077c0edc4a9a23f0c0f5b4612710a6f502cfbed040
MD5 2fc65e8713f5e9071fcc95663abf03ad
BLAKE2b-256 a4ea3b267203025604ce4aff320a69b954c609d6acac1f93e7e8fac6c9be1550

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 bf26b1baf8f7ff8025db0fb7ff0f8c19bf4d738b310eebddc39f704853f327d6
MD5 b6cf5d5a14aeae13977dd4494e5c04b5
BLAKE2b-256 a1012aeb7d79376de5c361146984baf0262f7e5cd4d421f770350ad3ccbac04e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 631abe0cb3620034c98f118679d13572eff205242241ec7615c021a3b8db3909
MD5 6067439d37930f719b504b50a39d9ce1
BLAKE2b-256 a349981d06536256550fa883a97e6470c6bd826430f8389474ec8fdf1f7d032a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0d92ea8afae995941681dc923fe33a60d1423f61ae43d2ce2e2397bafd93c3bb
MD5 ae6166970d723ca1ade70786f8d181c9
BLAKE2b-256 d76aac502732071df5c088a5ce0ea5da552aa7519d803dc8e0dff54664ef9ed8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db97bf39468bce63a6b8ea6ea618f5bba43c962a0a12a11450abb0ffb5817b7d
MD5 e14a9013956dfc57776bbec0c92a683f
BLAKE2b-256 a3ee98686589a56326d22b0f75b21f4edc06e1944a8cb7c2400a21771c52fb18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 da4a1c9c167adb94d9223a2ada1b4e904c918f053e2e080d7c3941779cd1902d
MD5 495da50995964bee8339ed61e452ee66
BLAKE2b-256 6b1085be2fc119f0d801980da34fe69ba52aa1b1fedb3e536fc7d4c0b8ff6281

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23c6ab311177847aca8e8cd96c6e171b2d2efa292dc505900de711b1913149ee
MD5 adaea0b942218890f23fe4fb05e30c78
BLAKE2b-256 717f9e390a566cb0c3966b7f66ffe629b22320f2c2a1089974b71edeebbabbf4

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