This is genuine Direct Simulation Monte Carlo (DSMC), not decorative dots: each particle is a real gas-molecule proxy that moves ballistically (straight-line free flight) every step, exactly as a molecule does between collisions. Collisions are never checked pairwise across the whole gas — instead, particles are binned into the DSMC cell grid, and each cell independently samples collision candidates with Bird's No-Time-Counter (NTC) method:
Ncand = ½ · Nc² · d · cr_max · Δt / Vcell
for each candidate pair (i, j) in the cell:
cr = |vi − vj|
accept if random() < cr / cr_max
on accept: rotate relative velocity by
a random angle (elastic, equal mass)
Nc is the cell's particle count, Vcell its area, d the molecular diameter and cr_max a running estimate of the largest relative speed seen. Accepting collisions in proportion to relative speed reproduces the real collision-rate formula ν = n·σ·⟨cr⟩ statistically without testing every pair — the whole point of DSMC over brute-force molecular dynamics.
The Knudsen number compares the mean free path λ = 1 / (√2 · n · d) — the average distance a molecule travels between collisions — to the obstacle's size L: Kn = λ / L. Below Kn ≈ 0.01 the gas behaves as a continuum fluid; above Kn ≈ 10 collisions are so rare that molecules fly essentially unimpeded (free-molecular flow) — exactly what raising the density slider down (or the molecular size up) suppresses.
- Density / size sliders — set n and d directly, which is what actually moves Kn.
- Temperature slider — scales thermal speed ∝ √T (Maxwell–Boltzmann), changing collision frequency and the speed histogram, but not Kn itself — a real and often surprising kinetic-theory fact.
- Cell grid — too coarse over-collides (particles pair across large distances), too fine starves each cell of the ≥2 particles NTC needs; the slider lets you feel that trade-off directly.