alan-turing-institute / PeriPy

Code base for PeriPy, a lightweight, open-source and high-performance package for peridynamic simulations written in Python - a collaboration between Exeter, Cambridge & Turing
MIT License
41 stars 15 forks source link

Euler integrator (Cython implementation) - speed issues #88

Open mark-hobbs opened 2 years ago

mark-hobbs commented 2 years ago

The Cython implementation of the Euler integrator is 30x slower than equivalent vectorised Matlab code. It is also extremely limited and only allows for a linear damage model with no damping. It is important that there is a reasonably fast solver that does not require OpenCL. I propose to use Numba (jit compiler) instead of Cython. Initial testing shows that it is faster and does not require C like syntax that some users will be unfamiliar with.

bb515 commented 2 years ago

Sounds like a good feature - so will the Numba part will be for calculating the force vector, rather than doing the ODE (time integration)?

For the non-OpenCL ODE solve, could we use an existing integrator for the time integration parts? e.g., from scipy.integrate. Sometimes the advice given is "never write your own ODE solver".