Skip to content
Tutorials Center
My learning

Topics

Lesson 45 of 49 · Projects and Practice

Project: a charged particle in electric and magnetic fields

Simulate an electron in crossed electric and magnetic fields with the Boris method, verify the cyclotron frequency and E×B drift, and explore gyroradii.

Every field equation you have studied ends in a force on a charge. The Lorentz force F = q(E + v × B) governs cathode-ray tubes, mass spectrometers, cyclotrons, the Van Allen belts and fusion plasmas. In this project you integrate it numerically with the Boris method, the standard workhorse of plasma simulation, and check the result against two analytic predictions: the cyclotron frequency and the E×B drift.

An electron path in crossed E and B fields: a cycloid made of circular gyration plus a steady drift perpendicular to both fields.
Crossed fields: the particle circles at the cyclotron frequency while the circle drifts at E/B in the direction of E×B.

What you will learn

  • State the cyclotron frequency, gyroradius and E×B drift velocity.
  • Implement the Boris pusher.
  • Check numerical results against analytic formulas.
  • Explain why the drift does not depend on charge or mass.

Key terms

Cyclotron (gyro) frequency ω_c = |q|B/m. Gyroradius r_L = m v_⊥/(|q|B). E×B drift v_d = E×B/B². Boris pusher: half an electric kick, a rotation by the magnetic field, then another half kick. Guiding center: the center of the circular motion.

The physics

In a uniform magnetic field B the force is perpendicular to the velocity, so the speed is constant and the particle moves in a circle with

Text
ω_c = |q| B / m,      r_L = m v_⊥ / (|q| B),      T = 2π m / (|q| B)

For an electron in B = 1 mT, ω_c = 1.76 × 10⁸ rad/s and f = 28 MHz, independent of speed (non-relativistically).

Add a perpendicular electric field. In the frame moving at v_d = E×B/B² the electric field vanishes (Lorentz transformation, Chapter 8), so the particle circles around a guiding center that itself drifts at

Text
v_d = E × B / B²        magnitude E/B

The drift is the same for protons, electrons and heavy ions, in the same direction: it is a property of the fields, not of the particle. With E = 100 V/m and B = 1 mT, v_d = 10⁵ m/s, a tiny fraction of c, so a non-relativistic treatment is fine.

The Boris algorithm

Update the velocity in three steps each time step Δt:

  1. Half electric kick: v⁻ = v + (qΔt/2m) E.
  2. Rotation about B by angle θ = ω_c Δt (done with two cross products).
  3. Half electric kick: v⁺ = v' + (qΔt/2m) E; then x += v⁺ Δt.

The rotation preserves |v| exactly, so there is no artificial energy growth in a pure magnetic field.

"A magnetic field speeds up charged particles." A pure magnetic field does no work: it changes direction, not speed.

"The drift direction reverses for negative charges." E×B drift is the same for all charges; it is the gyration sense that reverses.

"A smaller time step is always more accurate." True up to rounding, but Boris is stable and accurate with 20-ish steps per gyration; far fewer degrade the phase.

Deriving the drift in two ways

Force balance. A particle drifting at constant velocity feels no net force, so q(E + v_d × B) = 0. Take the cross product of E = −v_d × B with B: for v_d ⊥ B this gives E × B = −(v_d × B) × B = B² v_d, so v_d = E × B/B². The charge q and the mass m cancelled at the first step, which is why electrons, protons and heavy ions all drift together.

Frame change. In a frame moving at v_d = E/B (small compared with c) the electric field becomes E' = E + v_d × B = 0 by the transformation of Chapter 8. There the particle sees only a magnetic field and moves in a plain circle. Transforming back adds the uniform drift. The two derivations agree, and the second generalizes: when E approaches cB no such frame exists and the motion is completely different.

A worked case. For E = 100 V/m and B = 1.0 mT we get v_d = 100/10⁻³ = 1.0 × 10⁵ m/s. An electron released from rest has gyroradius r_L = v_d/ω_c = 10⁵ / 1.76 × 10⁸ = 0.57 mm, so its cycloid is 2 r_L = 1.14 mm tall. A proton released from rest in the same fields drifts at the same 10⁵ m/s, but its cycloid is about 2.09 m tall because it is 1836 times heavier: the same drift with a far bigger gyration.

Why the Boris method works

Jay Boris introduced the scheme around 1970 for plasma simulation, and it remains the default in particle-in-cell codes. Plain Euler or Runge-Kutta integrators slowly add or remove energy in a magnetic field, and over millions of gyrations the particle spirals out of the box. Boris splits the force. The electric field only changes the speed, so it is applied as two half kicks. The magnetic field only rotates the velocity, and the scheme rotates by an exact amount.

The rotation uses t = (qΔt/2m) B and s = 2t/(1 + t²). Writing Θ = ω_c Δt, the rotation angle per step is θ = 2 arctan(Θ/2), slightly smaller than Θ. The speed is therefore conserved to rounding error, and the only error is a small lag in phase that falls as Δt². The first TryIt below measures it: doubling the steps per gyration cuts the lag by four.

For fast particles the cyclotron frequency is ω_c = |q|B/(γ m). A 1 keV electron has v = 0.063 c, so γ − 1 ≈ 0.002 and the non-relativistic formula is fine. A 10 MeV electron has γ ≈ 20.6, and its gyration is twenty times slower than at low energy. This is why the cyclotrons of Ernest Lawrence in the 1930s stop working at high energy: the particles fall out of step with a fixed-frequency electric field.

Key numbers to remember

Quantity Electron in 1 mT Proton in 1 T
Cyclotron frequency f_c 28.0 MHz 15.2 MHz
Gyroradius at 2 × 10⁵ m/s 1.14 mm 2.09 mm

The proton radius follows from m v/(eB) = 1.673 × 10⁻²⁷ × 2 × 10⁵ / (1.602 × 10⁻¹⁹ × 1) = 2.09 mm. A 1 keV electron in Earth's field of about 5 × 10⁻⁵ T has a gyroradius of 2.1 m; in a 1 T magnet it is only 107 μm.

"The drift is a current driven by the electric field." Electrons and ions drift the same way, so the drift alone carries no net charge flow. "A magnetic field changes the speed each gyration." The speed is constant in a pure magnetic field; only the direction changes. "The path in crossed fields is a circle." It is a cycloid when the particle starts at rest.

Try it

Python Boris pusher: cycloid in crossed fields

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Cyclotron frequencies and gyroradii

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Convergence: how many steps per gyration?

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Electron, proton and alpha in the same crossed fields

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Extension exercises

  1. Parallel fields. Add E = (0, 0, 50) V/m along B. Predict the motion (a helix whose pitch grows as the particle speeds up along z), then check that the gyroradius stays constant.
  2. Non-uniform field. Let B_z grow by 5% over the orbit. The magnetic moment μ = m v_⊥²/2B should be nearly conserved, so v_⊥ grows as √B. Test this adiabatic invariant; it is the basis of the magnetic mirror that traps particles in the Van Allen belts.
  3. Wrong integrator. Replace the rotation with a plain Euler step v += (q/m)(E + v × B) Δt and plot the speed against time. You will see the artificial growth Boris prevents.

What to look for. In the first exercise the orbit radius does not change, because only the speed along B grows. In the third, the Euler error grows with every gyration, so a short run can look fine and a long one is completely wrong.

Check your understanding

Quick check · 6 questions

of 6 answered You scored / 6 · perfect!

  1. 1. A proton and an electron are in the same uniform B field. Which has the larger cyclotron frequency?

    ω_c = |q|B/m and the electron is about 1836 times lighter.
  2. 2. In crossed fields E = 200 V/m and B = 0.5 mT, the drift speed is

    v_d = E/B = 200 / 5 × 10⁻⁴ = 4 × 10⁵ m/s.
  3. 3. Which part of the Boris scheme conserves the speed in a pure magnetic field?

    The rotation uses vectors that preserve |v| exactly.
  4. 4. Which quantity does the E×B drift velocity depend on?

    It is the velocity of the frame in which E vanishes: E×B/B².
  5. 5. Why is the Boris rotation preferred over a plain Euler step in a magnetic field?

    Euler adds a small amount of energy at every step; the Boris rotation only turns the velocity.
  6. 6. A proton and an electron start from rest in the same crossed E and B. How do the drift velocities compare?

    q and m cancel in the force balance, so the drift is a property of the fields.

Summary

  • Gyration: ω_c = |q|B/m, r_L = m v_⊥/(|q|B).
  • Crossed fields add a drift E×B/B² the same for all charges.
  • The Boris pusher respects the exact rotation of velocity and is stable for long runs.

Next: Practice problems