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.2.tar.gz (36.0 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.2-cp313-cp313-win_amd64.whl (510.1 kB view details)

Uploaded CPython 3.13Windows x86-64

scikit_sundae-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (623.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.2-cp313-cp313-macosx_11_0_x86_64.whl (543.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

scikit_sundae-1.0.2-cp313-cp313-macosx_11_0_arm64.whl (472.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

scikit_sundae-1.0.2-cp312-cp312-win_amd64.whl (510.5 kB view details)

Uploaded CPython 3.12Windows x86-64

scikit_sundae-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (616.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.2-cp312-cp312-macosx_11_0_x86_64.whl (545.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

scikit_sundae-1.0.2-cp312-cp312-macosx_11_0_arm64.whl (475.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

scikit_sundae-1.0.2-cp311-cp311-win_amd64.whl (524.5 kB view details)

Uploaded CPython 3.11Windows x86-64

scikit_sundae-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (625.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.2-cp311-cp311-macosx_11_0_x86_64.whl (553.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

scikit_sundae-1.0.2-cp311-cp311-macosx_11_0_arm64.whl (482.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

scikit_sundae-1.0.2-cp310-cp310-win_amd64.whl (524.4 kB view details)

Uploaded CPython 3.10Windows x86-64

scikit_sundae-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (625.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.2-cp310-cp310-macosx_11_0_x86_64.whl (554.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

scikit_sundae-1.0.2-cp310-cp310-macosx_11_0_arm64.whl (481.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

scikit_sundae-1.0.2-cp39-cp39-win_amd64.whl (526.0 kB view details)

Uploaded CPython 3.9Windows x86-64

scikit_sundae-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (626.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.2-cp39-cp39-macosx_11_0_x86_64.whl (554.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

scikit_sundae-1.0.2-cp39-cp39-macosx_11_0_arm64.whl (482.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: scikit_sundae-1.0.2.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for scikit_sundae-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fa812ab2727f167ce79009208ba38b8803a34b6771a489ae67302d6a9e57987d
MD5 e57bfe3c90b73f30961c6108b2d9772e
BLAKE2b-256 9f682ca54eb6b1ec2dfe24d44c92cccd24d8c66e26e7f65c425b3c9bdd0b00df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6a6d3e0ee92f977d4909f40e396157ccf66bfc83e4aee0650bfeeaf6767a6922
MD5 d85e61c5eec40cc581349961d4b16a34
BLAKE2b-256 b3aa7428cae3f371ffadbd9e4247a2d9bd56f51611eb7ffc742e342a379ddc6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 24597a00e49b956fa12f856e622e64a462c3adef9a93b1a58cbc6a52b7cfa0cb
MD5 e884b7a41af7ce590eeced59df9c1a69
BLAKE2b-256 0719d213c260b271a8c130d8515bb1199e4b70608c112afbe0c73a368d24f92d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 85f0c38ee30ebbcc6cfdf9a6c04f4ea7024103fc08d97ba74ae1c90acf05260b
MD5 bad8ef156bc9054950144068db06357a
BLAKE2b-256 00e4712d1dd5c81a351ad3134cad49e759732f6fc6aad3eb8255d1f2d3ac9d73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 acf4def69e79b678da4dd47111200f2f3f31f664b1b7a28bd9a8af925b1c9ffb
MD5 e8ba0704457260fbca133bffcfcb9135
BLAKE2b-256 5dafe597e328c8cfc97ba4f144bf25819ee011319b917fb03c97ae7bac106a4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b11bf1040a41da52e217bdf2e870869f4e7cbd609505097ce4ef4d487267187f
MD5 9e61f47f99ed000b430dae64c81fced6
BLAKE2b-256 5795ed45b8755f81594906856aeb70f69421cc4dc23445ab31293f634e7a588f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 23247546a4d4d9c720e0860bc19f0a33f100bd6811b97a6b8838061903c677e3
MD5 92b5d5482b126ec2d8e2adebefcb542c
BLAKE2b-256 ead30cf6bb230d6238879044da070f6c2fb3e360ba447bde298e38e53d8f8e02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e90d2e60ed6e6b94d9d8c2a1a993926446857ece11f0ea39de1009b1a44719c9
MD5 fd1a1bd696948b82e397b8e4734ed15b
BLAKE2b-256 26af8eb8ad5df21b74ab254d31661d311d9e50472589b756849f66200c15be43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99b38d9716b899edbe6245ddcb7ae46482f4e14f10d2542a7b749b0164dea7c1
MD5 38b609c670448cf57dc0e9bc814eae10
BLAKE2b-256 e5d0652eff78c2bc214339d2173ca4c5496b993439731b4d01dcae3b2e6020ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 52ae167f863cae85eec5fb9917c2c4025cf5eef46211d21011348ba9989aaa61
MD5 5fc6b462953b2a3e1a0b445cfa621fc1
BLAKE2b-256 31c8f31616e5454c73375cfc1d3b91b9d5091220c0e15b51e2e13868ec16a46a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fa6558bcb126c86171cfc6364c538252e929cdacd8ca0d2bafc00ba73f8a8f6a
MD5 38c84aaa722cca4d86dc977e99f40f37
BLAKE2b-256 7b82b89c8d50d731f8b8eb5d3b48728dd71967d14827d4d02f43647281110fce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1e49dc7d396403b95bf9ba776364500cc241a9406b4c6689d09887c375e886aa
MD5 1214ecf10872452b6d5690c8a9d02610
BLAKE2b-256 cd69b9c609f87aa0e2297e722b223e066991048f016b7f18dfea527a31624fea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82409a8320c5fce316d099937006e14b3b9dd77557ad334860eb20a7ff2b0ea2
MD5 17f50f0c93e76cfa4d2769f4e6a4edc9
BLAKE2b-256 6a9fcc8c091431f27e0fa8bf9b3af59cbb45f004c017d9ed799cf6957da66079

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 66a5b3bb825cd1e84b50b23c2074f95087bbb49a86fa94a168d03d28ff51640b
MD5 16b0a8cc9ec3e3a44f64635da10a6ed9
BLAKE2b-256 cb08d2aa5d74f76539af3d87df9a61f4d99b082ed56ec1eb52ff95793385f902

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 90570b906e86288101fced8b72c01171e62b012111b9bff43b66bf489c0dc3fc
MD5 99831f0064ed149a583aa2e9c58980cf
BLAKE2b-256 7788d525d5ff5ebc396c995a29f1360f859ee4ac98d6a286ea3eb83ecd5474a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1fa1b6364fabbda47343016c7b8131b7eb08952549ffb0aa691117eca2cfd542
MD5 6f62a1170b5cd3d38146edc51fa41329
BLAKE2b-256 a94008437ab29b2d48ee94f918354d91318416d932aa4521f8a65e4bab40050e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f48010d1cb437df106d7bc5a72ef6416a74eb87045d88ae8df798b00c5cc208f
MD5 6366e62d1b28a13a7606ff3d653a4d48
BLAKE2b-256 8cbc0fb358df1c1b7f2323206dba172c47d8313c23f66650e01a53fc1bfab94f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ad58fdcd9c2c7e2a553e1a3728c5babe50109c751ae58c08b3d8e17e6e28a391
MD5 b23e00257f504bc4b0b42e42d66e54b5
BLAKE2b-256 a2567bc8e9714603d22621cd5d0ff1c7dae71033537c16d3a942c3944e16c4e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4e7959e33d7b19bfa2c6fa0dcba5111ab7328b0555fd86322df651cb72f8d262
MD5 a5384263a38590e093dbce38852424a6
BLAKE2b-256 784a5a8475dbf730d1f389ba571e1f5a51a09387380da06f8f4d8f39d3900c41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4d416c154d033f6d51b4179a8b0c47c1a398999c69d35ac996c05a1dc9c6a8a2
MD5 b1fb7234560213f6c0b3a871939123ba
BLAKE2b-256 f06ed43c1412e8a437272cde0fc85ae618301fd639ef5d46f364404174448242

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6e3667f6d58f348a8e830a62bb081d44b3368b8b5e3523ad2335f602656d353
MD5 244defe81d8fd70d898f26c0e9d84afa
BLAKE2b-256 4156a08a03cf5b3e2cfa5e1997894566a31c77ea81cd1ad6dcec28abe56c3fac

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