AI Plasma Shape Control (Tokamak)

Hold an elongated tokamak plasma against its vertical instability with feedback on the poloidal coils: tune gains and lags, kick it, and see why the loop fails.

Switch to 2D

Presets

Playback

Parameters

Camera

Layers

Quality

Model check

The science

What is modelled

A tokamak holds a hot plasma in a doughnut-shaped magnetic cage. To fit more plasma into the same machine the cross-section is stretched upward (elongation kappa) and given a D-shape (triangularity delta). A stretched plasma sits at a saddle point of the external field: the slightest vertical offset grows exponentially unless coil currents push back within about a millisecond. This page models that vertical loop and three slower shape loops, and lets you tune the controller, the coil and sensor lags and the disturbances.

Equations

  • Boundary (Miller parametrisation): R = R0 + dR + a cos(θ + δ sin θ), Z = Z0 + a κ sin θ, swept round the torus. The 3D surface is built from exactly this curve.
  • Vertical motion of the plasma centre in units of the minor radius (z = Z/a): dz/dt = γ(κ) z + c with γ = g0 (κ−1)², where c is the velocity the coils impart.
  • Coils and sensor are first-order lags: τc dc/dt = −c + sat(−Kp zs − Kd (z − zs)/τs), τs dzs/dt = z − zs. Together with z this is a 3x3 linear system whose characteristic polynomial s³ + a2s² + a1s + a0 is built in the page; the loop is stable exactly when all ai > 0 and a2a1 > a0 (Routh-Hurwitz). Without a lag the condition reduces to Kp > γ.
  • Elongation, triangularity and radial position are stable-but-drifting modes: de/dt = −(1/τm + gs) e + noise with gs proportional to Kp.
  • Loss of control (a vertical displacement event) is declared when the plasma edge touches the vessel: |z| + κ = Hwall/a, so a higher elongation leaves less room.

Checks run in the page

  • A Runge-Kutta integration of the linear loop grows or decays at the rate of the largest eigenvalue of the 3x3 matrix.
  • With almost instantaneous coil and sensor the simulated rate approaches (γ − Kp).
  • The Routh-Hurwitz verdict and root finding agree on 300 random gain and lag settings.
  • The lowest stabilising Kp, found by bisection on simulations, equals γ.

Honest simplifications

The plasma is a rigid current ring with a one-pole vertical model; real machines add a resistive wall, plasma mass and several coupled modes, and the growth rate depends on the equilibrium and the wall time. The calibration g0 = 600 per second (gamma of a few hundred per second at kappa about 1.9) is illustrative of TCV-class machines, not a measurement. The control is a classic PD loop, the baseline that learned controllers such as the 2022 DeepMind and EPFL experiment on the TCV tokamak compare against; no learning happens here. The hall is a schematic Blender model, not a particular device. Time is stretched about a thousand times so you can watch it.

What to try

  • Choose Controller off: the offset grows with the e-folding time shown and the plasma hits the wall.
  • Raise elongation to 2.2 with the same gain: the pole moves to the right and the margin to the wall shrinks.
  • Set the coil lag to 3 ms: the same gains now fail because the coils cannot keep up with the instability.
  • Use Kick the plasma and watch the six poloidal coils glow as they answer.
Loading model...
Loading Blender model...
Plasma vertical position against time (cm) and the wall limit
Fastest closed-loop pole against proportional gain
Coil action and elongation error against time
Made with 🟠 Blender · Three.js