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.0rc1.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.0rc1-cp314-cp314-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

File metadata

  • Download URL: scikit_sundae-1.1.0rc1.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.0rc1.tar.gz
Algorithm Hash digest
SHA256 6f189b8567962ae84e37b6e533bfccf24999c53cdaeeb8feb374d2f9f80d4b81
MD5 e4930416f9edff666f943f6b19c912e4
BLAKE2b-256 0c098ce6f22bb4989de78ff85ad04250d118037e53b71411241e55f364d90074

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f41733ab312aaf1165d9f7a23aa72183ca242233524ef8d12f896febffc5d72a
MD5 778c646e5c6b9cf9e02db05de3facc13
BLAKE2b-256 6353c4833f23198abd55046140020b3bb8387b0055f8c77a53e1e6806635949c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 cd61ae484d213563c15bab8a30f67ffb71ba088688c2ffa03d948a31e24a3297
MD5 408e09e6691ae3c9f989a36f8098cfcc
BLAKE2b-256 4e105eb12fa92ae6bc5c426ba510beb9452d34ea7fd70cc64f2d0c1381f6e5ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 884135e6bf28d39cd7bab64b8984273385768cc6e9990667e88b4374d823595a
MD5 ec76e39f330063eca1fe2e4d341a4b42
BLAKE2b-256 ac373668685f9b9adf19b04130ca4e4b112d44dc9435db23bef0da21d75335b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7e0734a25274658111eb79e9f82a2ba69ea7689def490013603024b35a18cec3
MD5 962940a8f07aaa18ce9a685e36f83dc1
BLAKE2b-256 7f405ab7e045d5435035e48de0d732c5f9dc40b8a4dc2735a5901c5ff8e74cb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3fb3809ce04f00ed841ab503062ff4fa235566f3d732e612c8f5bfe869566572
MD5 f68641087e716499afecf949ec92c10f
BLAKE2b-256 9a45263380c7a1b0dea5f8a1acaa832e534dc81a4542692c61afe19c7a84d9d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 18ee524084f444c9c04002ade28f9c8886ba79c6522cf56e4515bbe1c2dfb88b
MD5 c24721afa2b60832a4c9a16115dc8af1
BLAKE2b-256 d6d13b79372ad7c8aa5867943853cdb53bb074d8088054eb983d785626f2cc95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e07de413531108e320ffeed517d31a4b67d864c5cb632b50ed848d328451ddde
MD5 ca3910a8a7cf91d38cc19cf9e0618888
BLAKE2b-256 5ec75e55e1a5596f63a054b23b1f5f5037196e9ad87ac74e32c8118c70c1204c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fce25ffbc1b5e65cbcaadb74cf30500e92184622446a5994444d30e498a3ec3c
MD5 535e496967d309ec172ddb7e50ac1fa4
BLAKE2b-256 ac1ea3a92d2f2343f32285f649a36b24204881e61a092f106a382d0aa53e4908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a6404c66d536ec68651ec7770567e4baee03e8ca87ced124024eaeee676446c2
MD5 bdac0dd4033eaef09b646705c3f798a5
BLAKE2b-256 bbac643b6e7b9bcd39b0e3f854118e15b9f408e8aede0f3272906697d48272b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 66d660ce4afd6111c765457a235dca4e9bc913d0d833d33173ce7e7fdeb8c136
MD5 0d4ec78dcf53b062660cf842d7676699
BLAKE2b-256 755d7bc62ef350054f6febe3970eaf41eadb16af776ab0808100fc80b09fd2f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 19f3505a95e9a8fbd882b6de9baae12a777bbc842105626c518a0c38da0a5336
MD5 7bf38ddbd215116cbe7afcaff46fb766
BLAKE2b-256 2b85c934252ef4d350283167c6404a92ff3955963c0bc29819b30ec32eeffaed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a61e7fc112c697bc1d9d377f062a7287d8c02a3ca9a2dade421ca5c3785db8d
MD5 0104e660774e53dd3cf536f98c69b556
BLAKE2b-256 eb6ba990e9fe5f0418be2cf3006abab3716f4c2bdc889df478460ae5a9ef2a6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e56032facfc24f09f59df402a6183d04d93100f43b18784dbfe2b42e057c8652
MD5 86ba19de34cc535165b3a5804c6a7984
BLAKE2b-256 c30cc2fb2e155aefa82a37d208896677b7637909beaf83f4a0fbd484abbfa7c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4822082d3ef5ee32daa8c86214e6c98ccafcf6449e7e9c37f658544c15c62281
MD5 5a498a8a9d643a2912aec569a5bebab3
BLAKE2b-256 43393fb41fc85b1b38dabee61eddef6a2011af2ccf5090ef6aafa4b8ab4a5bc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 35b965070f049f84b9ae11ade0ce02ccdfd9b9a404e512a3692f91a2f9d95720
MD5 7678e4266f7f5a0f8790b8745ef08fd8
BLAKE2b-256 bf8f1793d3a7d79a5b9530a62cb1ba11f3ccabb56e68b735f61646993f7b781f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a14d455e8672c4ce435d74b6b8a9489265913de471d3567a1cc89d27c8560986
MD5 d6dee26d51735ae45f2409cfe60a0306
BLAKE2b-256 dc8e45ac8333b97ab3708dd73a8503b775d7d2dc13c71eec4ab65d9e8d60e052

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9f0525b64f4164784d1179c3957d034a26878fa6292f453731e5f996e9e557cb
MD5 0f2462a46f873ea19f37a1994b828eda
BLAKE2b-256 9cb50a3cd5cf240839a6faaf0fb8d53549aa5fafc1d8e030b3cf394f71a2b9e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c97063b49f7d52d0bc721ccaeb628438251b0b7ab326271b8e378ecdd109238c
MD5 38a3a7aca288d89e6a8a0fe053e13f8e
BLAKE2b-256 db57d9508f36484227045c618c90bde50d6bb52bcfdd3cb7339d5abb96ea8dcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 2b39b2181278294d521f13d45922531ea31092c1b14b6835dca467550c043040
MD5 b40a0824f3028979e94a5174cade7a3b
BLAKE2b-256 59b02045707c3e187e9fbb24552bf2de55eac49b5905a4d6f6f9c60ad1777ca1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f0be768eca92d62ea7248be4976677b68c6d7365f07831d70a9a99a6fd5cdd71
MD5 f9431415cfcb7adcde8849149a2dfbb5
BLAKE2b-256 51a0e8f0e4f2e0ca2a95e328c6a222d62c085ef69925b9465e5ccabdb163ad83

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