Velocity verlet versus other integration techniques

In summary: I'm just curious about the different options people have)In summary, the author says that velocity verlet is a lousy integrator and elliptical orbits show "apsidal precession" (like mercury's orbit tracing out a rosette) which they shouldn't in a purely classical simulation. He suggests that an integrator such as RK4 might be a better choice if the goal is to maintain energy and stability and improve accuracy.
  • #1
cephron
124
0


Mentor comments:
This thread was split from an OLD thread that was inadvertently resurrected from the dead. The original thread is [thread]182831[/thread].


genneth said:
Btw, for orbiting systems, Verlet integration is a very good way to go, as it preserves energy in this case.

Out of curiosity, do you mean to basic Verlet or the Velocity Verlet?

I've been doing something like the OP's simulation using the velocity Verlet, and yes, it seems to preserve energy pretty nicely...but I've noticed that elliptical orbits tend to show "apsidal precession" (like Mercury's orbit tracing out a rosette) ... which they shouldn't in a purely classical simulation, right?

Are there any common errors that lead to this, or corrections to deal with it? Or is it an unavoidable artifact of using discrete timesteps?

Thanks!
 
Last edited by a moderator:
Physics news on Phys.org
  • #2


cephron said:
Out of curiosity, do you mean to basic Verlet or the Velocity Verlet?

I've been doing something like the OP's simulation using the velocity Verlet, and yes, it seems to preserve energy pretty nicely...but I've noticed that elliptical orbits tend to show "apsidal precession" (like Mercury's orbit tracing out a rosette) ... which they shouldn't in a purely classical simulation, right?

Are there any common errors that lead to this, or corrections to deal with it? Or is it an unavoidable artifact of using discrete timesteps?

Thanks!

No, I get elliptical orbits with discrete timesteps. One thing that appears to be missing in the original question is the initial speed and direction of the Earth and the sun (ie. the position of the Earth on the next timestep not only depends on the force from the sun, but the momentum of the Earth in the last timestep). I am not sure how you are accounting for this as it ends up being very important.
 
  • #3


Oh, I do give initial position and velocity to all bodies involved, for sure.

About the orbit - sorry, I wasn't meaning that you can watch it trace out a rosette with its orbit. For any given single orbit, it's elliptic. It's just that if you walked away for five minutes and came back, the major axis would be pointing in a slighty, but visibly, different direction. Over hours the major axis will do full rotations around the 'sun'. Maybe I should check how many orders of magnitude of timesteps it takes to do one rotation; that would give a better idea of the level of the issue...
 
  • #4


cephron said:
Oh, I do give initial position and velocity to all bodies involved, for sure.

About the orbit - sorry, I wasn't meaning that you can watch it trace out a rosette with its orbit. For any given single orbit, it's elliptic. It's just that if you walked away for five minutes and came back, the major axis would be pointing in a slighty, but visibly, different direction. Over hours the major axis will do full rotations around the 'sun'. Maybe I should check how many orders of magnitude of timesteps it takes to do one rotation; that would give a better idea of the level of the issue...

Interesting, how accurate is a single orbit? Ie, given the correct masses and initial conditions does one orbit come out to pretty close to 365 1/4 days and does the orbit have the correct close point and far point?
 
  • #5


I haven't tried an actual, unit-correct earth-sun system yet (I actually just got the simulator working last night, tbh). But I have played around with realistic units in this kinda thing before. I'll see if I can give it a shot and post some interesting info tomorrow.
 
  • #6


cephron said:
I've been doing something like the OP's simulation using the velocity Verlet, and yes, it seems to preserve energy pretty nicely...but I've noticed that elliptical orbits tend to show "apsidal precession" (like Mercury's orbit tracing out a rosette) ... which they shouldn't in a purely classical simulation, right?
TBH, velocity verlet is a pretty lousy integrator. People legitimately use a lousy integrator such as velocity verlet in an N-body simulations when they realistically can't use a better choice (e.g., N or the time scale is extremely large). In this case, N is not "very, very large", and much better integrators can be used.
 
  • #7


Ok - so, is Velocity Verlet, like, the top one of its class (in computational expense), and to do better requires a higher class of integrator (ie. more computationally expensive)?

My instinct would have been to look at RK4 next, but there seem to be some concerns circulating the nets that it loses energy...
http://www.gamedev.net/topic/387065-runge-kutta-unstable-in-some-situations/
(I also noted: this person's experiments also found that Velocity Verlet orbits tend to precess)

If one were assuming the goals of (1) maintaining energy and stability, and (2) improving accuracy over Velocity Verlet, what integrators might be next in line? How much more computationally expensive are they?

I'm interested in any input.(and to the original poster, let me know if you consider this to be hijacking your thread beyond your purposes; I'll apologize and start a new one...)
 
  • #8


This page on http://en.wikipedia.org/wiki/Euler_method" talks about these types of simulations and at the bottom, gives links to some simulation methods.

I am not sure what you are trying to simulate, but if we stick to the sun/earth system for the moment, there is a very important comment to make when dealing with descrete timesteps. Do NOT use the tangent to the line as shown in the Euler example. DO use the proper prior position of your objects from the previous timestep that you MUST calculate by hand.

To illustrate this, assuming you choose the mass of the Earth and sun to say 6 digits accuracy, you then choose the distance between the Earth and sun on some particular day to start at say 6 digits accuracy. Using the tangent to calculate the momentum will result in an orbit that is days out from a proper 365 day orbit (ie, it will not even be within 2 digits accurate even if you did a calculation for every second of the year) and the wiki page illustrates how that error is propagated. If you calculate by hand where the Earth and sun would be prior to the first timestep to the same accuracy (6 digits) to get the proper momentum rather then using the tangent value, you will be able to get the orbit to within minutes of being correct, even if you only use hours or days as calculation timesteps.

Also note that if you switch from daily calculation timesteps to hourly calculation timesteps, you cannot divide your momentum by 24 and use the same direction, you must recalculate your first prior position (and hence the direction of the momentum of the earth) based on the new timesteps. In summary, the direction of the momentum of the Earth to start is dependent on the timeframe you choose to do your calculations. Using the tangent, does not take this into account.

Switching to this method causes the opposite problem compared to what you are seeing. You will not be able to simulate a precessing orbit as all orbits, no matter how you start them or what masses you use, will turn into perfect ellipses (samples http://www.animatedphysics.com/videos/planets.htm" ).

Hope this post is of some help.
 
Last edited by a moderator:
  • #9

1. What is the velocity verlet integration technique and how does it differ from other integration techniques?

The velocity verlet integration technique is a numerical method used to solve equations of motion in physical systems. It calculates the position and velocity of a system at discrete time steps by using previous and current position and velocity values. It differs from other integration techniques such as Euler's method and Runge-Kutta method by being more accurate and stable, especially for systems with varying energies or complex interactions.

2. Why is the velocity verlet integration technique preferred over other methods?

The velocity verlet integration technique is preferred over other methods because it conserves energy and momentum, making it more suitable for long-term simulations. It also has a higher accuracy and stability compared to other methods, allowing for more precise results.

3. What are the limitations of the velocity verlet integration technique?

One limitation of the velocity verlet integration technique is that it requires the calculation of both position and velocity at each time step, which can be computationally expensive. It also assumes that the acceleration of a system is constant between time steps, which may not be accurate for certain systems.

4. In which types of simulations is the velocity verlet integration technique most commonly used?

The velocity verlet integration technique is commonly used in molecular dynamics simulations, where it is important to accurately track the position and velocity of particles over time. It is also used in simulations of other physical systems such as gases, liquids, and solids.

5. Are there any variations of the velocity verlet integration technique?

Yes, there are variations of the velocity verlet integration technique, such as the leapfrog and Beeman methods. These variations improve upon the original technique by reducing errors and increasing efficiency in certain types of simulations. However, the basic principles of calculating position and velocity at discrete time steps remain the same.

Similar threads

  • Programming and Computer Science
Replies
8
Views
2K
  • Math Proof Training and Practice
Replies
16
Views
5K
  • Math Proof Training and Practice
Replies
28
Views
5K
Back
Top