Electromagnetic Particles

physicsplasmaelectromagnetismwasm

Loading simulation...

Planetary Magnetosphere

Earth's magnetic field acts like a giant dipole. Charged particles from the solar wind get trapped in this field, creating the Van Allen radiation belts. The particles undergo three simultaneous motions: fast gyration around field lines, slower bouncing between mirror points, and very slow drift around Earth.

Key Equations:
B_dipole ∝ 1/r³
Drift: B × ∇B
Three types of motion: gyration, bounce, drift
FPS: 0
Frame Time: 0.00ms
Particles: 5,000
Energy: 0

Click and drag to inject particles with velocity

• Cyan = electrons (light, fast gyration)

• Magenta = protons (heavy, slow gyration)

• Gold = alpha particles (very heavy)

About This Simulation

This simulation demonstrates charged particle motion in electromagnetic fields using the Boris integrator, a second-order accurate, energy-conserving algorithm that’s the standard in computational plasma physics.

What You’re Seeing

  • Cyan particles = Electrons (light, fast gyration)
  • Magenta particles = Protons (heavy, slow gyration)
  • Gold particles = Alpha particles (very heavy, slow gyration)

Particles spiral in the magnetic field at their cyclotron frequency: ω = qB/m

The radius of their circular motion is the Larmor radius: r = m v_⊥ / (|q| B)

How to Use

  1. Select field type: Uniform B field, magnetic dipole, or none
  2. Adjust field strength: Use sliders to change E and B fields
  3. Choose particle species: Select electron, proton, or alpha
  4. Click and drag: Inject particles with velocity from mouse movement

Physics Highlights

Energy Conservation: The Boris integrator maintains < 0.1% energy drift even after 10,000 timesteps in this demo.

Mass Matters: Notice how protons (1836× heavier than electrons) gyrate much more slowly in the same field.

Dipole Field: Simulates Earth’s magnetosphere - particles get trapped in the magnetic bottle!


Read the full technical article →

Performance: 100,000 particles @ 60 FPS. Built with Rust + WebAssembly.