Bernoulli bond percolation on a square lattice
Channel: Nils Berglund
Date: 18/07/2022

This percolation simulation shows bond percolation on a square lattice, as opposed to site percolation, that is shown in the video https://youtu.be/9-yn6_2pu0Y . This means that all the action happens on the edges of a square lattice, like the dark lines on graph paper. The video is a variant of the old video https://youtu.be/cI_B9iqsB9E with larger lattices. In addition, there is a graph showing the proportion of flooded bonds (the number of flooded bonds divided by the number of open bonds, whether flooded or not). 
Percolation models describe the ability of a liquid to flow through a porous medium, such as oil flowing through certain types of rock, or water flowing through a coffee machine. See for instance the talk https://youtu.be/kNn81dGhFak given by Fields medalist Hugo Duminil-Copin at the ICM 2018 in Rio. 
In the model shown here, each bond (or edge) of the lattice is open with probability p, and closed with probability 1-p. Closed bonds are shown in yellow. Open bonds can be flooded (shown in dark blue), or not (shown in cyan). The flooded bonds are those of the left column, and those that can be reached from the left column by moving only through open bonds.
The simulation has six parts, featuring lattices of increasing size. 
31x60 grid: 0:00
62x120 grid: 0:32
124x240 grid: 1:05
248x480 grid: 1:38
496x960 grid: 2:11
992x1920 grid: 2:44
In each part, the probability p of sites being open increases smoothly from 0 to 1. The remarkable property of percolation models is that there is a rather sharp transition between cases where only very few sites are flooded, to cases where most of them are flooded. The transition becomes sharper as the size of the lattice increases. One can show that when the lattice size goes to infinity, the transition concentrates on a particular value pc of p, which depends on the type of lattice. For the square lattice shown here, the critical value of p is equal to 0.5, see https://en.wikipedia.org/wiki/Percolation_threshold . To make transitions more visible, in each part the increase of p is slowed down around this critical value. Of particular interest is the shape of the cluster of flooded cells when p is equal to pc, which has fractal properties. 
The reason why pc = 0.5 for this lattice can be understood intuitively as follows, assuming the simulated region is a square instead of an elongated rectangle. Define the dual lattice by rotating each bond by 90 degrees around its center. The dual lattice is a translated version of the original one, shifted by half the lattice spacing in the x and y directions. It is quite easy to see that there is a flooded path from left to right in the original lattice if, and only if, there is no flooded path from top to bottom in the dual lattice. This implies that the critical probability of the original lattice and of the dual one have sum 1. However, by symmetry, both critical probabilities have to be equal. Hence their common value is 0.5.
In each part of this simulation, all bonds are given random values between 0 and 1. These values are independent, and follow a uniform distribution. A bond becomes open when its value is smaller than the increasing parameter p. Then a variant of depth-first search algorithm is used to find all flooded bonds. 

Render time: 15 minutes 45 seconds
Color scheme: Parula, originally from Matlab
https://www.mathworks.com/help/matlab/ref/colormap.html

Music: "Yes You Can" by Silent Partner

Current version of the C code used to make these animations: 
https://github.com/nilsberglund-orleans/YouTube-simulations
https://www.idpoisson.fr/berglund/software.html

Some outreach articles on mathematics:
https://images.math.cnrs.fr/_Berglund-Nils-1343_.html
(in French, some with a Spanish translation)