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.1.tar.gz (35.9 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.1-cp313-cp313-win_amd64.whl (526.3 kB view details)

Uploaded CPython 3.13Windows x86-64

scikit_sundae-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (628.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.1-cp313-cp313-macosx_11_0_x86_64.whl (560.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

scikit_sundae-1.0.1-cp313-cp313-macosx_11_0_arm64.whl (491.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

scikit_sundae-1.0.1-cp312-cp312-win_amd64.whl (527.8 kB view details)

Uploaded CPython 3.12Windows x86-64

scikit_sundae-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (633.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.1-cp312-cp312-macosx_11_0_x86_64.whl (564.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

scikit_sundae-1.0.1-cp312-cp312-macosx_11_0_arm64.whl (496.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

scikit_sundae-1.0.1-cp311-cp311-win_amd64.whl (539.1 kB view details)

Uploaded CPython 3.11Windows x86-64

scikit_sundae-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (635.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.1-cp311-cp311-macosx_11_0_x86_64.whl (568.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

scikit_sundae-1.0.1-cp311-cp311-macosx_11_0_arm64.whl (500.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

scikit_sundae-1.0.1-cp310-cp310-win_amd64.whl (539.5 kB view details)

Uploaded CPython 3.10Windows x86-64

scikit_sundae-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (635.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.1-cp310-cp310-macosx_11_0_x86_64.whl (569.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

scikit_sundae-1.0.1-cp310-cp310-macosx_11_0_arm64.whl (501.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

scikit_sundae-1.0.1-cp39-cp39-win_amd64.whl (540.8 kB view details)

Uploaded CPython 3.9Windows x86-64

scikit_sundae-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (635.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.1-cp39-cp39-macosx_11_0_x86_64.whl (569.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

scikit_sundae-1.0.1-cp39-cp39-macosx_11_0_arm64.whl (501.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: scikit_sundae-1.0.1.tar.gz
  • Upload date:
  • Size: 35.9 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.1.tar.gz
Algorithm Hash digest
SHA256 8e9e209d0811e4fdc9b8e0a28e10fc6b8d2a1c3ed3e660024c1026fde8e50e7c
MD5 90001cff240f96a134244dc67736dbc9
BLAKE2b-256 93566e742f1c460b29d4c70a9409ff8a9ecc145f7d6159aa3241607bb54794ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2b7e82e566572482a9026f02eee29789a4fcfda62bc41d2f2232fa8c9a16ec8b
MD5 5eac74b1416a81e76307ac198d1b8236
BLAKE2b-256 de76d872cf7cbf10c90e78a3a3bedfb3eec7886385a45f59db737a1226a1eb62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d570ccb8bf4de93137a6cf37456a660c81afe48d4d067445b858446c03fe96f6
MD5 97ce74807d23cbf53eaa536d0a24180b
BLAKE2b-256 a550b06e31c34e57dc6bc77d322739fd703e6a602150d142ea6681b7eb13f011

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 38f453d2421345958b521607ed62b6aca6c3e72ed43271d880335d6acab2593b
MD5 6dbc2432dd23220c73f5084497566486
BLAKE2b-256 36a9d4acc5e0d94b9c46281f7bdc77d44ad6fa22789c8e0c8d14ef945b83cc33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bda5ae85b694a4747a3861688927f4c6aa2588d628cd0ef8fa454c00ff5fdbf1
MD5 1979cdcc238a77b4ce3294c5cc47349d
BLAKE2b-256 655d118df3cd65b73643b78eee259d986448b06040c142a0fc19080dd82c775d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4598721d53492d04119cc8d0e40eaf1f0db2929a7fa3121dc3f362d71c314874
MD5 d169c48bf0b9e26229acf6b4ce6b0b6c
BLAKE2b-256 63d877d364ae74117c5fdaf2680567b33c3043e5520b35987fd8280738ecabea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e5abce855155f5dd1204554a3c9ab5cf3229d08c564efc753b569230e84a135
MD5 0d38514c7e51afa4c08c42092f3304e2
BLAKE2b-256 0f95a74f0b0e936501b3a3053cdf9c20f7795a6cb9b8253f435317868491aba7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 00f9937ac10d1ac2ae3b5cfac27ced5cc70a16114302a90d7e6b90b27d3f3a4f
MD5 3b6ad53f647a66693d86c8a32b831f8c
BLAKE2b-256 5491e54fde5b5c6b32c160570128aab9b6d08fc0091464260c61da8876542baa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efb2c960e8df54825c973037bfae5ebdcea8fd4c635c35621a5b099515b0f8ec
MD5 6f5e704ac24c4ca45b0d0399ed7ded59
BLAKE2b-256 7c2ed718e93eec6bba774e1545e2f9d27f801585df5508854f41cef0f11260b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 12258bd669f41ecbe497fe5b9944306aa9a1c94eef10ecd08d3e6603060547f1
MD5 d7eef7988035a3aba049513c22d3c8af
BLAKE2b-256 84eaadcb6db5b3fb3a77d364553742ddbcfdb077c608ac0c74f2c01ce56e4498

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3eb0c38ca4abf50bd2b20602999b5b055aab1ab3508d29ee49c5a7eca0fc3415
MD5 d75704d37466ac469de2cd63cc517cc2
BLAKE2b-256 30546447a7855f1098f543863cca089afd920ad63d33182eb6a7b043bd0da5a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 35bf42acef43418d52989ec49b316cec64de9c1748179a541e57b9eb7118ca74
MD5 7c75977c6f9c3d8ba1e5b04986c43e40
BLAKE2b-256 26f28e7f7580ae3dbede1346f57d09d81037b377fbd17c98404fc3117848ac25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02d5e6d035724943817917ed74566ae2980aed6fe6560e40d670bbe53aca1e8b
MD5 70e067d08da57d67e37dce3f61d258cc
BLAKE2b-256 7f31122e865b08941fbead88606d72aeb7e491686f519a2a705518fee434b078

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1ab7c8a7d4b5301a76a3c89684d499d5708f9e9f8f134120db6b4400803404b5
MD5 ce93b590c492820850b9884501787073
BLAKE2b-256 7e75df9b85cc2b6ccb6771667611cb047223c8d0d00e3c09a5790ee359f464ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e514d6cd178a97065b6359ca515b036437b74abe71267238c4b19031472fd611
MD5 ec785a2348e282e5abeac0c503634584
BLAKE2b-256 da159a761b332bf151ae61987f4f2fe952d26c9f2814f80450d268e24e1fe291

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 0e38f9b417ab35f7dca5029b8d88418b5554eb32c7e5e5a396c7863bed1db949
MD5 d1aa18867ccb7ca886acfe97845b2915
BLAKE2b-256 1b001c9fc11f481269b699a6dbd01f9ab7355f2273b06f58b7c66a3232784718

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e4e0536ee6e5cd1cdb50c3c3b62dbc1948e0622b2a40647e76cd66941c4ae8e
MD5 ab7d8cb59517db29d2e255b46ede57e9
BLAKE2b-256 b17dd139de8c468a4c945eeb3beb3094f04674026ba150ccfdb5bd241aa8e414

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4744190e7833a8a564f2cf623d38655b00befec2810acb12e8d320057cf0ffdc
MD5 3194970600c5202e5c6e6916351d87a7
BLAKE2b-256 547b141974ff32b8a38148c24b1067e55a8576509519172254932f7b3f105801

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32e47e7bb6dc66153bea6adaf8770ba018a768a17ae46f6d1b1f5945423d24c2
MD5 6c70603b606bb76ceee90e0c9ffd4533
BLAKE2b-256 1dc6c3d949e24d4a6dec76c9f1dc37f887ef3cb9e0bcbadb56e1abeaa98152d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 25ecd3fb82e9a2e912c98edfe786d41e1fb192943bbd9e64d01550b92fcfd5f7
MD5 7d6c2ddc2d9966dab4dcc3088d86cb98
BLAKE2b-256 f6b3cbaa73bfdceb3d33c12374027c25ea8f7d2896b49fc21406bcb8612efe56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f30656230b708a1874681b47b5d514e1e00ee7b67126afa7b87af256b1d63691
MD5 aa08a12b8a16f6ff369996206ca3e64c
BLAKE2b-256 fe9f200cac3839e7fcfa7944e54582c61facb10192d4fbd3bd2637fe7d628b4b

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