Chapter 4 of The Nature of Code, Particle Systems, builds emitters that spawn short-lived particles at a controlled rate. The controlling variable here is a measured concentration of airborne particles.
I let Open-Meteo PM2.5 readings set each city’s spawn rate, so the particle system is driven by measured particulate load rather than a fixed emitter constant.
Each of three cities is an emitter whose spawn rate and particle color are set by its current PM2.5 reading, the mass concentration of fine particulate matter, from the Open-Meteo air-quality forecast. The rendered particles stand for the measured particulates, so the emission rate is a physical scalar rather than a chosen constant.
Each particle integrates by explicit (forward) Euler, \(\mathbf{x}_{t+1} = \mathbf{x}_t + \mathbf{v}_t\,\Delta t\), and carries a finite lifespan. The number spawned per frame is proportional to concentration, \(r \propto C_{\text{PM2.5}}\), where \(C\) is in \(\mu\mathrm{g}/\mathrm{m}^3\); the WHO 24-hour guideline is \(15\,\mu\mathrm{g}/\mathrm{m}^3\). PM2.5 denotes particulate matter with aerodynamic diameter \(\le 2.5\,\mu\mathrm{m}\).
Data source: Open-Meteo Air Quality API
Endpoint:https://air-quality-api.open-meteo.com/v1/air-quality?latitude=...&longitude=...&hourly=pm2_5
Access: Public, no key. Loaded from an hourly server-side refresh when possible, with a bundled snapshot fallback, and a live browser fetch only when the API allows CORS. Data window: Aug 6, 2026 (pulled Aug 6, 2026 UTC)
All 72 hourly PM2.5 samples are listed below.