# Phase-transition benchmark tutorial (v1)

Recompute the sound-wave source lifetime and today's gravitational-wave
spectrum for three fixed first-order phase-transition benchmarks.

This package evaluates a published parametric template at fixed inputs. It does
not solve the Einstein equations or the fluid equations in time, it contains no
LISA data, and it contains no browser Engine code or paper text.

## Files

| File | Content |
| --- | --- |
| `recompute_benchmark.py` | The calculation. Python standard library only. |
| `inputs/benchmarks.json` | Three benchmarks, four invalid cases, and a seven-row table of the largest strength that still has a deflagration profile (from our own bag-model solver). |
| `expected.json` | Our output, produced with Python 3.9.6. |
| `README.md` | This file. |

## Run

```
python3 recompute_benchmark.py inputs/benchmarks.json > my-output.json
python3 recompute_benchmark.py inputs/benchmarks.json --compare expected.json
```

The second command prints `MATCH` when every number agrees with
`expected.json` to a relative tolerance of 1e-9. Otherwise it lists the path of
each differing field. Python 3.9 or newer is required; no network access is
used.

## Units and conventions

- `alpha`: transition strength, dimensionless.
- `betaOverHubble`: inverse duration in units of the Hubble rate at the
  transition, dimensionless.
- `wallSpeed`: bubble-wall speed in units of c.
- `temperatureGeV`: transition temperature in GeV.
- `relativisticDof`: g\*, fixed at 100 and assumed equal to the entropy count.
- Equation of state: bag model, sound speed squared 1/3.
- Frequencies are in Hz. Every energy density is the dimensionless
  h^2 Omega_GW.

## Output fields (per benchmark)

| Field | Meaning |
| --- | --- |
| `regime` | `deflagration` or `detonation`. |
| `kappa` | Single-bubble kinetic-energy efficiency (Espinosa et al. 2010, appendix-B fits). |
| `kineticFraction` | K = 0.6 kappa alpha / (1 + alpha). |
| `hubbleBubbleSize` | H\* R\*, mean bubble separation times the Hubble rate. |
| `rmsFluidSpeed` | Root-mean-square fluid speed, sqrt(3K/4). |
| `hubbleShockTime` | H\* tau_sh = H\* R\* / rmsFluidSpeed. |
| `hubbleSourceTime` | min(H\* tau_sh, 1), the lifetime factor used in the amplitude. |
| `lifetimeLimitedBy` | `shock formation` or `Hubble expansion`. |
| `expansionSuppressionUpsilon` | Guo et al. (2021) factor, shown for comparison only. |
| `shellThickness` | Delta_w, the sound-shell thickness that sets the second break. |
| `firstBreakHz`, `secondBreakHz` | f1 and f2 today. |
| `integratedAmplitudeH2` | h^2 Omega_int. |
| `secondBreakAmplitudeH2` | h^2 Omega_2, the template value at f2. |
| `peakFrequencyHz`, `peakAmplitudeH2` | Numerical maximum of the template. |
| `snrLisaFourYearsAE` | Signal-to-noise ratio, A and E channels, 4 years, 3e-5 to 0.5 Hz, no foregrounds. |
| `redshiftCheck` | H\*,0 and the dilution factor from first principles next to the template constants. |

## Reference values (Python 3.9.6)

| Benchmark | H\* tau_sh | f2 (mHz) | Peak h^2 Omega | SNR |
| --- | --- | --- | --- | --- |
| detonation-lisa-band | 0.368 | 0.873 | 1.60e-11 at 0.677 mHz | 634 |
| slow-deflagration | 0.193 | 1.59 | 3.67e-13 at 1.23 mHz | 33.7 |
| hubble-limited-detonation | 7.12 (capped at 1) | 0.0756 | see `expected.json` | 0.20 |

## Sources of each formula

- Sound-wave template, amplitude, mean bubble separation and redshift factors:
  Caprini et al., arXiv:2403.03723v2, section 2.2.1.
- LISA noise and response: arXiv:2403.03723v2, section 3 and appendix A.
- Efficiency fits: Espinosa, Konstandin, No and Servant, arXiv:1004.4187v1,
  appendix B. Stated precision better than 15 percent.
- Expansion suppression factor: Guo, Sinha, Vagie and White,
  arXiv:2007.08537v3.

## The optical-metrology corner

The noise equation in arXiv:2403.03723v2 prints the optical-metrology corner
frequency as 2e-3 mHz. We use 2 mHz, the value in the earlier LISA noise model
of Robson, Cornish and Liu (arXiv:1803.01944v2). We did not confirm the
intended value with the authors. The literal printed value changes the SNR of
the three benchmarks from 634, 33.7 and 0.20 to 716, 38.1 and 0.211 (about 13
percent for the first). Spectra, breaks and lifetimes do not depend on it.

## Independent checks

- `redshiftCheck` recomputes H\*,0 from entropy conservation, the Friedmann
  equation, a CMB temperature of 2.7255 K and a present entropy count of 3.909.
  At 200 GeV it gives 3.2934e-5 Hz against the template constant 3.3e-5 Hz.
- In the repository tests, our own bag-model profile solutions differ from the
  efficiency fits by at most 7.4 percent away from the Jouguet speed, a
  Runge-Kutta integral reproduces the Guo et al. factor, and the low-frequency
  noise ratio to the Robson-Cornish-Liu curve is 20/9.

## Failure cases

`failureCases` lists inputs the script must refuse. Each result records
`refused: true` and a reason:

| Case | Why it is refused |
| --- | --- |
| `hybrid-wall` | A hybrid wall (supersonic but slower than the Jouguet speed). The template's shell-thickness rule is not stated there. |
| `wall-at-sound-speed` | Same rule: the shell-thickness rule is not stated for a wall at the sound speed. |
| `strong-slow-deflagration` | No subsonic deflagration profile exists for alpha = 0.5 at wall speed 0.25. |
| `bubbles-as-large-as-hubble` | The mean bubble separation reaches the Hubble radius; a flat-space template no longer applies. |

If an edited script returns a spectrum for any of these, the edit has removed a
physical check.

## Errors to carry with the numbers

- Efficiency fit: better than 15 percent, entering the amplitude through K^2.
- The amplitude constant 0.11 is an average over simulations; we found no
  quoted spread in the section we read.
- Three published shock-time definitions differ by up to 50 percent for the
  first benchmark (0.368, 0.285 and 0.247).
- The SNR ignores astrophysical foregrounds, which the 2024 paper expects to
  matter.

## Limits

- Bag-model equation of state only; g\* fixed at 100.
- Sound waves only. Bubble-collision and turbulence contributions are omitted.
- The lifetime factor min(H\* tau_sh, 1) is the template choice. It is not a
  simulation of how the sound waves decay.
