Cluster size distribution for Bernoulli site percolation on a honeycomb lattice
Channel: Nils Berglund
Date: 2022-08-12

This variant of the video https://youtu.be/vdyborErvjs also shows all clusters for percolation on a hexagonal, or honeycomb lattice, but the clusters are now color-coded according to their size. Closed hexagons are shown in dark blue, while open clusters are shown in purple, pink, orange or yellow, depending on their size. The plot shows a histogram of cluster sizes: the x-axis shows cluster sizes on an adaptive scale, with 30 bins of equal range. The y-axis shows the number of clusters having a size in the corresponding bin, on a logarithmic scale, which also adapts to the cluster distribution.
One striking feature is then when the probability p of a hexagon being open is smaller than 0.5, there are many clusters, and they are all quite small. When p exceeds 0.5, one giant cluster emerges, which gradually absorbs the smaller clusters. The picture looks most interesting when p is close to 0.5, and there are clusters of many different sizes.   
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. The relatively simple model shown here is called Bernoulli site percolation on a hexagonal lattice. Each hexagon is open with probability p, and closed with probability 1-p. Closed hexagons are shown in dark blue. Open hexagons are shown in colors ranging from yellow to purple, where all hexagons in a given cluster (meaning one can move smoothly between open hexagons) are shown in the same color. 
The simulation has seven parts, featuring lattices of increasing size. 
29*17 grid: 0:00
59x35 grid: 0:35
119x71 grid: 1:12
239x143 grid: 1:47
479x286 grid: 2:22
959x572 grid: 2:58
1919x1145 grid: 3:33
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 from cases where there are only small clusters, to cases where there is one large cluster. 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 hexagonal 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. 
In each part of this simulation, all sites are given random values between 0 and 1. These values are independent, and follow a uniform distribution. A site 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 clusters. This algorithm has been improved compared to previous percolation videos, which saves about 40% in computation time. 

Render time: 34 minutes 4 seconds
Color scheme: Inferno by Nathaniel J. Smith and Stefan van der Walt
https://github.com/BIDS/colormap

Music: "Selfie Stick" by Quincas Moreira@QuincasMoreira

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)