LATTICEEASY uses a method called ``staggered leapfrog'' for solving
differential equations. In order to solve a second order (in time)
equation you need to store the value of the variable and its first
time derivative at each step, and use these to calculate the value of
the second time derivative. The idea of staggered leapfrog is to store
the variables (i.e. the field values) and their derivatives at
different times. Specifically, if the program is using a time step
and the field values are known at a time then the derivatives
will initially be known at a time . Using the field values the
program can then calculate the second derivative at time
and use this to advance to . This value of
can in turn be used to advance to , thus
restarting the process. Schematically, this looks like
(6.95) | |||
To set the initial conditions for the staggered leapfrog calculations the field values and derivatives must be desynchronized. The initial conditions are set at and then the fields are advanced by an Euler step of size to begin the leapfrog. Thereafter all calculations are done in full, staggered steps.
When the program saves output data, however, it is useful to synchronize the data again. The save() routine is always called when the field values are ahead of the field derivatives, so the function begins by moving the field values backwards by a half step, then calculating and saving all output quantities, and then moving the field values forward again. The one output function that does not use this technique is the checkpointing function that saves an image of the grid. This image is saved with the field values and derivatives desynchronized so that they can be read in again and used to continue the leapfrog calculation.