Particle Steppers
Within the particle-in-cell capabilities in SALAMANDER, two main particle steppers are provided, the Leapfrog stepper and the Boris stepper. Both of these particle steppers are second order accurate in time. In order to verify that these steppers work properly, a convergence study can be utilized to ensure that second order accuracy is observed.
Demonstration Problems
To verify and demonstrate the implementation of the particle steppers, a classic example of single particle motion, cyclotron motion, is utilized. While cyclotron motion requires a magnetic field, we will utilize the analytic solution for particle motion to configure electric fields to reproduce the same particle paths.
Cyclotron Motion
The problem setup of cyclotron motion starts with a static magnetic field perpendicular to the plane in which the particle is traveling. For this example, the particle is traveling within the xy plane, and the magentic field is aligned along the positive z direction:
where represents the magnetic field and denotes the magnitude of the magnetic field. Starting from Newton's equation of motion
where is the particle's velocity, is the particle's charge, and is the particle's mass.
The analytic solution to these equations are given by
where , the Larmor radius, is given by
Here, is the initial speed of the particle in the plane perpendicular to the magnetic field, and is the gyro frequency. The gyrofrequency is defined as
Time-varying Electric Field
The leapfrog stepper is designed to move particles through an electric field. Starting from the equations of motion for a particle in an electric field, the particle velocity is given by
We can then use the solution for the particle's path under cyclotron motion to calculate the electric field which will reproduce the same particle motion. Doing so yields the electric field:
Convergence Studies
For the sake of simplicity, all particle properties are set to unity, in S.I. units, and the magnetic field magnitude, , is set to 1 T. Four time steps are used, each one an order of magnitude smaller than the last, seconds. After a simulation at a given time step is completed, the relative and norms of the error between the analytic and simulated solutions are taken. Plotting these errors on a log-log plot and then calculating the slope reveals the order of accuracy of the time integration; both implemented steppers are second order accurate in time, so the slope of each line should be two.
Boris Stepper: Cyclotron Motion
This test specifically tests the part of the stepper which calculates the force on the particle due to the magnetic field. The relative and errors seen in Figure 1 and Figure 2, respectively, show the error over the course of the convergence study. Both errors indicate that the implementation of the Boris Stepper achieves the expected second order accuracy in time when moving a particle through a magnetic field. Second order accuracy is observed for both particle position and velocity.

Figure 1: Relative error for particle position and velocity for a particle subject to cyclotron motion being pushed via the Boris Stepper for four different time step sizes.

Figure 2: Relative error for particle position and velocity for a particle subject to cyclotron motion being pushed via the Boris Stepper for four different time step sizes.
Boris Stepper: Time-varying Electric Field
In this example, the part of the Boris stepper which handles the acceleration on the particle due to the electric field is tested. Both the relative , Figure 3, and , Figure 4, errors are examined. The errors show that the implementation of the Boris stepper achieves the expected second order accuracy in time when moving a particle through an electric field.

Figure 3: Relative error for particle position and velocity for a particle being moved in a time varying electric field via the Boris Stepper for four different time step sizes.

Figure 4: Relative error for particle position and velocity for a particle being moved in a time varying electric field via the Boris Stepper for four different time step sizes.
Leapfrog Stepper: Time-varying Electric Field
Since the Leapfrog stepper can be thought of as a special case of the Boris stepper where no magnetic field is present, the resulting errors should be the same as those produced in the previous test shown in Figure 3 and Figure 4. In fact, the errors and order of accuracy of the stepper implementation should be the same in both tests. In examining the relative , Figure 5, and , Figure 6, errors for this test case, it can be seen that they are, in fact, the same as those observed in Figure 3 for and Figure 4 for .

Figure 5: Relative error for particle position and velocity for a particle being moved in a time-varying electric field via the Leapfrog Stepper for four different time step sizes.

Figure 6: Relative error for particle position and velocity for a particle being moved in a time-varying electric field via the Leapfrog Stepper for four different time step sizes.
Through this verification test both the Boris and the Leapfrog steppers have been verified. Both portions of the Boris stepper, that which handles the acceleration due to a magnetic field and that which handles the acceleration due to an electric field, produce results which are, as expected, second order accurate in time. Additionally, the Leapfrog stepper produces these expected results as well.
Input Files
There are several input files used for this verification case. The two for the Boris stepper can be found at (test/tests/userobjects/particle_stepper/boris_stepper/cyclotron_motion.i) and (test/tests/userobjects/particle_stepper/boris_stepper/circular_e_field.i). The one for the Leapfrog stepper can be found at (test/tests/userobjects/particle_stepper/leapfrog_stepper/circular_e_field.i) Since the majority of the input file contents are the same for all cases, the files are broken up into several common files.
(test/tests/userobjects/particle_stepper/stepper_base.i) disables the field solver, so that particle motion tests are only conducted in fields that are known exactly, and sets up the PICStudy.
(test/tests/userobjects/particle_stepper/boris_stepper/boris_base.i) adds magnetic field components to the list of AuxVariables and selects the BorisStepper as the particle stepper.
(test/tests/userobjects/particle_stepper/leapfrog_stepper/leapfrog_base.i) selects the LeapFrogStepper as the particle stepper.
(test/tests/userobjects/particle_stepper/boris_stepper/cyclotron_motion.i), (test/tests/userobjects/particle_stepper/boris_stepper/circular_e_field.i), and (test/tests/userobjects/particle_stepper/leapfrog_stepper/circular_e_field.i) set up the initial conditions for the particles and fields for each case.
To combine them into one input file when running the simulation, the !include feature within MOOSE is utilized.
To learn more about the !include feature, refer to the Input File Syntax page.