Skip to main content

FastRK, a generator of fast jit-compiled code for ODE propagation by ERK methods with adaptive step and events

Project description

FastRK

  • developed as fast alternative for subset of scipy.integrate.ode methods (i.e. DOP853);
  • is a python code generator for Ordinary Differential Equations (ODE) propagation;
  • uses explicit embedded Runge-Kutta (ERK) methods adaptive step technique;
  • calculates events using event functions (like scipy.integrate.solve_ivp);
  • is jit-compiled by Numba;
    • compiled code cached on SSD/HDD to prevent unnecessary recompilation;
  • OS-independent (to the same extent as Numba);
  • contains Butcher Tables for several ERK methods:
    • Dormand and Prince 6(5)8M;
    • Dormand and Prince 8(7)13M;
      • ~2-3x faster than DOP853 from scipy.integrate.ode
    • Verner's 8(9)16;
  • user-defined Butcher Tables also supported;
  • generated code is open and user-modifiable;

Butcher Tables was adapted from TrackerComponentLibrary.

Installation

pip install fastrk

Fast example

import numpy as np
import matplotlib.pyplot as plt
from fastrk import BT8713M, RKCodeGen

# CRTBP ODE, https://github.com/BoberSA/fastrk/tree/master/examples/model_crtbp.py
from model_crtbp import crtbp

rk_module = RKCodeGen(BT8713M, autonomous=True).save_and_import()
rk_prop = rk_module.rk_prop

t0, t1 = 0., 3 * np.pi
# initial state for halo orbit
s0 = np.zeros(6)
s0[[0, 2, 4]] = 9.949942666080747733e-01, 4.732924802139452415e-03, -1.973768492871211949e-02
mc = np.array([3.001348389698916e-06])  # CRTBP constant
rtol, atol = 1e-12, 1e-12

# integrate CRTBP ODE from t0, s0 to t1
arr = rk_prop(crtbp, s0, t0, t1, np.inf, rtol, atol, mc)

plt.plot(arr[:, 1], arr[:, 2], 'r')
plt.axis('equal')
plt.show()

Detailed examples

Example 0: Propagate spacecraft motion in Circular Restricted Three Body Problem

Example 1: Calculate events in Circular Restricted Three Body Problem

Core Developer

Stanislav Bober, MIEM NRU HSE, IKI RAS

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

fastrk-0.0.3.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

fastrk-0.0.3-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file fastrk-0.0.3.tar.gz.

File metadata

  • Download URL: fastrk-0.0.3.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.8.0 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for fastrk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4554b7df5c6e063b5ada804114d1ef98f32d91586ccf88f185be495af5be8804
MD5 1a6e3bd5508beb26a4d96dc1cf272cc0
BLAKE2b-256 b4734fdc65b3f0e5d451565da59f749c557518251dfed6480f45d587e3f6b899

See more details on using hashes here.

File details

Details for the file fastrk-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: fastrk-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.8.0 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for fastrk-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54d6ab940cb2ff04256304dfc6dc05070ccebfc5544168f2530f73917b1a43de
MD5 c8231abc7ff1d1947900cbd22ab6d088
BLAKE2b-256 c7802beb3354bd3a88bcb2bfbb53c30ecf701813ac4f857074737849ffba2f79

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