Drag on the sheet = use your tool (default: fire cells) · drag outside the sheet or pick "camera" to orbit · wheel = zoom · height = voltage · violet underneath = battery still recharging · rings/trails = spiral tips (red ↻, blue ↺) · frame flashes red during a global pulse
Play
Analogy
Dominoes that stand themselves back up. Nothing flows from one end of the heart to the other. Each cell is a
battery charged by ion pumps (sodium out, potassium in, about −85 mV inside). When a neighbour's charge leaks in
and pushes it past a threshold, sodium gates snap open and the cell fires . That pushes its own
neighbours over, and so on. Afterwards it needs time to recharge (violet ): during that
refractory rest it cannot fire again, like burnt forest that has to regrow before it can burn again.
That rest is why waves only move forward and why two waves that meet annihilate: each runs into the other's ashes.
It is also what makes spirals possible. If a wave front gets broken, its free end curls into tissue that has just recovered,
then keeps chasing its own tail. That's re-entry , the engine behind many dangerous arrhythmias.
The math
Aliev–Panfilov, the same equations as heart/sim.py:
∂u/∂t = D ∇²u ← charge leaks to neighbours (conduction)
− k·u(u−a)(u−1) ← the battery: below a → fall back; above a → shoot to 1
− u·v ← recovery pulls voltage down
∂v/∂t = (ε₀ + μ₁v/(u+μ₂))·(−v − k·u(u−a−1)) ← slow recharge = rest period
Conduction alone (first term) would just blur a spark until it vanished. The cubic term turns blur into a
travelling wave that keeps its full height, because every cell re-amplifies it. Units: 1 t.u. ≈ 12.9 ms, V = 100·u − 80 mV.
Scar cells are holes: no current crosses their border.
Spiral tips are phase singularities : around the tip, the angle θ = atan2(v − ½, u − ½) turns a full 2π,
like the hands of a clock. Only the tip itself has no defined phase. The sign of that turn is the spiral's
topological charge : −1 = clockwise ↻ , +1 = counter-clockwise ↺ .
Charge is conserved: tips are born in ± pairs (a figure-8) and can only vanish by meeting their opposite or by leaving through the edge.
The ECG is what a distant electrode sees: φ = Σ ∇u · ∇(1/r). Moving fronts, not resting cells, make the signal.
Gentle feedback pacing (Roshan & Majumder 2025)
Roshan & Majumder, Termination of figure-of-eight
reentry via resonant feedback pacing , Front. Netw. Physiol. 2025 (Fenton–Karma model, 768² grid).
Analogy: pushing a swing. A defibrillator is a huge shove: everything fires at once. Instead, one sensor listens at a
single spot, and each time a wave passes it, the device sends a weak pulse to the whole sheet, below what can fire
even one resting cell. Because the pulse always arrives at the same phase of the spiral's own rotation, the small pushes add up
(resonance) and the tip drifts . A lone spiral starts circling the sensor (a flower-shaped epicycloid). In a figure-8, the two
opposite tips either collide and cancel (+1 −1 = 0), or are pushed apart into the edges.
rule: u_sensor crosses 0.5 upward → I(t) = 0.66·I_threshold for 1 t.u. on every cell
model: ∂u/∂t = … + I(t)
Checked in node with this page's own model (figure-8 started with S2 at 45 t.u., pacing switched on at 5 s):
No pacing: still spinning after 46 s.
Timed by feedback (sensor in the centre or in any of the 4 quadrants): stopped in 2–4.4 s (8 pulses with the sensor in the centre). Energy ≈ 0.11, peak 66 % of threshold.
Same pulses, untimed (every 390 ms): the figure-8 is still spinning. The timing is the medicine, not the energy.
⚡ Defibrillate here = one pulse at 556 % of threshold: energy 2.0, about 18× more and 8× harder at peak.
A single spiral with the sensor in the centre is not killed: it orbits the sensor, as in the paper's Fig. 2C. Move the sensor off-centre and the orbit drags the tip into the edge.
4 spirals: feedback stopped them in 1.3 s. Honest caveat: untimed pulses also stopped them (3.3 s) in this small sheet.
The code
// one explicit-Euler step for one healthy cell i (core.js)
let lap = 0; // only living neighbours
if (tissue[i-1]) lap += u[i-1] - u[i]; // …same for i+1, i-n, i+n
du[i] = D/dx² * lap
- k * u[i] * (u[i]-a) * (u[i]-1) // the battery
- u[i] * v[i];
v[i] += dt * (eps0 + mu1*v[i]/(u[i]+mu2))
* (-v[i] - k*u[i]*(u[i]-a-1)); // recharge
u[i] += dt * du[i];
// feedback pacing (core.js FeedbackPacer), every step
if (mode === 'feedback' && prev < 0.5 && uSensor >= 0.5) until = t + 1.0;
prev = uSensor;
T.I = t < until ? 0.66 * 0.18 : 0; // 0.18 = whole-sheet firing threshold
energy += T.I * T.I * dt;
160×160 cells, dt = 0.04, about 0.2 ms per step in the browser.
Where this comes from
github.com/edgarmoreaualix/heart-waves : sim.py is the numpy original (200² grid, with fibrosis mask + pseudo-ECG). This page reproduces its numbers: spiral ≈ 138 bpm here vs 136 there.
Ethgar/cardiac-ep-2d : 2,000 runs of exactly these S1/S2 + scar experiments, in The Well format. Its labels ("sustained re-entry", vulnerable window 774–903 ms) are what you are triggering by hand.
Ethgar/walrus-heart : the Walrus physics foundation model fine-tuned to predict the next frame of this sheet. Its long rollouts break into stripes after ~0.5 s. Watch here how sharp the real fronts stay: that sharpness is what a model has to keep.
Try this
Make a spiral by hand. Turn the pacemaker off, then click near the left edge once. While the wave crosses the middle, drag a line right behind its violet tail. The new wave can only go one way, so its ends curl into two counter-rotating spirals (a figure-8).
Miss the window. Same, but draw your line far behind the tail (the sheet is dark again). It just makes a normal second wave. Draw it inside the tail: nothing happens, the cells are still recharging.
Feedback pacing. Press "Figure-8" and wait for the two tips (one red, one blue) to settle into circles. Then set pacing to timed by feedback . Watch the trails bend, the tips drift, and the figure-8 die after a handful of red flashes on the frame. Compare the energy meter with ⚡.
Is it the timing? Same figure-8, but untimed . Same pulses, same strength, and it keeps spinning.
Orbit the sensor. "Spiral ↻" + feedback with the cyan sensor in the middle: the trail turns into a flower around the sensor. Pick the probe tool and move the sensor near an edge: the spiral is dragged along and dies on the edge.
Strength. Push pulse strength past 100 %: each pulse now fires the whole sheet (a mini-shock). At 20 % nothing much happens: the swing needs pushes that are big enough.
Defibrillate. With spirals running, press ⚡. Every cell fires at once, so every cell is resting at once, and no wave has anywhere to go. Silence, then the pacemaker takes over again.
A loop around a scar. Press "Scar loop". A line is fired just below the scar, while the tissue on one side is still recharging, so the wave can only leave one way. It goes around the scar and keeps circling. No gold ring appears: the scar is the tip. The rate (≈ 68 bpm at the probe) is set by the loop's length, so a bigger scar gives a slower loop. This is how tachycardia after a heart attack works. ⚡ stops it. The timing window is only a few ms wide, so it's a preset, not something you can easily do by hand.
Fast battery. Raise ε₀: the rest gets shorter, the wave gets shorter, spirals get tighter and faster, and break up more easily.