Recompute a relic abundance with the saved scripts
Sandbox Physics ·
This tutorial reruns the Lab's relic model in Python and checks it in ways that do not reuse its own equation. The default case, a 100 GeV particle with ⟨σv⟩0=2.136×10−26cm3s−1, ends with Y∞=4.373×10−12 and Ωh2=0.120. A separate solution in cosmic time agrees to 0.03 per cent, a direct collision integral reproduces the freeze-in yield to 0.0005 per cent, and the result sits 8 per cent above the published fit of Steigman, Dasgupta and Beacom because this model holds g∗ fixed. Three tempting shortcuts give wrong answers, and the scripts save each one.
Everything here is output of a teaching model, not a measurement. The only measured number used is the dark matter density Ωh2=0.120±0.001 from Planck 2018. Planck Collaboration, 2018, abstract
Files, versions and units
The scripts need Python 3.9 or later with NumPy and SciPy; the saved files were made with Python 3.9.6, NumPy 2.0.2 and SciPy 1.13.1. The materials are in this collection's materials folder:
relic_model.py, the reference model that the Lab's TypeScript code mirrors;
inputs.json, the constants, solver settings and six presets;
Masses and temperatures are in GeV. Cross-sections are entered in cm3s−1 and converted with 1GeV−2=1.167329×10−17cm3s−1. The model holds g∗=g∗s=86.25, takes g=2 internal states and MPl=2.435×1018GeV, and converts with Ωh2=2.744×108(m/GeV)Y∞.
mkdir ac73-check && cd ac73-check
base=https://sandboxphysics.com/stories/dark-matter-relics/materials
for name in relic_model.py inputs.json run_relic_benchmarks.py check_independent_limits.py relic-benchmarks.json independent-checks.json; do curl -fsSLO "$base/$name"; done
python3 -m venv .venv && .venv/bin/pip install numpy scipy
.venv/bin/python -I run_relic_benchmarks.py inputs.json my-relic-benchmarks.json
.venv/bin/python -I check_independent_limits.py my-independent-checks.json
The benchmark run takes about half a minute and the checks a few seconds. Compare your two new files with the saved ones; on another machine the last digits may differ.
Step 1: the solver and its step size
The model integrates dY/dlnx=−k(x)(Y2−Yeq2) from x=10−3 with 250 steps per e-fold of x. Each step uses second-order backward differentiation, which evaluates the right side at the new point. Because the right side is quadratic in Y, each step is a quadratic equation with one non-negative root, so no iteration is needed:
a = 2 * h / 3 * k[i]
c = (4 * y[i - 1] - y[i - 2]) / 3 + 2 * h / 3 * k[i] * yeq[i] ** 2
y[i] = 2 * c / (1 + math.sqrt(1 + 4 * a * c))
Doubling the steps to 500 per e-fold changes Y∞ by 2.3×10−4 for the default case, 3.0×10−5 for kination and 5×10−9 for freeze-in. With 50 steps per e-fold the default case is off by 1.0 per cent. The settling point in the readouts is the last x at which Y differs from its final value by more than 10 per cent.
Table 5.1 Presets from relic-benchmarks.json, m=100GeV.
Preset
⟨σv⟩0, cm3s−1
Start
Y∞
Ωh2
Settles by x
Freeze-out
2.136×10−26
equilibrium
4.373×10−12
0.120
208
Stronger annihilation
2.136×10−24
equilibrium
5.241×10−14
0.00144
239
Hot relic
10−38
equilibrium
5.331×10−3
1.46×108
0.001
Freeze-in
2.571×10−45
empty
4.373×10−12
0.120
1.59
Kination, Tr=20MeV
2.136×10−26
equilibrium
1.466×10−10
4.02
8085
Freeze-out, empty start
2.136×10−26
empty
4.373×10−12
0.120
208
Where to look: the first and last rows are identical to every printed digit, which is the memory loss that defines freeze-out. Common misreading: the hot relic's settling point is the first grid point only because its value never changes by 10 per cent.
Step 2: checks that do not reuse the model equation
check_independent_limits.py recomputes each result by a different route.
Table 5.2 Independent checks from independent-checks.json.
Check
Model
Independent value
Agreement
F(20) from the s integral
0.86390
0.86390
<10−5
Default case, solved in cosmic time
4.3733×10−12
4.3746×10−12
0.03%
Kination, solved in cosmic time
1.46582×10−10
1.46588×10−10
0.004%
Freeze-in, collision double integral
4.37346×10−12
4.37348×10−12
0.0005%
Freeze-in, closed form (3π2/32)a2λ
4.37346×10−12
4.37819×10−12
0.11%
Γ/H at x=25, Friedmann H against Steigman eq. 12
1.27752
1.27767
0.012%
Inverse yield at x=500, kination log law
3.5629×109
3.5652×109
0.06%
The cosmic-time solution does not use Y or x at all. It integrates the number density n(t) with the stiff Radau method, takes H from the Friedmann equation and the equilibrium density from the Bessel-function formula in physical units, and only at the end divides by the entropy density. The collision integral computes the production rate as a double integral over pair energy and temperature, with no use of F. The Steigman row computes Γ/H for slow particles from the Friedmann equation and compares it with the coefficient printed in their eq. (12). Steigman, Dasgupta and Beacom, 2012, section II.A The log-law row uses only the asymptotic form of D'Eramo and colleagues' eqs. (C16) and (C18). D'Eramo, Fernandez and Profumo, 2017, appendix C
Step 3: published values
Two comparisons are with published numbers that come from fuller calculations, so they are expected to differ.
Table 5.3 Cross-section that gives Ωh2=0.120 for m=100GeV.
Source
⟨σv⟩, cm3s−1
⟨σv⟩, GeV−2
This model
2.136×10−26
1.830×10−9
Steigman, Dasgupta and Beacom, eq. 26 fit
1.980×10−26
1.696×10−9
D'Eramo, Fernandez and Profumo, Fig. 1
1.98×10−26
1.7×10−9
Both published values include g∗(T), which falls through the QCD transition, and both assume a constant cross-section. This model is 8 per cent higher. The Lee–Weinberg matching estimate, D'Eramo and colleagues' eqs. (C10) and (C12) with c=2−1, gives xf=21.7 and Y∞=3.97×10−12 for a constant cross-section, 3.4 per cent below the model's own constant-cross-section solution of 4.11×10−12.
Step 4: three shortcuts that fail
The script saves three failures on purpose.
Forward Euler with the same 250 steps per e-fold. At x=10−3 in the default case, the step times the reaction rate is 3×104, so the explicit update overshoots and diverges at x=0.00102, after five steps.
The slow-particle formula Yeq∝x3/2e−x used everywhere. Freeze-in happens at x≃1 to 3, where that formula is wrong, and the yield comes out at 5.7 per cent of the correct value.
A constant cross-section in freeze-in. Then the production rate does not fall off at high temperature, and the yield depends on the start: 1.891×10−8 from x=10−3 and 1.871×10−9 from x=10−2, a factor of 10.1. The answer would be set by a starting temperature that no measurement fixes.
Step 5: compare a Lab export
In the dark matter relic Lab, press Export this record. The file holds the input, the summary and the solution at 20 points per decade of x. Its summary.finalYield for the default case should match the wimpFreezeOut entry in relic-benchmarks.json to about 10−7, the level at which the TypeScript and Python Bessel functions agree.
The snippet shows the fields to compare, rounded; the exported file prints full precision.
What these checks do not cover
The model keeps g∗ constant, uses Maxwell–Boltzmann statistics, assumes a contact interaction with massless products and ignores co-annihilation, resonances and thresholds. The checks show that the code solves its stated equation correctly and that its scaling matches published work. Whether any real dark matter particle behaves this way is a question for experiments.