← the lab

Magnetic Domains

A ferromagnetic material is a grid of tiny magnetic dipoles that want to align with their neighbors. Drag across the canvas to apply an external magnetic field. Watch domains form, grow, and merge. Raise the temperature and watch thermal noise disrupt the order.

Controls

15
8
12

Hysteresis loop

Info

Drag on canvas to apply field.
Cycle field sweeps the external field to trace a hysteresis loop.
Gold = Barkhausen jump (sudden domain flip).
Magnetization (M)
--
External field (H)
0.00
Energy
--
Barkhausen events
0

How it works

Each cell in the grid holds a magnetic dipole with a continuous angle θ. The system's energy has two terms: a coupling term that penalizes misalignment between neighbors (like the XY model), and an external field term that rewards alignment with an applied field H.

At each step, spins are updated using a Metropolis-like algorithm: a random perturbation is proposed, and accepted if it lowers the energy or passes a thermal probability check (Boltzmann factor). Low temperature means strong ordering; high temperature disrupts domains into paramagnetic chaos.

Hysteresis appears when the field cycles: magnetization lags behind the applied field, tracing an open loop. Barkhausen jumps are sudden, large changes in magnetization as domain walls snap between pinning sites — they produce audible clicks in real ferromagnets and appear as gold flashes here.