In this chapter we motivate the study of disordered media through the example of a porous system. The basic terms in percolation theory are introduced, and you learn how to generate, visualize and measure on percolation systems in Python. We demonstrate how to find exact results for small systems in two dimensions by addressing all configurations of the system, and show that this approach becomes unfeasible for large system sizes.

Percolation is the study of connectivity of random media and of other properties of connected subsets of random media [8, 30, 37]. Figure 1.1 illustrates a porous material—a material with holes, pores, of various sizes. This is an example of a random material with built-in disorder. In this book, we will address the physical properties of such media, develop the underlying mathematical theory and the computational and statistical methods needed to discuss the physical properties of random media. In order to do that, we will develop a simplified model system, a model porous medium, for which we can develop a well-founded mathematical theory, and then afterwards we can apply this model to realistic random systems.

Fig. 1.1
A 3-D graph presents a cubical sample of a porous material. The porous material consists of regions with and without material. The colored regions in the sample denote the pores.

Illustration of a porous material from a simulation of nanoporous silicate (SiO\({ }_2\)). The colors inside the pores illustrates the distance to the nearest part of the solid

FormalPara A Porous Medium as a Model of a Disordered Material

The porous medium illustrated in the figure serves as a useful, fundamental model for random media in general. What characterizes the porous material in Fig. 1.1? The porous material consists of regions with and without material. It is therefore an extreme, binary version of a random medium. An actual physical porous material will be generated by some physical process, which will affect the properties of the porous medium in some way. For example, if the material is generated by sedimentary deposition, details of the deposition process may affect the shape and connectivity of the pores, or later fracturing may generate straight, open cracks in addition to more round pores. These features are always present in the complex geometries found in nature, and they will generate correlations in the randomness of the material. While these correlations can be addressed in detailed, specific studies of random materials, we will here instead start with a simpler class of materials—uncorrelated random, porous materials.

FormalPara A Simplified Model of a Porous Medium

We will here introduce a simplified model for a random porous material. We divide the material into cubes (3d) or squares (2d), called sites, of size d. Each site can be either filled or empty. We can use this method to characterize an actual porous medium, as illustrated in Fig. 1.1, or we can use it as a model for a random porous medium if we fill each site with a probability p. On average, the volume of the solid part of the material will be \(V:s=pV\), where V  is the volume of the system, and the volume of the pores will be \(V:p=(1-p)V\). We usually call the relative volume of the pores, the porosity, \(\phi =V_p/V\), of the material. The solid is called the matrix and the relative volume of the matrix, \(V:s/V\) is called the solid fraction, which is denoted by \(c = V_s/V\). In this case, we see that p corresponds to the solid fraction. Initially, we will assume that on the scale of lattice cells, the probabilities for sites to be filled are statistically independent—we will study an uncorrelated random medium.

FormalPara Generating a Random Medium in Python

Figure 1.2 illustrates a two-dimensional system of \(4 \times 4\) cells. The cells are filled with a probability p. We will call the filled cells occupied or set, and they are colored black. To generate such a matrix with first generate a matrix z with elements \(z:i\) that are uniform random numbers between 0 and 1. A given site i is set if \(z_i \le p\) and it is empty otherwise. This is implemented by

Fig. 1.2
2 illustrations. Left. A 4 cross 4 two-dimensional system. The random entries are 0.13, 0.94, 0.90, 0.55, 0.67, 0.30, 0.80, 0.94, 0.78, 0.56, 0.29, 0.88, 0.79, 0.02, 0.98, and 0.69. Right. 9 matrix for the p equal to 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, and 0.9.

Illustration of an array of \(4 \times 4\) random numbers, and the set sites for different values of p

The resulting matrices are shown in Fig. 1.2 for various values of p. The left figure illustrates the random values in the matrix, z, and the right figures the set sites for various values of p. You can think of this process as similar a to changing the water level in a landscape (\(z:i\)) and observing what parts of a landscape is below water (\(z_i \le p\)).

FormalPara Connectivity in a Random Medium

Percolation is the study of connectivity. The simplest question we can ask is: When does a path form from one side of the sample to the other? By when, we mean at what value of p. For the particular realizations of the matrix m in Fig. 1.2 we see that the answer depends on how we define connectivity. If we want to make a path along the set (black) sites from one side to another, we must decide on when two sites are connected. Here, we will typically use nearest neighbor connectivity: Two sites in a square (cubic) lattice are connected if they are nearest neighbors. In the square lattice in Fig. 1.2, each site has \(Z = 4\) nearest neighbors and \(Z=8\) next-nearest neighbors, where the number Z is called the coordination number. We see that with nearest-neighbor connectivity, we get a path from the bottom to the top when \(p = 0.7\), but with next-nearest neighbor connectivity we would get a path from the bottom to the top already at \(p = 0.4\). We call the value \(p:c\), the lowest value of p where we get a connected path from one side to another (from the top to the bottom, from the left to the right, or both) the percolation threshold. For a given realization of the matrix, there is well-defined value for \(p:c\), but another realization would give another realization of \(p:c\). We therefore need to either use statistical averages to characterize the properties of the percolation system, or we need to refer to a theoretical—thermodynamic—limit, such as the value for \(p:c\) in an infinitely large system. When we use \(p:c\) here, we will usually refer to the thermodynamic value.

In this book, we will develop theories describing various physical properties of the percolation system as a function of p. We will characterize the sizes of connected regions, the size of the region connecting one side to another, the size of the region that contributes to transport (fluid, thermal or electrical transport), and other geometrical properties of the system. Most of the features we study will be universal, that is, independent of many of the details of the system. From Fig. 1.2 we see that \(p:c\) depends on the details. For example, it depends on the definition of connectivity. It would also depend on the type of lattice used: square, triangular, hexagonal, etc. The value of \(p:c\) is specific. However, many other properties of the system are general. For example, how the conductivity of the porous medium depends on p near \(p:c\) does not depend on the type of lattice or the choice of connectivity rule. It is universal. This means that we can choose a system which is simple to study in order to gain intuition about the general features, and then apply that intuition to the special cases afterwards.

While the connectivity or type of lattice does not matter, some things do matter. For example, the dimensionality matters: The behavior of a percolation system is different in one, two and three dimensions. However, the most important changes in behavior occur between one and two dimensions, where the difference is dramatic, whereas the difference between two and three dimensions is more of a degree that we can easily handle. Actually, the percolation problem becomes simpler again in higher dimensions. In two dimensions, it is possible for a path to around a hole and still have connectivity. But it is not possible to have connectivity of both the pores and the solid in the same direction at the same time. This is possible in three dimensions: A two-dimensional creature would have problems with having a digestive tract, as it would divide the creature in two, but in three dimensions this is fully possible. Here, we will therefore focus on two and three-dimensional systems.

We will first address percolation in one and infinite dimensions, since we can solve the problems exactly in these cases. We will then address percolation in two dimensions, where there are no exact solutions. However, we will see that if we assume that the distribution of cluster sizes has a particular scaling form, we can still address the problem in two dimensions and make powerful predictions. We will also see that close to the percolation threshold the porous medium has a self-affine scaling structure—it is a fractal. This property has important consequences for the physical properties of random systems. We will also see how this is reflected in a systematic change of scales, a renormalization procedure, which is a general tool that can applied to rescaling in many areas.

1.1 Basic Concepts in Percolation

Let us start by studying a specific example of a random medium. We will generate an \(L \times L\) lattice of points, called sites, that are occupied with probability p. This corresponds to a coarse-grained porous medium with a porosity \(\phi = p\), if we assume that the occupied sites are holes in the porous material and look at the connectivity of the pores in the material.

We can generate a realization of a square \(L \times L\) system in python using

The resulting matrix is illustrated in Fig. 1.3. However, this visualization does not provide us with any insight into the connectivity of the sites in this system. Let us instead analyze the connected regions in the system.

Fig. 1.3
2 parts. Left. A 10 cross 10 array has entries as 0, 1, 2, 3, 4, 5, 6, 7, and 8. Right. In a 10 cross 10 matrix the colors are used to indicate the clusters.

Illustration of the index array for a \(10 \times 10\) system for \(p = 0.45\)

Definitions

  • two sites are connected if they are nearest neighbors (there are 4 nearest neighbors on a square lattice)

  • a cluster is a set of connected sites

  • a cluster is spanning if it spans from one side to the opposite side

  • a cluster that is spanning is called the spanning cluster

  • a system is percolating if there is a spanning cluster in the system

Fortunately, there are built-in functions in python that finds connected regions in an image.Footnote 1 The function measurements.label finds clusters based on a given connectivity. For example, with a coordination number \(Z=4\), that is nearest neighbor connectivity, we find

This function returns the matrix lw, which for each site in the original array tells what cluster it belongs to. Clusters are numbered sequentially, and each cluster is given an index number. All the sites with the same index number belong to the same cluster. The resulting array is shown in Fig. 1.3, where the index number for each site is shown and a color is used to indicate the clusters. Notice that there is a distribution of cluster sizes, but no cluster is large enough to reach from one side to another, and as a result the system does not percolate.

In order to visualize the clusters effectively, we give the various clusters different colors.

Unfortunately, this colors the clusters gradually from the bottom up. This is a property of the underlying algorithm: Clusters are indexed starting from the top-left of the matrix (which is the bottom-left of the image). Hence, clusters that are close to each other will get similar colors and can therefore be difficult to discern unless we shuffle the colormap. We can fix this by shuffling the labeling:

The resulting image is shown to the right in Fig. 1.3. (Notice that in these figures we have reversed the ordering of the y-axis. Usually, the first row is in the top-left corner in your plots, but when we use the keyword lower the first row is in the bottom-left).

It may also be useful to color the clusters based on the size of the clusters, where size refers to the number of sites in a cluster. We can do this using

Let us now study the effect of p on the set of connected clusters. We vary the value of p for the same underlying random matrix, and plot the resulting images:

Figure 1.4 shows the clusters for a \(100 \times 100\) system for p ranging from \(0.2\) to \(0.7\) in steps of \(0.1\). We see that the clusters increase in size as p increases. At \(p = 0.6\) there is one large cluster spanning the entire region. We have a percolating cluster, and we call the cluster that spans the system the spanning cluster. The transition is very rapid from \(p = 0.5\) to \(p = 0.6\). We therefore look at this region in more detail in Fig. 1.5. We see that the size of the largest cluster increases rapidly as p reaches a value around \(0.6\), which corresponds to \(p:c\) for this system. At this point, the largest cluster spans the entire system. For the two-dimensional system illustrated here we know that in an infinite lattice the percolation threshold is \(p_c \simeq 0.5927\).

Fig. 1.4
6 clusters for a dot 100 cross 100 system present colored checkered patterns for p equal to 0.2, 0.3, 0.4, 0.5, 0.6, and 0.7. The clusters increase in size as the value of p increases.

Plot of the clusters in a \(100 \times 100\) system for various values of p

Fig. 1.5
6 plots of clusters for a100 cross 100 system present colored checkered patterns for p equal to 0.2, 0.3, 0.4, 0.5, 0.6, and 0.7. The clusters increase in size as the value of p increases.

Plot of the clusters in a \(100 \times 100\) system for various values of p

The aim of this book is to develop a theory to describe how this random porous medium behaves close to \(p:c\). We will characterize properties such as the density of the spanning cluster, the geometry of the spanning cluster, and the conductivity and elastic properties of the spanning cluster. We will address the distribution of cluster sizes and how various parts of the clusters are important for particular physical processes. We start by characterizing the behavior of the spanning cluster near \(p:c\).

1.2 Percolation Probability

When does the system percolate? When there exists a path connecting one side to another. This occurs at some value \(p=p:c\). However, in a finite system, like the system we simulated above, the value we find for \(p:c\) will vary with each realization. It may be slightly above or slightly below the \(p:c\) we find in an infinite sample. Later, we will develop a theory to understand how the effective \(p:c\) in a finite system varies from the thermodynamic \(p:c\). But already now we realize that as we perform different numerical experiments, we will measure various values of \(p:c\). We can characterize this behavior by introducing a probability \(\varPi (p,L)\):

Percolation Probability The percolation probability \(\varPi (p,L)\) is the probability for there to be a connected path from one side to another side as a function of p in a system of size L.

We can measure \(\varPi (p,L)\) in a finite sample of size \(L \times L\), by generating many random matrices. For each matrix, we perform a cluster analysis for a sequence of \(p:i\) values. For each \(p:i\) we find all the clusters. We then check if any of the clusters are present both on the left and on the right side of the lattice. In that case, they are spanning (We could also have included a test for clusters spanning from the top to the bottom, but this does not change the statistics significantly). In this case, there is a spanning cluster—the system percolates. We count how many times, \(N:i\), a system percolates for a given \(p:i\) and then divide by the total number of experiment, N, to estimate the probability for percolation for a given \(p:i\), \(\varPi (p_i,L) \simeq N_i/N\). We implement this as follows. First, we generate a sequence of 100 \(p:i\) values from \(0.35\) to \(1.0\):

Then we prepare an array for \(N:i\) with the same number of elements as \(p:i\):

We will generate \(N=1000\) samples:

We will then loop over all samples, and for each sample we generate a new random matrix. The for each value of \(p:i\) we perform the cluster analysis as we did above. We use the function measurements.label to label the clusters. Then we find the intersection between the labels on the left and the right side of the system and store in perc_x. If the length of the set of intersections is larger than zero, there is at least one percolating cluster, and we find the label of the spanning cluster(s) in perc:

Now, we are ready to implement this into a complete program. For a given value of p, we count in how many simulations \(N:p(p)\) there is a path spanning from one side to another and estimate \(\bar {\varPi }(p) \simeq N_p(p)/N\), where N is the total number of simulations/samples. This is implemented in the following program:

The resulting plot of \(\varPi (p,L)\) is seen in Fig. 1.6. The figure shows the resulting plots as a function of system size L. We see that as the system size increases, \(\varPi (p,L)\) approaches a step function at \(p = p_c\).

Fig. 1.6
Two multiline graphs. Top. Pi of p comma L versus p graphs. Bottom. P of P comma L versus P graph. Both graphs depict S-shaped curves for L equal to 50, 100, and 200.

Plot of \(\varPi (p,L)\), the probability for there to be a connected path from one side to anther, as a function of p for various system sizes L, and \(P(p,L)\), the density of the spanning cluster

1.3 Spanning Cluster

The probability \(\varPi (p,L)\) describes the probability for there to be a spanning cluster, but what about the spanning cluster itself, how can we characterize it? We see from Fig. 1.4 that the spanning cluster grows quickly around \(p=p:c\). Let us therefore characterize the cluster by its size, \(M:S\), or by its density, \(P(p,L) = M_S/L^2\), which corresponds to the probability for a site to belong the spanning cluster.

Density of the Spanning Cluster The probability \(P(p,L)\) for a site to belong to a spanning cluster is called the density of the spanning cluster.

We can measure \(P(p,L)\) by counting the mass \(M:i\) of the spanning cluster as a function of \(p:i\) for various values of \(p:i\). We can find the mass of the spanning cluster by finding a cluster that spans the system (there may be more than one) as we did above, and then measure the number of sites in the cluster using area = measurements.sum(m, lw, perc).

We do this in the same program as we developed above. For each \(p:i\), we see if a cluster is spanning from one side to another, and if it is, we add the mass of this cluster to \(M_S(p_i)\). We implement these features in the following program, which measures both \(\varPi (p,L)\) and \(P(p,L)\) for a given value of L:

The resulting plot of \(P(p,L)\) is shown in the bottom of Fig. 1.6. We see that \(P(p,L)\) changes rapidly around \(p = p_c\), and that it grows slowly—approximately linearly—as \(p \rightarrow 1\). We can understand this linear behavior: When p is near 1 practically all the set sites are connected and are part of the spanning cluster. In this limit, the density of the spanning cluster is therefore proportional to the number of sites that are present, which again is proportional to p. We will now develop a theory for the observations of \(\varPi (p,L)\), \(P(p,L)\) and other features of the percolation system. First, we see what insights we can gain from small, finite systems.

1.4 Percolation in Small Systems

First, we will address the two-dimensional system directly. We will study a \(L \times L\) system, and the various physical properties of it. We will start with \(L = 1\) and \(L=2\) and then try to generalize.

\(L=1\)

First, let us address \(L = 1\). In this case, the system percolates if the site is present, which has a probability p. The percolation probability is therefore \(\varPi (p,1) = p\). Similarly, the probability for a site to belong to the spanning cluster is p and therefore \(P(p,1) = p\).

\(L=2\)

Then, let us examine \(L=2\). This is still simple, but we now have to develop a more advanced strategy than for \(L = 1\). Our strategy will be to list all possible outcomes, find the probability for each outcome, and then use this to find the probability for the various physical properties we are interested in. The possible configurations are shown in Fig. 1.7.

Fig. 1.7
A 2-part illustration. Top. 16, 2 cross 2 arrays for C = 1 to c = 16. Bottom. 2 cross 2 arrays for k = 1 and g 1 = 1, k = 2 and g 2 = 4, k = 3 and g 3 = 4, k = 4 and g 4 = 2, k = 5 and g 5 = 4, and g 6= 6 and g 6 = 1.

The possible configurations for a \(L=2\) site percolation lattice in two-dimensions. The configurations are indexed using the cluster configuration number c

Our plan is to use a basic result from probability theory: If we want to calculate the probability of an event A, we can do this by summing the probability of A given B multiplied by the probability for B over all possible outcomes B (as long as the set of outcomes B span the space of all outcomes and are mutually exclusive, that is, that they have no intersection). In this case:

$$\displaystyle \begin{aligned} P(A) = \sum_{B} P(A|B)P(B) \; , \end{aligned} $$
(1.1)

where we have used the notation \(P(A|B)\) to denote the conditional probability of A given that B occurs. We can use this to calculate properties such as \(\varPi (p,L)\) and \(P(p,L)\) by summing over all possible configurations c of the system:

$$\displaystyle \begin{aligned} \varPi(p,L) = \sum_c \varPi(p,L|c) P(c) \; , \end{aligned} $$
(1.2)

where \(\varPi (p,L|c)\) is the value of \(\varPi \) for the particular configuration c, and \(P(c)\) is the probability of this configuration.

The configurations for \(L=2\) have been numbered from \(c=1\) to \(c=16\) in Fig. 1.7. However, configurations that are either mirror images or rotations of each other will have the same probability and the same physical properties since percolation can take place both in the x and the y directions. It is therefore only necessary to group the configurations into 6 different classes, k, as illustrated in the bottom of Fig. 1.7, but we then need to include the multiplicity, \(g:k\), for each class when we calculate probabilities. The probability \(\varPi (p,L)\) is then:

$$\displaystyle \begin{aligned} \varPi(p,L) = \sum_k g_k \varPi(p,L|k) P(k) \; . \end{aligned} $$
(1.3)

Table 1.1 lists the classes, the number of configurations in each class, the probability of one such configuration in a class, and the value of \(\varPi (p,L|k)\) for this class.

Table 1.1 List of classes, configurations in each class, and the probability of one such configuration

We should check that we have actually listed all possible configurations. In general, the number of configurations for an \(L \times L\) system is \(2^{L^2}\). The total number of configurations is \(1 + 4 + 2 +4 + 4 +1=16\), which is equal to \(2^4\) as it should. We have therefore included all the configurations.

We can then find the probability for \(\varPi \) by direct calculation of the sum:

$$\displaystyle \begin{aligned} \varPi &= 0 \cdot 1 \cdot p^0 (1-p)^4 + 0 \cdot 4 \cdot p^1 (1-p)^3 + 1 \cdot 4 \cdot p^2 (1-p)^2 \end{aligned} $$
(1.4)
$$\displaystyle \begin{aligned} &+ 0 \cdot 2 \cdot p^2 (1-p)^2 + 1 \cdot 4 \cdot p^3 (1-p)^1 + 1 \cdot 1 \cdot p^4 (1-p)^0 \; . \end{aligned} $$
(1.5)

The exact value for \(\varPi (p,L=2)\) is therefore:

$$\displaystyle \begin{aligned} \varPi(p,L=2) = 4 p^2 (1-p)^2 + 4 p^3 (1-p)^1 + p^4 (1-p)^0 \;, \end{aligned} $$
(1.6)

which we can simplify further if we want. The shape of \(\varPi (p,L)\) for \(L=1\), and \(L=2\) is shown in Fig. 1.8.

Fig. 1.8
Two multiline graphs. Top. A pi of P comma L versus P graph depicts a linear trend for L=1, and S-shaped trends for L equal to 2, 3, and 4. Bottom. A P of P comma L versus P graph depicts a linear trend for L=1, and gradually rising trends for L equal to 2, 3, and 4.

Plot of \(\varPi (p,L)\) for \(L=1\) and \(L=2\) as a function of p

Estimating \(p:c\)

We could characterize \(p = p_c\) as the number for which \(\varPi (p_c) = 1/2\). For \(L=1\), we then get \(\varPi (p_c) = p_c = 1/2\). And for \(L=2\), we find \(4 p_c^2 (1-p_c)^2 + 4 p_c^3 (1-p_c)^1 + p_c^4 (1-p_c)^0=1/2\), which gives \(p_c(L=2) \simeq 0.4588\). Maybe we can just continue doing this type of calculation for higher and higher L and we will get a better and better approximation for \(p:c\)?

Extending to Larger Systems

We notice that for finite L, \(\varPi (p,L)\) will be a polynomial of order \( {\mathcal O}(L^2) \) - it is in principle a function we can calculate. However, the number of possible configurations is \(2^{L^2}\) which increases very rapidly with L. It is therefore not realistic to use this technique for calculating the percolation probabilities. We will need to have more powerful techniques, or simpler problems, in order to perform exact calculations.

However, we can still learn much from a discussion of finite L. For example, we notice that

$$\displaystyle \begin{aligned} \varPi(p,L) \simeq Lp^L + c_1 p^{L+1} + \ldots + c_n p^{L^2} \; , \end{aligned} $$
(1.7)

in the limit of \(p \ll 1\). The leading order term when \(p \rightarrow 0\) is therefore \(L p^L\).

Similarly, we find that for \(p \rightarrow 1\), the leading order term is approximately

$$\displaystyle \begin{aligned} \varPi(p,L) \simeq 1 - (1-p)^L \; . \end{aligned} $$
(1.8)

These two results gives us an indication about how the percolation probability \(\varPi (p,L)\) is approaching the step function when \(L \rightarrow \infty \).

Similarly, we can calculate \(P(p,L)\) for \(L=2\). However, we leave the calculation of the \(L=3\) and the \(P(p,L)\) system to the exercises.

1.5 Further Reading

There are good general introduction texts to percolation theory such as the popular books by Stauffer and Aharony [37], by Sahimi [30], by Christensen and Moloney [8], and the classical book by Grimmet [14]. Mathematical aspects are addressed by Kesten [21] and phase transitions in general are introduced by e.g. Stanley [35]. Applications of percolation theory are found in many fields such as in geoscience [22], porous media [18] or social networks [33] and many more. We encourage you to explore these books for a more theoretical introduction to percolation theory.

Exercises

Exercise 1.1 (Percolation for \(L = 3\))

  1. (a)

    Find \(P(p,L)\) for \(L=1\) and \(L=2\).

  2. (b)

    Categorize all possible configurations for \(L=3\).

  3. (c)

    Find \(\varPi (p,L)\) and \(P(p,L)\) for \(L=3\).

Exercise 1.2 (Counting Configurations in Small Systems)

  1. (a)

    Write a program to find all the configurations for \(L=2\).

  2. (b)

    Use this program to find \(\varPi (p,L=2)\) and \(P(p,L=2)\). Compare with the exact results from the previous exercise.

  3. (c)

    Use you program to find \(\varPi (p,L)\) and \(P(p,L)\) for \(L=3,4\) and 5.

Exercise 1.3 (Percolation in Small Systems in 3d)

In this exercise we will study the three-dimensional site percolation system for small system sizes.

  1. (a)

    How many configurations are there for \(L = 2\)?

  2. (b)

    Categorize all possible configurations for \(L=2\).

  3. (c)

    Find \(\varPi (p,L)\) and \(P(p,L)\) for \(L=2\).

  4. (d)

    Compare your results with your result for the two-dimensional system. Comment on similarities and differences.