Devlog #65 – Wave 45: Galactic Rotation Curve, Herd Immunity & Population Genetics

Wave 45 spans three very distinct scientific domains β€” cosmology, epidemiology, and evolutionary biology β€” yet connects them through a shared theme: emergent behaviour at the population scale. A Galactic Rotation Curve simulator makes dark matter tangible; a Herd Immunity simulator shows exactly when vaccination tips an epidemic; and a Population Genetics simulator demonstrates how randomness and selection shape allele frequencies across generations. Platform now at 508 simulations.

Release Stats

508
Total simulations
65
Devlog entries
45
Release waves
3
Categories touched

New Simulations

🌌

Galactic Rotation Curve

Animated top-down galaxy view + real-time V(r) plot. Shows the Keplerian prediction (falling), disk contribution, NFW dark matter halo, and the flat observed curve. Presets for Milky Way, Andromeda, dwarf galaxy, and no dark matter.

Open simulation →
πŸ’‰

Herd Immunity

30Γ—30 population grid (S/I/R/V states) + SIRV epidemic curve. Live herd immunity threshold indicator turns green when vaccination exceeds p_c = 1βˆ’1/Rβ‚€. Presets: measles (Rβ‚€=15), COVID (Rβ‚€=3), flu (Rβ‚€=2), polio (Rβ‚€=5).

Open simulation →
🧬

Population Genetics

Allele frequency chart over 500 generations + genotype dot grid. Hardy-Weinberg equilibrium, genetic drift (binomial sampling), natural selection (fitness coefficients), and mutation rate. Presets: neutral drift, sickle cell advantage, bottleneck.

Open simulation →

Technical Highlights

🌌 Galactic Rotation Curve: NFW Halo Physics

The rotation curve simulation uses two canvases side by side. The left canvas animates 170 stars (140 spiral arm + 30 bulge) with each star's angular velocity derived from v(r)/r where v(r) is the total circular velocity at radius r. Stars are coloured blue-to-yellow-to-red based on their speed β€” fast inner stars appear warm, slow outer stars appear cool β€” which counter-intuitively inverts in the dark matter case (outer stars stay fast).

The right canvas plots four curves simultaneously: the Keplerian prediction for disk-only mass (V ∝ 1/√r, red dashed), the visible disk contribution (yellow semi-transparent), the NFW halo contribution (blue semi-transparent), and the total observed curve (bright cyan, 2.5px). The NFW halo velocity is derived from the enclosed mass integral: M_enc(r) ∝ [ln(1+r/rs) βˆ’ (r/rs)/(1+r/rs)], which gives a nearly flat rotation curve at large r. The dark matter fraction slider continuously updates all four curves in real time.

Fun fact: In the "No Dark Matter" preset, you can see the Keplerian decline clearly. Vera Rubin found in the 1970s that real galaxies don't follow this curve at all β€” their rotation stays flat out to the observable edge. This remains one of the most compelling pieces of evidence for dark matter.

πŸ’‰ Herd Immunity: SIRV ODE Architecture

The epidemic model uses a compartmental ODE system with four states: susceptible (S), infected (I), recovered (R), and vaccinated (V). Vaccination is applied as a fixed initial condition β€” a fraction vacPct/100 of the population starts immune β€” rather than a continuous rate. This represents a pre-campaign vaccination scenario.

The ODE is integrated with forward Euler at dt = 0.3 days, running 3 steps per animation frame for a ~6Γ— real-time speedup. The transmission rate uses Ξ² = Rβ‚€ / infDays and recovery rate Ξ³ = 1/infDays, giving an effective Rβ‚€ consistent with the slider. The 30Γ—30 population grid is re-synchronised each frame by sorting cells into S/I/R/V order proportional to the ODE fractions β€” a pragmatic approach that keeps the visual consistent without running a full agent model.

The herd immunity threshold indicator (p_c = 1 βˆ’ 1/Rβ‚€) updates immediately when any control changes, before even running the epidemic. This allows students to understand the threshold conceptually before pressing "Run".

🧬 Population Genetics: Hardy-Weinberg & Drift

The simulation runs a Wright-Fisher–style discrete generation model. Each generation, allele frequencies are updated by three mechanisms in sequence: (1) selection β€” genotype fitness weights (wAA, wAa, waa) renormalise the allele frequency; (2) mutation β€” Aβ†’a at rate ΞΌ and aβ†’A at rate ΞΌ/10; (3) genetic drift β€” binomial sampling of N diploid individuals from the updated allele frequency.

The dot grid shows up to 400 individuals, coloured by genotype: purple = AA, indigo = Aa, dark grey = aa. The frequency chart plots p(A) in solid purple and q(a) = 1 βˆ’ p(A) in dashed indigo, over up to 500 generations. The Hardy-Weinberg expected frequencies (pΒ², 2pq, qΒ²) are displayed in the stat bar, making it easy to spot deviations due to drift or selection.

The sickle-cell preset enables heterozygote advantage mode (HETERO_ADV = true), where wAa > wAA > waa β€” modelling balancing selection that maintains both alleles at an intermediate equilibrium frequency even under strong selection pressure. This is one of the best-known examples of natural selection maintaining genetic diversity.

What's Next

The category coverage continues to improve β€” immunology (now 2 sims), astrophysics (now 4 sims). High-priority targets for Wave 46 include enzyme kinetics (Michaelis-Menten saturation curves), quantum chromodynamics (colour confinement visualiser), and tectonic plates (mantle convection & plate boundaries). The blog series is also due for a Spotlight #48 and Learning #36 in the coming weeks.

galactic-rotation dark-matter NFW-halo Vera-Rubin herd-immunity SIR-model vaccination epidemiology population-genetics Hardy-Weinberg genetic-drift natural-selection
← Devlog #64 (Wave 44) Devlog #66 (Wave 46) →