Loading the engineShared by all simulations, so the next one opens instantly.
The physics

William Kermack and Anderson McKendrick wrote down the SIR model in 1927: a population split into susceptible, infectious and recovered people, with infection passed on by contact and recovery giving lasting immunity. Their equations assume that everybody meets everybody. Here the population sits on a lattice and infection only passes between neighbours, which changes the answer qualitatively. The epidemic spreads as a front, infected regions run out of susceptible neighbours long before the population as a whole does, and whether an outbreak takes off is decided by a percolation threshold rather than by the reproduction number R0>1. Peter Grassberger made this link between spatial epidemics and percolation precise in 1983.

What you see

A 200 by 200 grid whose edges wrap around. Dark blue cells are susceptible, red cells are infectious, and dark green cells have recovered and are immune. Each run starts with a disc of 81 infectious cells (radius 5) in the centre of an otherwise susceptible grid. The panel shows the fraction of cells that are currently infectious and the entropy of the grid.

Above the threshold the infection spreads as a roughly circular ring: a band of red cells with recovered cells behind it and untouched cells ahead. The ring reaches the edges, its two sides meet across the wrapped borders and annihilate, because recovered cells cannot be infected again, and the epidemic ends when the last infectious cell recovers. Close to the threshold the front breaks up into fingers, and islands of susceptible cells survive behind it.

Rule

Each step updates all cells at once:

  • a susceptible cell with n infectious cells among its eight neighbours becomes infectious with probability 1−(1−β)n, as if each infectious neighbour transmitted independently with probability β,
  • an infectious cell recovers with probability γ,
  • a recovered cell stays recovered.

A cell stays infectious for 1/γ steps on average, so the mean-field reproduction number is R0=8β/γ. On the lattice the relevant quantity is the transmissibility, the probability that an infectious cell infects a given susceptible neighbour before it recovers:

T=ββ+γ−βγ.

An outbreak grows without bound only if T exceeds a critical value, close to the bond percolation threshold of the square lattice with eight neighbours (about 0.25). In these runs it lies between 0.27 and 0.30.

Presets

All presets use the same initial disc; times are at 60 frames per second and one step per frame.

Fast epidemic: β=0.10, γ=0.02, also the default (R0=40, T=0.85). The ring moves outward at about 0.5 cells per step. At the peak, after about 215 steps (3.6 seconds), 29% of the cells are infectious at once, and after 700 to 900 steps every cell has been infected.

Slow epidemic: β=0.04, γ=0.05 (R0=6.4, T=0.45). The front moves at about 0.2 cells per step and is thinner: the infectious fraction peaks at 5% after about 500 steps. About 1% of the cells are never infected.

Near the threshold: β=0.029, γ=0.07 (R0=3.3, T=0.30). The front creeps forward at about 0.05 cells per step along branching paths, never more than about 2% of the cells are infectious at once, and the outbreak lasts 2000 to 4000 steps. About 22% of the cells are never infected.

Dies out: β=0.02, γ=0.08 (R0=2, T=0.20). Below the threshold the infection fizzles out within about 150 steps, after a few hundred cells in total. A well-mixed population with the same R0=2 would end with 80% of its members infected.

Parameters

Transmission probability β: the chance per step that one infectious neighbour infects a susceptible cell, 0.01 to 0.40.

Recovery probability γ: the chance per step that an infectious cell recovers, 0.001 to 0.10. Its inverse is the mean infectious period in steps.

Both apply immediately to the running epidemic. Reset starts again from the central disc.