QiLing Tools

🐾Brownian Motion & Diffusion Simulator - Random Walk, MSD, Stokes–Einstein, Fick

Simulate up to thousands of walkers starting at the origin: a lattice random walk, Langevin Brownian motion with drag and thermal kicks, Lévy flights and a continuous-time random walk. You see their trails, a log–log mean squared displacement plot with a slope fit and the theory curve, and a histogram of displacements. A Stokes–Einstein calculator turns particle radius, viscosity and temperature into a diffusion coefficient and typical displacements, for pollen, bacteria, proteins, sugar and even gas molecules. A 1D diffusion-equation tab puts the numerical solution, a walker histogram and Fick's flux side by side.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use Brownian Motion & Diffusion Simulator

  1. 1On the Walkers & MSD tab pick a motion model, set the damping γ, temperature k_BT or tail exponent α, and press Run
  2. 2Read the log–log MSD: normal diffusion has slope 1, Langevin starts with slope 2, Lévy flights exceed 1 and subdiffusion stays below 1
  3. 3On the Stokes–Einstein tab choose a particle and medium, set the temperature and read D, the displacement after 1 s or 1 h and the time to cross 1 mm
  4. 4On the Diffusion equation tab choose an initial profile and boundaries, then drag the probe line x₀ to read the flux J and the net amount crossed

FAQ

Why does the mean squared displacement grow linearly with time?
Successive steps are independent with zero mean, so the variance of the total displacement is the sum of the step variances and grows in proportion to the number of steps: ⟨r²⟩ = 2dDt in d dimensions. That is Einstein's 1905 explanation of Brownian motion and the signature of diffusion: distance grows only as √t, so going 10 times farther takes 100 times longer. On a log–log plot normal diffusion is a straight line of slope 1.
Why is the Langevin slope 2 at short times?
A real particle has mass and velocity, and collisions only randomise the velocity after the momentum relaxation time τ = m/γ. For t ≪ τ the particle moves almost in a straight line, ⟨r²⟩ ≈ (k_BT/m)·d·t², slope 2 (ballistic). For t ≫ τ it becomes diffusive, ⟨r²⟩ = 2dDt. The full result is ⟨r²⟩ = 2dD[t − τ(1 − e^{−t/τ})], drawn as the dashed theory curve. For a particle of 1 µm radius in water τ is only about 0.2 µs, so under a microscope you only ever see the diffusive regime.
When does the Stokes–Einstein equation apply?
D = k_BT/(6πηr) treats the particle as a rigid sphere moving slowly through a continuous viscous fluid. It works well for colloids, cells, viruses and proteins and roughly for small molecules like sucrose, but it underestimates D when the particle is about the size of the solvent molecules, such as water self-diffusion. Sub-micron particles in air need the Cunningham slip correction because their size approaches the mean free path of air (about 65 nm). Gas molecules diffusing among each other do not follow Stokes' law at all, so the tool uses kinetic theory, D = 3/(8nd²)·√(k_BT/πm).
What is anomalous diffusion?
Diffusion is anomalous when ⟨r²⟩ ∝ t^β with β ≠ 1. In a Lévy flight step lengths follow a heavy tail P(ℓ) ∝ ℓ^{−1−α} with α < 2, so occasional huge jumps make the typical displacement grow as t^{1/α}: superdiffusion, used for animal foraging and turbulent transport. In a continuous-time random walk each jump waits a heavy-tailed time (α < 1), so particles get trapped for longer and longer and ⟨r²⟩ ∝ t^α: subdiffusion, seen for macromolecules in cytoplasm and in porous media.
How is Fick's law related to random walks?
The density c(x, t) of many independent walkers obeys the diffusion equation ∂c/∂t = D ∂²c/∂x², which is Fick's second law. The particle current J = −D ∂c/∂x is Fick's first law: material flows from high to low concentration at a rate proportional to the gradient. The tool solves the equation with finite differences and moves tens of thousands of walkers with Gaussian steps; their histogram should match, and for a point source both agree with c = M/√(4πDt)·e^{−x²/4Dt}. For the probability side of random processes, see the Markov chain tool.

Features

  • Four models: lattice walk, Langevin Brownian motion, Lévy flight and CTRW, with up to 5000 walkers
  • Log–log MSD with a fit over the last decade of time and the exact ballistic-to-diffusive curve
  • Displacement histogram against a Gaussian of the same variance, with excess kurtosis
  • Stokes–Einstein in water, glycerol or air (with Cunningham correction) plus kinetic-theory D for gases
  • 1D diffusion equation, walker histogram and point-source solution on one chart, with reflecting or absorbing walls
  • Fick's first-law flux curve and the net amount crossing a draggable probe point