Chapter 3 Full orbit particle simulation
3.2 The CUEBIT full orbit code
The numerical tool used throughout the present thesis is the CUEBIT (CUlham Energy-conserving orBIT) code [McClements et al., 2002; Hamilton et al., 2003], which solves the Lorentz force equation in arbitrary magnetic and electric fields. This code utilises an implicit, second order, finite difference scheme where the deriva-
forward differencing scheme. Here the derivative of a functionfpxq at a pointx is approximated by df dx fpx hq fpxq h (3.1)
whenh is small. Here his the spacing in the abscissa gridx.
In order to numerically solve for particle motion the Lorentz force equation this second order ordinary differential equation (ODE) is first rewritten as two first order ODEs: dv dt Ze mzr Epxq vBpxqs, (3.2a) dx dt v. (3.2b)
Applying the discretisation (3.1) to the above system of equations we have the integration scheme vi 1vi Ze∆t mz E xi 1 xi 2 vi 1 vi 2 B xi 1 xi 2 , (3.3a) xi 1xi ∆tv i 1 vi 2 . (3.3b)
to solve. Here the notation xn denotes the value of the quantity x at a time t t0 pn1q ∆t, with t0 the starting time of the simulation and ∆t the time step used to advance the simulation in time.
In the above integration scheme the electric and magnetic fields are evaluated at the averaged particle locationpxi 1 xiq{2. This scheme ensures that energy is conserved exactly in the absence of an electric field. This is clearly seen by taking the scalar product of (3.3a) withvi 1 vi.
It should be noted that the updated particle velocity,vi 1, appears both on the left- and right-hand side of (3.3). The above set of equations is therefore an
implicit integration scheme and is solved using an iterative approach:
1. an initial guess for vi 1 is made by setting xi 1 xi and solving (3.3a) for
vi 1;
2. a more accurate estimate ofxi 1 is then found by solving (3.3b), which is then used to obtain a more accurate value forvi 1;
3. this process continues until a suitable level of accuracy is reached. In practice, convergence is reached after approximately five iterations.
This numerical scheme is introduced and discussed in detail in McClements et al. [2002].
The time step in the CUEBIT code, ∆t, must be chosen such that the shortest time scales in the simulation are well resolved. In the case of a full orbit code the highest frequency is the particle gyro motion. This is one of the major limitations of the full orbit approach [Lee, 1983] and a price to be paid for adopting such a simple approach [Kazakov and Kononenko, 2012], since the frequency of the phenomenon of interest may be several orders of magnitude lower than the cyclotron frequency. However, since we are not solving self-consistently for the fields we can simulate transport time scales (of the order of seconds) with the full orbit approach.
Using the implicit scheme described above a time step of one-tenth of the gyro-period is reasonable (even larger time steps may be used if the background profiles, for example the magnetic field and bulk ion density and temperature, vary on length scales much larger than the particle Larmor radius). It should be noted that the Larmor period varies across the tokamak. Therefore, the step size is spec- ified relative to some reference location, generally taken to be the magnetic axis. By comparison with guiding centre codes, which solve the set of equations 2.63 and 2.64 and typically use a time step of approximately 1/25th of the particle bounce time, full orbit codes require over 50 times more computation time.
The CUEBIT algorithm described above and used throughout this thesis has excellent stability and energy conservation properties, as presently demonstrated. However, since this algorithm is implicit it is not the most efficient scheme available, since at each time step the equations of motion are solved multiple times for each iteration of the solution. A number of alternative explicit integration methods could be used instead, including the Boris rotation [Boris, 1970; Birdsall and Langdon, 1985] and standard explicit Runge-Kutta schemes. However, it has been found while evaluating these alternative schemes that the Boris rotation method does not conserve particle gyro-frequency: the gyration frequency is underestimated by a factor 1 pΩ∆tq2{12, with Ω the particle cyclotron frequency. We may correct for this by replacing the electric and magnetic fields by effective fields where we divide through by this factor. Then, automatically, the gyration frequency is more correctly tracked. Furthermore, energy conservation in the Runge-Kutta scheme is not explicit and numerical errors in the orbit integration will be visible as non-physical drifts of energy. This scheme therefore typically requires orbit corrections at each time step in order to achieve acceptable constancy of the appropriate conserved quantities. For example the ASCOT code [Kiviniemi et al., 2000; Heikkinen et al., 2001] adjusts the particle location computed by the solution of the guiding centre equations of motion
in order to match the energy, magnetic moment and toroidal canonical momentum of the particle at the previous time step to within some prescribed accuracy.
Ideally one would use an explicit variation symplectic integration scheme, similar to that used to solve for the guiding centre motion of particles by Qin et al. [2009], since such schemes are constructed in such a way to ensure that the discrete analogous of the conserved quantities derived in section 2.3 are conserved exactly (to machine precision). Qin et al. [2009] demonstrate the advantages of such schemes over non-variational Runge-Kutta methods. The construction of a variational sym- plectic integration scheme for the full orbit equations of motion in toroidal plasmas is an open area for future work.