When chlorine is added to disinfect drinking water, most of it reacts with natural organic matter (NOM/DOC) left over from decaying vegetation and soil — not just with pathogens. That side reaction slowly converts DOC into trihalomethanes (THMs), a regulated class of disinfection byproducts (chloroform CHCl₃ plus its brominated relatives).
Chlorine decay (1st order):
Cl(t) = Cl₀ · e^(−k_d·t)
k_d = k_d0 · (DOC/3) · θ_d^((T−20)/10)
THM formation (driven by residual Cl):
d[THM]/dt = k_f · Cl(t) · DOC
THM(t) = (k_f·DOC/k_d) · Cl₀ · (1 − e^(−k_d·t))
k_f = k_f0 · θ_f^((T−20)/10) · (1 + Br⁻/300)
CT value (disinfection credit):
CT(t) = ∫₀ᵗ Cl(t′) dt′ = Cl₀(1 − e^(−k_d·t)) / k_d
- Chlorine dose — more initial Cl₂ means more precursor is consumed and more THM mass forms, but also a higher disinfection CT.
- DOC — the fuel for the reaction: higher NOM means faster chlorine demand (higher k_d) and a larger total THM yield.
- Bromide — trace Br⁻ is oxidised to hypobromous acid (HOBr), which reacts with NOM faster than chlorine itself, boosting the total formation rate and shifting the mix toward brominated THMs.
- Temperature — both reactions speed up with heat (θ ≈ 1.06–1.08 per 10 °C), which is why THM levels in a distribution system usually peak in summer.
The reactor clock runs continuously; particle counts for chlorine (yellow-green), unreacted DOC precursor (amber) and formed THMs (magenta) are recomputed each frame from the closed-form solutions above — no per-frame integration error. Constants here are illustrative of the shape of published semi-empirical DBP models (Amy, Rathbun and others), tuned for a readable demo rather than a certified regulatory prediction tool. The US EPA Stage 2 Disinfectants and Disinfection Byproducts Rule sets an 80 µg/L running annual average limit for total THMs.