 
 
 
 
 
   
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
 and the field values are known at a time  then the derivatives
will initially be 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
. Using the field values the
program can then calculate the second derivative  at time
 at time
 and use this to advance
 and use this to advance  to
 to  . This value of
. This value of
 can in turn be used to advance
 can in turn be used to advance  to
 to  , thus
restarting the process. Schematically, this looks like
, thus
restarting the process. Schematically, this looks like
|  |  |  | (6.95) | 
|  |  | ![$\displaystyle \dot{f}(t-dt/2) + dt \ddot{f}[f(t)]$](img401.png) | |
|  |  |  | |
|  | 
 or
 or  in terms of its derivative
at a time in the middle of the step this method has higher order
accuracy and greater stability than a simple Euler method. However,
the method relies on being able to calculate
 in terms of its derivative
at a time in the middle of the step this method has higher order
accuracy and greater stability than a simple Euler method. However,
the method relies on being able to calculate  in terms of
 in terms of
 at the time
 at the time  , so both accuracy and stability are generally lost
if
, so both accuracy and stability are generally lost
if  depends on the first derivative
 depends on the first derivative  . This is the
reason we choose our rescalings so as to eliminate first derivative
terms in the equations of motion. Note that the evolution equation for
the scale factor does have a first derivative in it. Section
6.2.2 describes how this problem is solved in the
program.
. This is the
reason we choose our rescalings so as to eliminate first derivative
terms in the equations of motion. Note that the evolution equation for
the scale factor does have a first derivative in it. Section
6.2.2 describes how this problem is solved in the
program.
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
 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.
 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.
 
 
 
 
