Skip to main content

Sundials wrapper module for scikits-odes

Project description

Documentation Status DOI Paper DOI

This package contains the SUNDIALS wrappers for ODES. pip install scikits-odes to get all the available solvers.

ODES is a scikit for Python 3.7+ offering extra ode/dae solvers, as an extension to what is available in scipy. The documentation is available at Read The Docs, and API docs can be found at https://bmcage.github.io/odes.

Available solvers:

ODES provides interfaces to the following solvers:

  • BDF linear multistep method for stiff problems (CVODE and IDA from SUNDIALS)
  • Adams-Moulton linear multistep method for nonstiff problems (CVODE and IDA from SUNDIALS)
  • Explicit Runge-Kutta method of order (4)5 with stepsize control (dopri5 from scipy.integrate)
  • Explicit Runge-Kutta method of order 8(5,3) with stepsize control (dop853 from scipy.integrate)
  • Historical solvers: lsodi and ddaspk are available for comparison reasons. Use IDA instead! Note that lsodi fails on architecture aarch64.

Usage

A simple example solving the Van der Pol oscillator is as follows:

import matplotlib.pyplot as plt
import numpy as np
from scikits_odes import ode

t0, y0 = 1, np.array([0.5, 0.5])  # initial condition
def van_der_pol(t, y, ydot):
    """ we create rhs equations for the problem"""
    ydot[0] = y[1]
    ydot[1] = 1000*(1.0-y[0]**2)*y[1]-y[0]

solution = ode('cvode', van_der_pol, old_api=False).solve(np.linspace(t0,500,200), y0)
plt.plot(solution.values.t, solution.values.y[:,0], label='Van der Pol oscillator')
plt.show()

For simplicity there is also a convenience function odeint wrapping the ode solver class. See the User Guide for a simple example for odeint, as well as simple examples for object orientated interfaces and further examples using ODES solvers.

Projects that use odes

You can learn by example from following code that uses ODES:

  • Centrifuge simulation, a wrapper around the ida solver: see centrifuge-1d

You have a project using odes? Do a pull request to add your project.

Citing ODES

If you use ODES as part of your research, can you please cite the ODES JOSS paper. Additionally, if you use one of the SUNDIALS solvers, we strongly encourage you to cite the SUNDIALS papers.

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

scikits_odes_sundials-3.1.1.tar.gz (98.2 kB view details)

Uploaded Source

File details

Details for the file scikits_odes_sundials-3.1.1.tar.gz.

File metadata

  • Download URL: scikits_odes_sundials-3.1.1.tar.gz
  • Upload date:
  • Size: 98.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for scikits_odes_sundials-3.1.1.tar.gz
Algorithm Hash digest
SHA256 18c35ab2645289226ff16804db082fb91d1d31d3ee05f316d8b012accaea7032
MD5 5ef0ac17913b54362fd5b9269281ff72
BLAKE2b-256 bf098ef75e31e08a00c15a091d7b5488bf89751fe2b9cd492edd6f4170c41c89

See more details on using hashes here.

Provenance

The following attestation bundles were made for scikits_odes_sundials-3.1.1.tar.gz:

Publisher: release.yml on bmcage/odes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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