Sunlight enters a cloud as individual photons. Each flies a random distance, then is absorbed or scattered into a random direction. Count where they end up: the Monte Carlo method on a real physical process.
-photons simulated
-mean collisions per photon
-reflected R (cloud albedo)
-transmitted T
-absorbed A
-unscattered (direct) beam; Beer-Lambert predicts -
The science
The question. Why does a cloud look white from above and grey from below, and how much sunlight does it send back to space? The answer needs the whole random walk of light, which the Monte Carlo method simulates directly: follow single photons and count what happens to them. This is not a Monte Carlo estimate of pi: here the random numbers sample a physical process.
Free flight. In a medium of optical depth tau (extinction coefficient times thickness) the distance to the next collision, in mean free paths, is exponentially distributed. Inverting the cumulative distribution with a uniform random number xi gives s = -ln(1 - xi). The unscattered fraction after a slant path is therefore e^(-tau/mu0), the Beer-Lambert law, with mu0 = cos(zenith).
Collision. With probability 1 - omega the photon is absorbed (omega is the single-scattering albedo); otherwise it scatters. The new direction uses the Henyey-Greenstein phase function with asymmetry g; its exact inverse CDF is cos(theta) = [1 + g^2 - ((1 - g^2)/(1 - g + 2 g xi))^2] / (2 g) (isotropic when g = 0), and the azimuth is uniform. Droplet clouds have g near 0.85.
Tallies. A photon leaving the top counts as reflected (R, the albedo), leaving the bottom as transmitted (T), and absorbed otherwise (A); R + T + A = 1. The statistical error of a fraction p after N photons is sqrt(p(1 - p)/N), so halving the error costs four times as many photons. This is the signature of Monte Carlo: slow convergence, but independent of the dimension of the problem and trivially parallel.
Independent reference. The dashed lines are the delta-Eddington two-stream solution (Joseph, Wiscombe and Weinman 1976; Meador and Weaver 1980): a closed-form formula that replaces the full angular distribution by an upward and a downward stream. It needs no random numbers, so it is a separate calculation. It is accurate to a few percentage points for an overhead sun and degrades for a low sun or very thin layers.
Each control. tau: how many mean free paths thick the cloud is. omega: absorption (soot lowers it). g: how forward-peaked the scattering is (a smaller g gives a higher albedo because photons turn around sooner). mu0: sun height. Photons per second only sets how fast you converge. The histogram shows how many collisions each photon made; it is wide because photons make a random walk.
Honest simplifications. A plane-parallel, horizontally infinite, homogeneous slab (the drawn box is only a window; light that leaves sideways is still followed); one wavelength, no polarisation; no ground reflection below the detector; the delta-Eddington formula is an approximation; the droplets in the picture are decorative (the physics uses a continuous medium); drawn photon paths stop after about 160 steps, and the glowing points mark collisions. Real clouds are three-dimensional and inhomogeneous, which changes albedo by tens of percent. The lamp, aperture and cloud are not to scale with the real sky.