Diffusion with Random Walk Simulator

Seed:      Steps:  Square root of steps:  RMS Distance:

Physics Background

Many physical processes, such as the blending of two gaseous species or electrical conduction in a semiconductor, are governed by the laws of diffusion, and can be modeled with a fairly simple Monte Carlo simulation of a random walk. The random walk simulates a particle being displaced in a random direction but by a constant radius in a sequence of time steps. This models particles of a species being displaced by random thermal collisions in a gas. Staying in two dimensions to simplify visualization, this figure illustrates the random walk process:

The expected value of the distance "walked" after n time steps can be found with a simple statistical argument:

where rrms is the RMS distance for each step in the walk. For the simple case of rrms=1, the expected value of the walked distance is simply the square root of the number of time steps.

The simulator above runs random walks with an ensemble of 100 particles, all initialized at the origin. Different pseudorandom simulations can be run by changing the seed value and restarting. The tool can be paused at any time to see the correlation between the square root of the number of steps and the actual RMS distance traveled across the ensemble. This correlation can be seen more clearly in the following plot for one particular seed value:


Back to Computational Physics Playground page

Back to John Fattaruso's home page