Skip to main content

Lightning-fast integration of single degree-of-freedom systems.

Project description

sdof

PEER Logo

Lightning-fast integration of single degree-of-freedom systems.


Latest PyPI version NPM version


This package solves scalar differential equations of the form

$$ m \ddot{u} + c \dot{u} + k u = f(t) $$

Integration is carried out using a Generalized - $\alpha$ integrator that is implemented under the hood in highly optimized multi-threaded C code.

Generalized - $\alpha$ is an implicit method that allows for high frequency energy dissipation and second order accuracy. With the right selection of parameters, the method can be specialized to the Hibert-Hughes-Taylor (HHT), or Newmark families of integration schemes.


Python API

import numpy as np
from sdof import integrate, peaks, spectrum

m  = 1.0
c  = 1.0
k  = 2.0
f  = np.sin(np.linspace(0, 5*np.pi, 100))
dt = 5*np.pi/100

u_max, v_max, a_max =  peaks(m, c, k, f, dt)

u, v, a = integrate(m, c, k, f, dt)

D, V, A =  spectrum(f, dt, damping=[0.02, 0.05], periods=(0.02, 3.0, 100))

Integrator (Adapted from OpenSees docs)

alphaM

$\alpha_M$ factor

alphaF

$\alpha_F$ factor

gamma

$\gamma$ factor

beta

$\beta$ factor

  1. $\alpha_F$ and $\alpha_M$ are defined differently that in the paper, we use $\alpha_F = (1-\alpha_f)$ and $\alpha_M=(1-\gamma_m)$ where $\alpha_f$ and $\alpha_m$ are those used in the paper.
  2. Like Newmark and other implicit schemes, the unconditional stability of this method applies to linear problems. There are no results showing stability of this method over the wide range of nonlinear problems that potentially exist. Experience indicates that the time step for implicit schemes in nonlinear situations can be much greater than those for explicit schemes.
  3. $\alpha_M = 1.0, \alpha_F = 1.0$ produces the Newmark Method.
  4. $\alpha_M = 1.0$ corresponds to the HHT method.
  5. The method is second-order accurate provided $\gamma = \dfrac{1}{2} + \alpha_M - \alpha_F$
  6. The method is unconditionally stable provided $\alpha_M \ge \alpha_F \ge \dfrac{1}{2}, \quad \beta \ge \dfrac{1}{4} +\dfrac{1}{2}(\gamma_M - \gamma_F)$
  7. $\gamma$ and $\beta$ are optional. The default values ensure the method is unconditionally stable, second order accurate and high frequency dissipation is maximized.

The defaults are:

$$\gamma = \dfrac{1}{2} + \gamma_M - \gamma_F$$

and

$$\beta = \dfrac{1}{4}(1 + \gamma_M - \gamma_F)^2$$

Theory

The generalized $\alpha$ method is a one step implicit method for solving the transient problem which attempts to increase the amount of numerical damping present without degrading the order of accuracy. In the HHT method, the same Newmark approximations are used:

$$u_{t+\Delta t} = u_t + \Delta t \dot u_t + [(0.5 - \beta) \Delta t^2] \ddot u_t + [\beta \Delta t^2] \ddot u_{t+\Delta t}$$

$$\dot u_{t+\Delta t} = \dot u_t + [(1-\gamma)\Delta t] \ddot u_t + [\gamma \Delta t ] \ddot u_{t+\Delta t} $$

but the time-discrete momentum equation is modified:

$$R_{t + \alpha_M \Delta t} = F_{t+\Delta t}^{\mathrm{ext}} - M \ddot u_{t + \alpha_M \Delta t} - C \dot u_{t+\alpha_F \Delta t} - F^{\mathrm{int}}(u_{t + \alpha_F \Delta t}) $$

where the displacements and velocities at the intermediate point are given by:

$$u_{t+ \alpha_F \Delta t} = (1 - \alpha_F) u_t + \alpha_F u_{t + \Delta t}$$

$$\dot u_{t+\alpha_F \Delta t} = (1-\alpha_F) \dot u_t + \alpha_F \dot u_{t + \Delta t}$$

$$\ddot u_{t+\alpha_M \Delta t} = (1-\alpha_M) \ddot u_t + \alpha_M \ddot u_{t + \Delta t}$$

Following the methods outlined for Newmarks method, linearization of the nonlinear momentum equation results in the following linear equations:

$$K_{t+\Delta t}^{*i} d u_{t+\Delta t}^{i+1} = R_{t+\Delta t}^i$$

$$K_{t+\Delta t}^{*i} = \alpha_F K_t + \alpha_F \frac{\gamma}{\beta \Delta t} C_t + \alpha_M\frac{1}{\beta \Delta t^2}M$$

and

$$R_{t+\Delta t}^i = F_{t + \Delta t}^{\mathrm{ext}} - F(u_{t + \alpha F \Delta t}^{i-1})^{\mathrm{int}} - C \dot u_{t+\alpha F \Delta t}^{i-1} - M \ddot u_{t+ \alpha M \Delta t}^{i-1}$$

The linear equations are used to solve for

$$u_{t+\alpha_F \Delta t}, \dot u_{t + \alpha_F \Delta t} \ddot u_{t+ \alpha M \Delta t}$$

Once convergence has been achieved the displacements, velocities and accelerations at time $t + \Delta t$ can be computed.

Compiling

The main integrator is implemented in standard C and can be compiled as either a Python extension, or Javascript library (via WASM).

Python

pip install .

Javascript

  • Install emscripten from here

  • run make. This creates the following files:

    • dist/fsdof.wasm - Web assembly - compiled library,
    • dist/fsdof.js - interface to binary fsdof.wasm
  • to test, you can use Python to start an HTTP server in the current directory as follows:

    python -m http.server .
    

References

J. Chung, G.M.Hubert. "A Time Integration Algorithm for Structural Dynamics with Improved Numerical Dissipation: The Generalized - $\alpha$ Method" ASME Journal of Applied Mechanics, 60, 371:375, 1993.


Code Developed by: fmk

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

sdof-0.0.7.tar.gz (82.2 kB view hashes)

Uploaded Source

Built Distributions

sdof-0.0.7-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (15.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (15.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (15.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-cp311-cp311-musllinux_1_1_x86_64.whl (27.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

sdof-0.0.7-cp311-cp311-musllinux_1_1_i686.whl (26.8 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

sdof-0.0.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.0 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-cp310-cp310-musllinux_1_1_x86_64.whl (27.9 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

sdof-0.0.7-cp310-cp310-musllinux_1_1_i686.whl (26.8 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

sdof-0.0.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.5 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-cp39-cp39-musllinux_1_1_x86_64.whl (27.9 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

sdof-0.0.7-cp39-cp39-musllinux_1_1_i686.whl (26.8 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

sdof-0.0.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-cp38-cp38-musllinux_1_1_x86_64.whl (27.9 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

sdof-0.0.7-cp38-cp38-musllinux_1_1_i686.whl (26.8 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

sdof-0.0.7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

sdof-0.0.7-cp37-cp37m-musllinux_1_1_x86_64.whl (27.9 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

sdof-0.0.7-cp37-cp37m-musllinux_1_1_i686.whl (26.8 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

sdof-0.0.7-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

sdof-0.0.7-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (26.5 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

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