I RK4 with adaptative step versus fourth order leapfrog integrator

Summary
I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree.
Summary: I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree.

(first thing : I don't know much about integrator)

I want to solve the trajectory of particle in a analytic field I know ( it is not possible to use symplectic method due to complicated evaluation such as elliptic integral etc. ). Right know I use a RK4 integrator with adaptative step ( the one in GEANT4). But from reading here and there I thought 4th order integrator could be better for energy conservation. So for testing, I try to solve simple system (particle in a 2D quadratic potential) in scilab with RK4 and 4th order leap frog integrator and the efficency (error versus solving time) was very close (with a small advantage for RK4 method). So it seems that there is not much difference between RK and leapfrog.
I have to add that trajectory i want to solve are not stable trajectory (they can but by accident) and maybe in this situation all integrator are more or less equivalent ?

So my question is : in which situation 4th order leapfrog integrators are better than RK4. Is this possible to use those with adaptative step ?

( I eventually wish to replace the RK4 adaptative step integrator of GEANT4 by a new one)
 
Last edited:

anorlunda

Mentor
Insights Author
Gold Member
6,519
3,582
Summary: I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree.

I have to add that trajectory i want to solve are not stable trajectory (they can but by accident) and maybe in this situation all integrator are more or less equivalent ?
Ah yes if unstable, all numerical integration will eventually fail unless you keep shortening the time step size toward zero.

Can you solve the differential equations to find a closed form time domain solution? If so, then just evaluate that solution instead of integrating. A site like Wolfram Alpha could help you find the solution.
 
627
142
So my question is : in which situation 4th order leapfrog integrators are better than RK4. Is this possible to use those with adaptative step ?
Symplectic integrators are most useful for long term simulations as they do not suffer from "energy drift" (a simplification, but it will have to do for now!). I use them for hamiltonian system simulations.

Unfortunately, adaptive step size is not really in the "spirit" of how symplectic integrators work. There have been many attempts in the literature, but as far as I have seen they all increase implementation complexity to a ridiculous level, and lose performance in the process.
 

Want to reply to this thread?

"RK4 with adaptative step versus fourth order leapfrog integrator" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top