Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
velocity_verlet.hpp File Reference

Velocity Verlet, the method this project integrates with by default. More...

Go to the source code of this file.

Classes

class  orrery::integrators::VelocityVerlet
 The second-order symplectic integrator described above. More...

Functions

void orrery::integrators::velocity_verlet_step (core::ParticleData &data, core::Real timestep, AccelerationField &field)
 One kick-drift-kick step, as a free function.

Detailed Description

Velocity Verlet, the method this project integrates with by default.

Second order, symplectic, time-reversible, one force evaluation per step and no storage beyond the state itself. The combination is why it has been the standard choice in stellar dynamics and molecular dynamics for decades: for a long run the bounded energy error of a symplectic method is worth more than the smaller error per step of a higher-order one, and ADR-0011 gives that argument in full.

The step is written in kick-drift-kick form:

v(t + h/2) = v(t)       + (h/2) a(x(t))
x(t + h)   = x(t)       + h v(t + h/2)
v(t + h)   = v(t + h/2) + (h/2) a(x(t + h))

The two half-kicks make the step symmetric under h -> -h, which is what makes it exactly reversible, and they surround a single evaluation of the acceleration. The drift-kick-drift arrangement is the same method to the same order and would work equally well; kick-drift-kick is chosen because it ends on an acceleration evaluated at the final positions, which is precisely the invariant in integrator.hpp that lets the next step reuse it.

Function Documentation

◆ velocity_verlet_step()

void orrery::integrators::velocity_verlet_step ( core::ParticleData & data,
core::Real timestep,
AccelerationField & field )

One kick-drift-kick step, as a free function.

Exposed separately from the class because Yoshida's fourth-order method is literally three of these steps with weighted timesteps, and composing the function is better than restating its arithmetic in a second file where the two could drift apart. It carries the same precondition and postcondition as Integrator::step.