The evolution equation of orbit and weight can be generally written as
| (118) |
| (119) |
where H1 and H2 are known function. Note that E, as well as r and v, depends on time t. However E is not specified as an evolution equation. Instead, E is determined by a field equation, namely Poisson’s equation.
The classical 4th Runge-Kutta time integrator requires four evaluations of the function appearing on the right-hand side of the equation of motion per time step. In PIC method, this corresponds to that the field equation needs to be solved for four times. For large-scale simulation (e.g. spatial three-dimension simulation), solving the field equation is usually time-consuming. Considering this, lower order Runge-Kutta (e.g. 2nd order), which requires fewer times of evaluation of functions (and thus fewer times of solving the field equation) may be preferred in practice.
We use the 2nd Runge-Kutta method to integrate orbit and weight of markers. In this method, r, v, and w are first integrated from tn to the half time-step tn+1∕2 using (rn,vn,En) to evaluate the right-hand side of Eqs. (118) and (119). Then we solve the Poisson’s equation at tn+1∕2 to obtain En+1∕2 using the already obtained values of (rn+1∕2,vn+1∕2,wn+1∕2). After En+1∕2 is obtained, r, v, and w are integrated from tn to tn+1 by using the values at the half time-step, namely (rn+1∕2,vn+1∕2,wn+1∕2,En+1∕2). Forgetting to solve the field equation at tn+1∕2 to get En+1∕2 is one of the mistakes I made during writing the code. Forgetting to do this means that I am still using En, instead of En+1∕2, in taking the full step from tn to tn+1, which amounts to the (inaccurate and thus may be unstable) Euler scheme.
[Besides, the leapfrog scheme (2nd order accuracy) is often adopted to integrate the equations of motion. This scheme is given by
| (120) |
| (121) |
where ai = ai(xi) is the acceleration of the particle at the time step i. The leapfrog scheme given by Eqs. (121) and (120) can be equivalently written as[6]
| (122) |
| (123) |
The leapfrog scheme given by Eqs. (122) and (123) was implemented in my code, but was not tested seriously (I usually used the 2n Runge-Kutta method discussed above). Note that, for electrostatic case, a(i+1) is independent of v(i+1) and depends only on x(i+1), which is already obtained by Eq. (122). Thus the scheme given by Eqs. (122) and (123) is still an explicit scheme.]