# Numerical simulation of particle in magnetic field

I'm interesting in numerically simulating (with my own code, not an off-the-shelf package) the motion of a single electrically charged particle in a magnetic field. The field will vary in time and space but probably not fast compared to the cyclotron frequency or the Larmor radius.

There are many well known methods for integrating equations of motion for particles in fields. But the force due to the magnetic field has some special properties such as not changing the kinetic energy of the particle. Are there some numerical procedures that are better adapted to this special case eg. that will give a more accurate simulation and better conserve adiabatic invariants (when they should be conserved)?

-

## migrated from physics.stackexchange.comFeb 26 '13 at 0:05

This question came from our site for active researchers, academics and students of physics.

Hi sigfpe, and welcome to Scicomp! Do you have a specific set of equations that you're working with? If so, could you include them in your question or perhaps a link to the equations? – Paul Feb 26 '13 at 4:38

I believe what you are looking for is a sympletic method; see:

http://en.wikipedia.org/wiki/Symplectic_integrator

They are designed to conserve energy exactly; however by trading up for accuracy one area, your simulation will have greater errors in other quantities (i.e. position as a function of time) compared to your usual Runge-Kutta methods.

-
Looking it some of the references to that wikipedia page I see that this is exactly what I'm after. – sigfpe Feb 26 '13 at 15:28
@jeffdk I got curious about what said "have greater errors in position as a function of time". Could you point me to an example? – Hui Zhang Apr 11 '13 at 17:24

Further research eventually yielded the Boris method. For a constant B field it produces stable circular orbits.

-