If we sprinkle stars into space, roughly in the shape of a star cluster, with random positions and velocities, the time step criterion which we just introduced works fine. The chance that the relative velocities are all zero or extremely small is itself extremely small. However, during a long run, with millions of time steps, highly unlikely cases are bound to occur occasionally, and we should worry about them. In addition, it may happen that we start from initial conditions in which all velocities are zero. This is termed a `cold collapse' type of initial condition, since the particle `temperature', measured by their kinetic energies, is zero, and the particles will start of by falling roughly towards the center of the particle distribution. In such a case, hermite5.C would crash right at the beginning, during the attempt to calculate an infinitely long time step by dividing by zero.
We can make our code more safe, and able to handle cold starts, by
adding an extra criterion. In addition to the time scale
, we introduce a second time scale
, where
is the relative
acceleration between particles
and
, due to their mutual attraction.
Since acceleration is the second derivative of position, we have to
take a square root in order to wind up with a quantity that has the
dimension of time.
Note the notation used here: in analogy with the definitions of
and
, we could
introduce
. However, this last quantity
would denote the difference between the total accelerations felt
by particles
and
due to all other particles in the system. In
contrast, we are only interested in that part of the difference in
their accelerations due to their own accelerations,
, since
it is that part that is most likely to be important for neighboring
particles. In other words, we neglect the gravitational tidal field
contributions of all other particles while examining a particle pair.
The alternative, of using
instead of
, would be
far more expensive. We would have to compute all total accelerations
first, and then do a pairwise comparison, which would entail a double
pass over all particles, each with a computational cost of order
.
Here is the implementation of hermite6.C. With respect to hermite5.C, the differences are all limited to the first function, acc_and_jerk.