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.5.tar.gz (35.1 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.5-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: poscidyn-0.1.5.tar.gz
  • Upload date:
  • Size: 35.1 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.5.tar.gz
Algorithm Hash digest
SHA256 9e4cd479dbcc1be55bd357d975280746efffdc3b99e74c3ab53d5baca4a6638c
MD5 db73069525034f036e41e5a788f908b1
BLAKE2b-256 b106e7f6a49429809d7f039f8eecd54bceb9c3c1db422e204a63e25e9b061a15

See more details on using hashes here.

File details

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

File metadata

  • Download URL: poscidyn-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 39.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6009859fc67de71977a825201f6e172d3431e40b66833b0ef3573dbb5a133ed7
MD5 940c2fee3237965b9b3b2068738ec9b8
BLAKE2b-256 1e75b39b314792d7f7588a1cd5da42da988a52455dd5405f181c31ff4d93c7aa

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