The 3D version tracks hundreds of individual cases as discrete particles, each resolving stochastically with a memoryless per-step exit probability — a Monte-Carlo, agent-based approach. This 2D companion drops individual agents entirely and instead integrates the population-level stock-flow ODE directly:
dP/dt = Incidence(t) − P(t)/Duration
Exact closed form (constant params):
P(t) = P* + (P₀ − P*)·e^(−t/Duration), P* = Incidence × Duration
Every frame this simulator advances P(t) with a 4th-order Runge–Kutta step (RK4) — the same class of numerical integrator used for real epidemic and pharmacokinetic compartment models — and, whenever a slider is touched, it also resets an exact analytic solution from that instant so the two can be compared live. The "numeric − analytic drift" readout should stay pinned near zero: that agreement is the self-check that the integrator is doing its job, since for this linear ODE the closed form is exact.
Because outflow is now a continuous rate rather than discrete exits, the recovery and death "spouts" below the tank emit particles at literal instantaneous rates — (1−CFR)·P/Duration and CFR·P/Duration cases per day respectively — turned into a Poisson-style spawn accumulator, so the visual flow speed is numerically tied to the same quantities driving the equation, not just decorative motion.
- Incidence rate — the source term I(t) in the ODE; converted to cases/day internally.
- Average illness duration — sets the removal-rate constant 1/Duration; the ODE's exponential relaxation time back toward P* is exactly Duration days.
- Case-fatality proportion — splits the single outflow rate P/Duration into two rates without changing P(t) itself, since deaths and recoveries both remove a case from the pool identically.
- Watch the water level converge to the dashed steady-state line at the same I × D value the 3D tank converges to — two structurally different simulations (stochastic agents vs. a deterministic ODE) landing on the identical steady state is itself evidence the underlying math is right.