...
running...
How to use
The top-left drawing is the channel cross-section with the water at its normal depth (the steady depth for the chosen flow and slope) and a dashed line at the critical depth. Below it, tracer particles move through the reach; fast ones near the surface, slow ones near the bed. The upper plot is the rating curve (depth versus discharge) and the lower plot is the specific-energy curve: a given flow can run slow and deep or fast and shallow at the same energy.
Try: steepen the slope until the normal depth drops below the critical depth - the Froude number passes 1 and the flow becomes supercritical; make the bed rougher and the river deepens and slows; widen the channel and the depth falls.
The science
Steady uniform flow in an open channel obeys Manning's equation Q = (1/n) A R2/3 √S with A the wetted area, R = A/P the hydraulic radius and S the bed slope; the normal depth is found by bisection. Critical depth satisfies Q² T / (g A³) = 1, Fr = V / √(g A/T) where T is the surface width, and for a rectangle yc = (Q²/(g b²))^(1/3), Emin = 3yc/2. The specific energy is E = y + V²/2g. The tracer velocity profile is the 1/7 power law u = (8/7) ū (z/y)^(1/7), whose depth average equals ū.
Simplifications: steady uniform flow only (no backwater curve or hydraulic jump), a constant Manning n, a simple symmetrical trapezoid, and a power-law profile used for the tracers only (it does not affect the Manning solution).
What is checked and why you can trust it
Every time the page loads, and whenever you press Re-run check, the simulation evaluates its own mathematics against an independent reference, such as a closed-form formula, a finite-difference derivative or an exhaustive count. Each line above reports PASS or FAIL together with the measured numbers, so you can see by how much it agrees. Results are also published on window.__msChecks for automated testing. The check never uses the same code path as the animation it validates, otherwise it would only confirm itself.
How to read a failure: a FAIL line means the measured discrepancy exceeded the stated tolerance for the current slider values. Try Reset, then move the sliders back toward their defaults; if a check still fails at the defaults it is a bug worth reporting. Tolerances are chosen from the numerical method itself, never tuned to make a test pass: round-off level (1e-9) for exact algebra, about 1e-3 for finite differences and Monte Carlo estimates with a few hundred thousand samples, and a documented margin for stochastic learning runs.
Reproducibility: the particle and pen simulations use the browser random generator for initial positions, so exact pixels differ between visits, but the checks depend only on mathematics and not on those positions. Fixed wave tables (curl noise) and fixed grammars (L-system) are deterministic.
This is an educational model. It shows the mechanism clearly, but it is deliberately simplified; the science panel lists what was left out.