Water retention on random surfaces
Water retention on random surfaces is the simulation of catching of water in ponds on a surface of cells of various heights on a regular array such as a square lattice, where water is rained down on every cell in the system. The boundaries of the system are open and allow water to flow out. Water will be trapped in ponds, and eventually all ponds will fill to their maximum height, with any additional water flowing over spillways and out the boundaries of the system. The problem is to find the amount of water trapped or retained for a given surface. This has been studied extensively for random surfaces. Random surfaces 

One system in which the retention question has been studied is a surface of random heights. Here one can map the random surface to site percolation, and each cell is mapped to a site on the underlying graph or lattice that represents the system. Using percolation theory, one can explain many properties of this system. It is an example of the invasion percolation model in which fluid is introduced in the system from any random site. In hydrology, one is concerned with runoff and formation of catchments. The boundary between different drainage basin (watersheds in North America) forms a drainage divide with a fractal dimension of about 1.22. The retention problem can be mapped to standard percolation. For a system of five equally probable levels, for example, the amount of water stored R5 is just the sum of the water stored in two-level systems R2(p) with varying fractions of levels p in the lowest state:

 R5 = R2(1/5) + R2(2/5) + R2(3/5) + R2(4/5)

Typical two-level systems 1,2 with p = 0.2, 0.4, 0.6, 0.8 are shown on the right (blue: wet, green: dry, yellow: spillways bordering wet sites). The net retention of a five-level system is the sum of all these. The top level traps no water because it is far above the percolation threshold for a square lattice, 0.592746. The retention of a two-level system R2(p) is the amount of water connected to ponds that do not touch the boundary of the system. When p is above the critical percolation threshold p c, there will be a percolating cluster or pond that visits the entire system. The probability that a point belongs to the percolating or "infinite" cluster is written as P∞ in percolation theory, and it is related to R2(p) by R2(p)/L2 = p − P∞ where L is the size of the square. Thus, the retention of a multilevel system can be related to a well-known quantity in percolation theory. To measure the retention, one can use a flooding algorithm in which water is introduced from the boundaries and floods through the lowest spillway as the level is raised. The retention is just the difference in the water level that a site was flooded minus the height of the terrain below it. Besides the systems of discrete levels described above, one can make the terrain variable a continuous variable say from 0 to 1. Likewise, one can make the surface height itself be a continuous function of the spatial variables. In all cases, the basic concept of the mapping to an appropriate percolation system remains. A curious result is that a square system of n discrete levels can retain more water than a system of n+1 levels, for sufficiently large order L > L*. This behavior can be understood through percolation theory, which can also be used to estimate L* ≈ (p − pc)−ν where ν = 4/3, p = i*/n where i* is the largest value of i for which i/n < pc, and pc = 0.592746 is the site percolation threshold for a square lattice. Numerical simulations give the following values of L*, which are extrapolated to non-integer values. For example, R2 < R3 for L ≤ 51, but R2 > R3 for L ≥ 52:

As n gets larger, crossing become less and less frequent, and the value of L* where crossing occurs is no longer a monotonic function of n.

The retention when the surface is not entirely random but correlated with a Hurst exponent H is discussed in Schrenk et al. See also 

 Drainage divide

References

Further reading

External links
 https://commons.wikimedia.org/wiki/Category:Associative_magic_squares_of_order_4
 Hugo Pfoertner. , with links to magic square pictures
 Hugo Pfoertner. Discussion site for Al Zimmermann's Programming Contests
 Item on Futility Closet
 
 —Polyominoe enumeration and lake patterns
 —Upgrade the model from 2D to 3D
 Nature 2018
 Water retention histogram as a computing problem
 http://oeis.org/A331507/ Maximum number of ponds

Random matrices
Critical phenomena
Percolation theory