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

Uploaded Source

Built Distributions

scikit_sundae-1.0.0rc3-cp313-cp313-win_amd64.whl (523.7 kB view details)

Uploaded CPython 3.13 Windows x86-64

scikit_sundae-1.0.0rc3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (623.0 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc3-cp313-cp313-macosx_11_0_x86_64.whl (557.8 kB view details)

Uploaded CPython 3.13 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc3-cp313-cp313-macosx_11_0_arm64.whl (490.1 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc3-cp312-cp312-win_amd64.whl (525.4 kB view details)

Uploaded CPython 3.12 Windows x86-64

scikit_sundae-1.0.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (628.6 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc3-cp312-cp312-macosx_11_0_x86_64.whl (561.8 kB view details)

Uploaded CPython 3.12 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc3-cp312-cp312-macosx_11_0_arm64.whl (494.6 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc3-cp311-cp311-win_amd64.whl (536.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

scikit_sundae-1.0.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (628.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc3-cp311-cp311-macosx_11_0_x86_64.whl (566.1 kB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc3-cp311-cp311-macosx_11_0_arm64.whl (498.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc3-cp310-cp310-win_amd64.whl (537.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

scikit_sundae-1.0.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (628.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc3-cp310-cp310-macosx_11_0_x86_64.whl (566.2 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc3-cp310-cp310-macosx_11_0_arm64.whl (499.1 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

scikit_sundae-1.0.0rc3-cp39-cp39-win_amd64.whl (538.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

scikit_sundae-1.0.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (628.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

scikit_sundae-1.0.0rc3-cp39-cp39-macosx_11_0_x86_64.whl (566.2 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

scikit_sundae-1.0.0rc3-cp39-cp39-macosx_11_0_arm64.whl (499.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

Details for the file scikit_sundae-1.0.0rc3.tar.gz.

File metadata

  • Download URL: scikit_sundae-1.0.0rc3.tar.gz
  • Upload date:
  • Size: 35.6 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.0rc3.tar.gz
Algorithm Hash digest
SHA256 66d2730139f919c6ef25a429af51806f292bc23ee8d1349d5fa09e11f05e1227
MD5 a930d8504e2511c52efa27b06dc633e3
BLAKE2b-256 0859dbd330b1bd95b5790b35b0cce2b049eba4ef7a1006f6c88fea4ff7fbdbde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ecb912c843073f9cae013853abda4b3a1408318de184ad85fcd28012d3901e5a
MD5 7f26a2e7f56665b29a00d210f11225c3
BLAKE2b-256 5816339abcafb0b776d3e6d65947e1ce85af918b468babdde36a3c1e8aea7695

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 71b52cd4e4c6ce8364c59a094ebdf43fa4b627c345d01333e4935fc9aab0c578
MD5 82e3feb92d2e1c6ce4e1321d83b02dd6
BLAKE2b-256 90066669afc4bbafe54395d1c777d1a821b58bacc0561ce8b437ad4fb017d036

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8384185c8b6c3e4fd58d617ff5f1e566ea5e61564b788711a4a55762d8985634
MD5 c2c066d303be008d142464e596343869
BLAKE2b-256 852dd43e43cda2f7a6199902cceb6b9447dbfc70c18e63d36c9ae8bdb3a3ea50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2635f02d6f522ff7f1e1a30c7f1cc7f81c49b58dddd793de63326f30aaa587c
MD5 ba65c39b31db1f66c4f54ba1948450c4
BLAKE2b-256 6fbe1d0c9629ee797ad2f7e3e52a464b4f4dd90864d89feed867ce1f57f987cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 edae60f9b869df2734e8feba6100135611eb64ee75684c2f1b68b8f77d0bd12e
MD5 ee530a8812d639e0e670e189eee7c1aa
BLAKE2b-256 3daa5a13fa34730fd99b107c312ac6d1ab0fa8fa713a3833f1863f6a8400dcc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c5a9dce9814f9e2b34ef916ae44465a91b77172e536bd988dcb3bf163f76092
MD5 09d527df84fc98c1fec31f01a62f3437
BLAKE2b-256 832e337f8c8a6f5128ac6c0947806e683831049b2ab19327b997034aaa4cccf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c3563b4318f0969ee8d2c98f05a06c6bcdefa3d0d38c89ab07c6d5ecab5dd351
MD5 d5257f261abee48b5836803171e8ad24
BLAKE2b-256 efe4abbb15c87af11da9cf1fd041552f43c57b74ec1f595ab232d36f4f9a3ff3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f53233a158a1d9ded87568b007a165dd9eddfc17874d82752e7968906e4e3f49
MD5 45cd2e4e0b76a8cc990fef12e58b837c
BLAKE2b-256 0a9e774578bd35b4a447c2197bfe374d6e3797abd4eb68b008bf318efc4b284d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 90dd4bc98ced179b64c3c290cf07a08e6d545b671c027023b5cdc7f090052135
MD5 0f4249b06b5e930bd8f537b1aa69f843
BLAKE2b-256 48ff0e80301b3384443507647e9d9d44634344ae07e361799fc8b3d624305498

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7890b207518ec57184c4306566ebe82fa22cd4ee3750d92b0557ffc74dd568f
MD5 a487889e5496429bc7ef80c30ffde529
BLAKE2b-256 67aade7a336b46ca98fb716fdbb6d0e2ddfa0b32649622789f5e8ef0d32cc298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d741de79c1389ee47b0519f6d03bff6176b6d1be6158d779dfc7a9900be1a34b
MD5 db3d918c738badff7b6f3fc88cc0c102
BLAKE2b-256 eeb9f8107b0a436e86f5cea77e3273ad58d1b7011d4f6f79dc01d42ffa542d7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9fb87aaa20a26ddecab4d6ba392715dcdbbd837ee83a41db02731788d9eea57
MD5 1d62379eede576199a3d8b3dde787d09
BLAKE2b-256 f3581d81a51028a6839b2c006a9030a087af00ecd323500cd5f941e37de478b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dd8b27f989ffe6fcb73d20df2cb9a472507b3b71b4994675738ecffa5b6d87b5
MD5 cb10c55efce596b37ef46d09a0533e9a
BLAKE2b-256 6fe99ca692cc13cd4bfed08a22b5f7666613628f8878a25dd60b3a661fa94fff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f01c6df26a33bd4ad6586c8e7a14ebc430ee94c7991099e7b5fa420170bd9be4
MD5 d6b2332229c6fd0a0258a250bbe23b00
BLAKE2b-256 653018a26f9fe95893ef6ac7510466efe666b3740e9e926c6be8946011d1ed6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 244abbe612ce68e569904c6106f2369dcfd995beaafd2cd97552575987a53df7
MD5 759cb6341fabd8a6cfc2e03fff86abd0
BLAKE2b-256 23d467820245f14b330833b81f0bb6cbaeb9cd55ebd0f613931ec49c5982c9c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 33a0b8b5a413b9745ba0942b5999765c5df6fd1fc38ef473ec5c88836b89be45
MD5 4707880b60dede7a3b13bfd942f25b80
BLAKE2b-256 9ff8d9b6eb31b4a7b997c9abb9a4fff633b469bcfa5382b46c0dfcf87ddec427

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3ff4c0bd922a58b5bd7fa14f46234c6f37b1f02a23d2cf1ba8499ecf9b3359ba
MD5 c9d09356152f5f1c68c6990bdaae2bbc
BLAKE2b-256 1547f5aee9589b81ec6a7219fda0b33031fc909e3eb69e9d31ed101b997e1cec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 292d920a5aa9f8fd017b42e8cf6a639af554c5cc2e68f3492faf0bc735281354
MD5 2914b5d5f6b37beffd66e3d9174c4cd3
BLAKE2b-256 c87d22e42c59f2c641eca287dd9b755b24b7d9388a80d1621527c0eb358b071f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9c547295e972ce0873288def142c0ff01d925bedc6c0e5df8fde49fbfc3ac01b
MD5 038b8cd055c61eea37816c4f87cabf16
BLAKE2b-256 b34bfe1e20f5cd84a57d612feea7a27071aaa465821ec74c22f63381963ed769

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scikit_sundae-1.0.0rc3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 976ebc227a62529ba0658c2be5713ea8a8663873b1f4f931207fe690477be79a
MD5 e18263f35739a2de488a0fd97d8019e4
BLAKE2b-256 1adefc992667c7eb34ba734bc9d7a32abb518291eccfe2656197644e6fc6a4cb

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