Home▸Articles▸Electromagnetism

Magnetic Dipole Field-Line Tracer (2D): Visualizing Magnetic Fields

A powerful tool for understanding how magnetic fields behave around multiple bar magnets.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What Magnetic Dipole Field-Line Tracer Is

The 2D magnetic dipole field-line tracer is an interactive simulation that allows users to visualize the magnetic fields generated by one or more bar magnets. By placing, aligning, and adjusting the strength of these magnets, you can observe how their magnetic fields interact with each other and change over space.

This tool uses numerical integration to trace the field lines, which are curves that represent the direction of the magnetic field at every point in space. The density of these lines indicates the strength of the field; denser regions show stronger fields.

Why It Matters

Understanding magnetic dipole fields is crucial for a wide range of applications, from designing electric motors and generators to studying planetary magnetospheres. The ability to visualize these fields helps in predicting the behavior of charged particles in complex magnetic environments.

Moreover, this simulation aids in teaching fundamental concepts of electromagnetism, such as how magnetic field lines form around dipoles and how they interact with each other.

live demo · related simulation● LIVE

How It Works

The tracer works by numerically integrating the B(r,θ) ∝ (2cosθ, sinθ)/r³ formula to trace field lines. This formula describes the magnetic dipole field in two dimensions, where r is the distance from the magnet and θ is the angle relative to the magnet's axis.

By adjusting parameters such as the number of magnets, their strength, alignment, and position, you can observe how these changes affect the overall field topology. The line density reflects the magnetic field strength, with denser lines indicating stronger fields.

Real-World Applications

The principles demonstrated in this tracer are applied in various technologies, such as MRI machines, which rely on strong and precise magnetic fields to image body tissues. In addition, understanding these concepts is essential for designing efficient electric motors and generators.

Planetary scientists also use similar models to study the magnetospheres of planets like Jupiter and Saturn, where complex interactions between multiple magnetic dipoles play a significant role.

Frequently asked questions

How do I change the number of magnets in the simulation?

You can adjust the magnet count by dragging the corresponding slider on the control panel. This action places or removes bar magnets from the 2D plane.

What does the field-strength coloring represent?

The field-strength coloring visually indicates the strength of the magnetic field at different points in space, with colors typically representing higher intensity fields more prominently.

Can I move a magnet once it's placed?

Yes, you can drag any magnet within the canvas to reposition it. This allows you to explore how changing the position of magnets affects their combined magnetic field.

Why is the formula B(r,θ) ∝ (2cosθ, sinθ)/r³ used?

This formula accurately describes the magnetic dipole field in two dimensions. It captures the essential features of how the field strength and direction vary with distance and angle relative to the magnet's axis.

Try it live

Everything above runs in your browser — open Magnetic Dipole Field-Line Tracer (2D) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Magnetic Dipole Field-Line Tracer (2D) simulation

What did you find?

Add reproduction steps (optional)