Skip to main content

Fast Simulation of Nonlinear Oscillator Dynamics in Python

Project description

Poscidyn

Fast Simulation of Nonlinear Oscillator Dynamics in Python

Poscidyn (Python oscillator dynamics) is a Python toolkit based on JAX, designed to streamline and accelerate time-response and frequency-sweep simulations. It leverages novel parallelization strategies to gain a speed advantages over standard continuation software.

Features include:

  • Frequency sweep simulation (forward and backward)
  • Time-response simulation
  • Built-in models of (nonlinear) oscillators
  • Everything vmappable (batchable)

Installation

pip install poscidyn[gpu]

Requires Python 3.10 or newer.

Documentation

Have a look at our extensive documentation on how to install, use and extend this package: https://rknetemann.github.io/poscidyn/.

Quick example

import poscidyn
import numpy as np

Q, omega_0, a, b = np.array([50.0, 50.0]), np.array([1.00, 2.00]), np.zeros((2, 2, 2)), np.zeros((2, 2, 2, 2))
a[0,0,1] = 2.0
a[1,0,0] = 1.0
b[0,0,0,0] = 1.0
modal_forces = np.array([1.0, 1.0])
modal_contributions = np.array([1.0, 1.0])

driving_frequency = np.linspace(0.9, 1.13, 256)
driving_amplitude = np.linspace(0.1, 1.0, 8) * 0.0144

model = poscidyn.Nonlinear(Q=Q, a=a, b=b, omega_0=omega_0)
excitation = poscidyn.DirectExcitation(driving_frequency, driving_amplitude, modal_forces)
solver = poscidyn.TimeIntegration(max_steps=4096 * 20, n_time_steps=100, rtol=1e-5, atol=1e-7, t_steady_state_factor=2.0)
response_measure = poscidyn.Demodulation(multiples=(1,), modal_contributions=modal_contributions)

frequency_sweep = poscidyn.frequency_sweep(
    model = model, excitation=excitation, solver=solver, response_measure=response_measure, precision=poscidyn.Precision.DOUBLE
) 

Frequency sweep

Credits where they are due

JAX: a Python library for accelerator-oriented array computation and program transformation, designed for high-performance numerical computing and large-scale machine learning.

Diffrax: JAX-based library providing numerical differential equation solvers.

Equinox: your one-stop JAX library, for everything you need that isn't already in core JAX.

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

poscidyn-0.1.4.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poscidyn-0.1.4-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file poscidyn-0.1.4.tar.gz.

File metadata

  • Download URL: poscidyn-0.1.4.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for poscidyn-0.1.4.tar.gz
Algorithm Hash digest
SHA256 261fb6046f73db1c9f0cae9e1c69bb2c58c802c4c8d536aec38449f804fd83ca
MD5 1145bd97328870d1690adede20b9ff92
BLAKE2b-256 03dfd84b76f9d9932e9b177d45027dfde9f52bea9be189b2b3cf9aacb73b1af7

See more details on using hashes here.

File details

Details for the file poscidyn-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: poscidyn-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 39.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for poscidyn-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7044711d8184b9dc7095eccee864f418abb83625d15f20b838fdbc4322a3208c
MD5 307a50a9aca83b0d9779d193444fb550
BLAKE2b-256 af6bf82c603c6a776b586f7c75cd15b9710b9059bc16b72920c70e5ea7e6952b

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