🧲 Ising Model — Phase Transition
Interactive 2D Ising model with Metropolis Monte Carlo. Tune temperature through the critical point Tc ≈ 2.269 and watch ferromagnetic order spontaneously emerge. Live magnetisation, energy, susceptibility and the M(T) curve.
About this simulation
This simulation runs the same 2D Ising ferromagnet as its sibling simulation, but adds a second, distinguishing feature: a live magnetisation-vs-temperature curve that plots your simulated data alongside Onsager's exact 1944 analytical solution for the infinite 2D lattice, m(T) for T < Tc. Each Monte Carlo sweep flips spins with the Metropolis rule min(1, e−ΔE/kBT), where ΔE = 2Jsi(Σⱼsⱼ + H) is the energy cost of flipping spin i given its four neighbours and an external field H. Watching the simulated points converge onto the exact Onsager curve as lattice size grows is a direct, visual demonstration of one of the most celebrated results in statistical mechanics.
🔬 What it shows
A live spin lattice (blue = up, orange = down) next to a magnetisation-temperature plot that overlays your running simulation against the theoretical exact Onsager curve. Below Tc ≈ 2.269 J/kB the two should track closely (finite-size effects cause small deviations); near Tc the susceptibility spikes and the domain pattern shows scale-free critical opalescence.
🎮 How to use
Drag the Temperature slider slowly through 2.269 to watch order collapse, or jump straight there with the "At Tc" preset. External field H breaks the up-down symmetry and removes the sharp transition; Lattice size N trades resolution for sharper, more exact-looking transitions; Sweeps/frame controls simulation speed. Randomise or Align buttons reset the lattice instantly, and Pause freezes the animation for inspection.
💡 Did you know?
Lars Onsager's 1944 exact solution gives the spontaneous magnetisation below Tc as m = [1 − sinh−4(2J/kBT)]1/8 — a closed-form result achieved decades before anyone could numerically simulate the model, and still considered one of the most remarkable exact calculations in all of physics.
Frequently asked questions
What is Onsager's exact solution and why is it significant?
In 1944, Lars Onsager derived a closed-form expression for the free energy and spontaneous magnetisation of the infinite 2D Ising model with no external field, proving rigorously that a genuine phase transition occurs at Tc = 2J/(kB·ln(1+√2)) ≈ 2.2692 J/kB. It remains one of the very few exactly solved interacting many-body models in statistical mechanics, and this simulation plots that exact curve directly against live Monte Carlo data so you can see the theory and simulation agree.
Why doesn't my simulated magnetisation curve match the exact Onsager curve perfectly?
The Onsager solution is exact only in the thermodynamic limit of an infinite lattice. Any finite simulated lattice (even 200×200) shows finite-size effects: rounded transitions instead of a sharp kink, residual magnetisation slightly above zero above Tc, and statistical noise from the limited number of Monte Carlo sweeps. Increasing the Lattice size slider visibly sharpens the simulated curve toward the exact theoretical one.
What is the Metropolis algorithm doing at each step?
A random spin is selected and the energy change ΔE from flipping it is computed using only its four nearest neighbours and the external field H. If ΔE ≤ 0 the flip is always accepted since it lowers total energy; if ΔE > 0 it is accepted with probability exp(−ΔE/kBT). Repeating this across the whole lattice many times (one "sweep" per N² attempts) drives the system toward thermal equilibrium at temperature T.
Why does the susceptibility spike so sharply near Tc?
Susceptibility χ = N²(⟨m²⟩ − ⟨m⟩²)/kBT quantifies how strongly the system's magnetisation fluctuates. Exactly at Tc, spin correlations extend across the entire lattice, so even small thermal kicks produce large collective magnetisation swings, and χ diverges in the infinite-lattice limit as |T − Tc|^(−7/4). In a finite simulated lattice this shows up as a tall, finite peak rather than a true mathematical divergence.
What happens if I turn on the external field H?
A nonzero H energetically favours one spin orientation over the other, breaking the symmetry that makes the H = 0 transition sharp. With H ≠ 0, magnetisation varies smoothly with temperature and there is no true discontinuity in derivatives of the free energy — the sharp second-order transition exists only exactly along the H = 0 line, ending at the critical point (Tc, 0).
2D Ising model with Metropolis Monte Carlo. Cross the critical temperature Tc ≈ 2.269 and watch ferromagnetic order spontaneously emerge. Live magnetisation, energy, susceptibility and the M(T) curve against the exact Onsager solution.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install