Skip to content

๐Ÿ”ฅ Phase Transition Explorer โ€“ 2D Ising Model

This simulation demonstrates the most fundamental phenomenon in statistical physics: a phase transition between order and disorder.


๐Ÿง  Idea

A 2D lattice of magnetic spins (each +1 or โˆ’1) interacts with its nearest neighbours. The Hamiltonian is:

H = โˆ’J ฮฃ s_i ยท s_j       (J = 1, sum over nearest neighbours)

At low temperature, spins align spontaneously (ferromagnetic order, |M| โ‰ˆ 1). At high temperature, thermal noise destroys correlations (disorder, |M| โ‰ˆ 0).

The transition happens sharply at the Onsager critical temperature:

T_c = 2 / ln(1 + โˆš2) โ‰ˆ 2.269

Why this matters for the repository

Concept Connection
Edge of Chaos At T_c, correlations diverge โ€” the system is maximally sensitive and complex
Repo Axiom 2 H(X) is neither 0 (frozen) nor maximal (noise) โ€” life happens at the edge
Self-Organized Criticality The Ising model shows why criticality is special; SOC shows how systems reach it
System Intelligence Near T_c: P (prediction) is maximal, R (regulation) is fragile, A (adaptation) peaks

๐ŸŽฎ Controls

Key Action
โ† / โ†’ Decrease / increase temperature by 0.1
r Reset the spin grid
ESC Exit

๐Ÿ“Š What You See

The display shows four panels:

  1. Spin grid โ€” Red/blue for ยฑ1 spins. Watch domains form and dissolve.
  2. Magnetisation |M| โ€” Order parameter. Drops from ~1 to ~0 at T_c.
  3. Energy per spin โ€” Rises from ~โˆ’2 (ordered) towards 0 (disordered).
  4. Phase diagram โ€” Your current (T, |M|) overlaid on Onsager's exact solution.
  5. Energy fluctuations โ€” Proxy for specific heat C_v. Peaks at T_c.

โ–ถ Run

cd simulation-models/phase-transition-explorer
python3 phase-transition-explorer.py

Experiment ideas

  • Start at T = 0.5 (deep order) and slowly sweep to T = 4.0 โ€” watch the transition
  • Start above T_c and cool down โ€” observe spontaneous symmetry breaking
  • Stay at T_c and watch scale-free fluctuations (large correlated domains appear and disappear)
  • Reset the grid at T_c and watch how long it takes to reach equilibrium (critical slowing down)