Magnetic field lines simulation

Iron filings sprinkled round a magnet are the classic way to see a magnetic field. This simulation computes the field properly, then shows it three ways: field lines traced through 3D space, a slice of iron filings, and particles flowing along the lines.

Interactive, free and runs in your browser. Part of the Electromagnetism simulations.

What you will see

Choose a dipole, bar magnet, solenoid or Halbach array. Glowing field lines run from north to south, with dashes flowing along them. A vertical slice through the magnet holds thousands of iron filings, each aligned with the local field, over contours of field strength. The Halbach array shows its one-sided field: strong above, nearly zero below.

Try this

  1. Compare the bar magnet with the solenoid: outside, their fields look almost the same.
  2. Look inside the solenoid and see how uniform the field is.
  3. Switch to the Halbach array and compare the field above and below.

Common misconception

Field lines do not stop at the poles of a real magnet. They continue through the magnet and form closed loops, because there are no magnetic monopoles: ∇·B = 0 everywhere.

Exam-style question

On the axis of a small magnetic dipole, how does the field strength change if you move twice as far away?

A dipole field falls off as 1/r³, so doubling the distance reduces the field to 1/2³ = 1/8 of its value.

Key equations

  • B = (μ₀/4π)[3(m·r̂)r̂ − m] / r³
  • ∇·B = 0
  • B_solenoid = μ₀ n I

Curriculum

AQA A-level physics 3.7.5, IB Physics D.3.

More electromagnetism simulations

Other topics