# Using ODE solvers for accelerator physics project

**URL:** <https://discourse.julialang.org/t/using-ode-solvers-for-accelerator-physics-project/124853>\
**Category:** GPU\
**Tags:** diffeq\
**Created:** [January 17, 2025, 12:31am UTC](https://discourse.julialang.org/t/using-ode-solvers-for-accelerator-physics-project/124853 "2025-01-17T00:31:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleksii](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@Oleksii](https://discourse.julialang.org/u/Oleksii)\
**Post date:** [January 17, 2025, 12:31am UTC](https://discourse.julialang.org/t/using-ode-solvers-for-accelerator-physics-project/124853/1 "2025-01-17T00:31:13Z")

</div>

Hi!

I would like to incorporate DiffentialEquations for our Accelerator Physicists particle tracking code. The set up is the following: ensembles of particles are moving through the sequence of magnets each having a length, some constant parameters and a Hamiltonian prescribing an ODE. The time like independent variable in this case is space position s, varying from 0 to total length of the accelerator. I wanted to clarify a few aspects of DifferentialEqations package before I start the development.

Are any symplectic methods available to execute on GPU for ensembles DiffEqGPU as it done with GPUTsit5 examples?

With the current set up I can see two possible ways to evolve the particles:  
Invoking solve for each accelerator element (magnet) in a loop  
Or use one large piecewise Hamiltonian to represent a whole accelerator and use a single solve call.

What is more beneficial, in terms of computational overhead?

Thank you!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [January 17, 2025, 9:27am UTC](https://discourse.julialang.org/t/using-ode-solvers-for-accelerator-physics-project/124853/2 "2025-01-17T09:27:58Z")

</div>

> [@Oleksii](#):
>
> Are any symplectic methods available to execute on GPU for ensembles DiffEqGPU as it done with GPUTsit5 examples?

Is your case solving lots of the same small ODE? If that then no. If it’s a big ODE that you want to GPU, then you’d want to just make `u0` a CuArray.
