N-body algorithm is taken from research article Performance Analysis of Direct N-Body Algorithms on Special-Purpose Supercomputers
Integration consists of the following steps:
(1) The initial time steps are calculated from
where typically ηs = 0.01 gives sufficient accuracy.
(2) The system time t is set to the minimum of all and all particles i that have are selected as active particles. Note that “classical” N-body codes (Aarseth 1999, 2003) employ a sorted time-step list to select short time step particles efficiently. Such sorting is abandoned in favor of a search over all N particles, which improves load balance in the parallel code due to the more random distribution of short and long step particles.
(3) Positions and velocities at the new t are predicted for all particles using
and
Here, the second subscript denotes a value given either at the beginning (0) or the end (1) of the current time step. All quantities used in the predictor can be calculated directly, i.e. no memory of a previous time step is required.
(4) Acceleration and its time derivative are updated for active particles only according to
and
where
and is the softening parameter.
(5) Positions and velocities of active particles are corrected using
and
where the second and third time derivatives of a are given by
(6) The times ti are updated and the new time steps ∆ti are determined.
Time steps are calculated using the standard formula (Aarseth 1985):
The parameter controls the accuracy of the integration and is typically set to 0.02. The value of is calculated from
(7) Repeat from step (2).