Expand description
§spectroxide
An open-source solver for the cosmological thermalization problem: computing spectral distortions of the CMB from energy release in the early Universe.
§Overview
The code evolves the photon occupation number n(x, z) (where
x = hν/(kT_z) is the dimensionless frequency) through the
coupled photon-electron Boltzmann equation in an expanding universe.
Physical processes included:
- Compton scattering (Kompaneets equation): frequency redistribution
- Double Compton emission: photon-number changing, γe → γγe
- Bremsstrahlung: photon-number changing, e+ion → e+ion+γ
- Hubble expansion: cosmological redshifting
§Usage
use spectroxide::prelude::*;
// Create solver with default cosmology
let cosmo = Cosmology::default();
let mut solver = ThermalizationSolver::new(cosmo, GridConfig::fast());
// Set energy injection (e.g., delta-function burst at z=2×10⁵)
solver.set_injection(InjectionScenario::SingleBurst {
z_h: 2e5,
delta_rho_over_rho: 1e-5,
sigma_z: 100.0,
}).unwrap();
// Run the solver, collecting 50 evenly log-spaced snapshots
let snapshots = solver.run(50);
let mu = snapshots.last().unwrap().mu;§Green’s Function Mode
For fast approximate calculations of small distortions:
use spectroxide::greens::*;
// Distortion from delta-function injection at z_h = 2×10⁵
let x = 3.0; // dimensionless frequency
let g = greens_function(x, 2e5);Modules§
- bremsstrahlung
- Bremsstrahlung (free-free) emission and absorption.
- cli
- CLI argument parsing with subcommands (zero dependencies).
- constants
- Physical and cosmological constants in SI units.
- cosmology
- Background cosmology: Hubble rate, cosmic time, number densities.
- dark_
photon - Helpers for dark photon (γ ↔ A’) conversion in the narrow-width approximation.
- distortion
- Distortion extraction and characterization.
- double_
compton - Double Compton (DC) scattering: γ + e → γ + γ + e
- electron_
temp - Electron temperature state (ρ_e = T_e/T_z).
- energy_
injection - Energy injection scenarios for the early Universe.
- greens
- Green’s function for the cosmological thermalization problem.
- grid
- Frequency grid for the photon Boltzmann equation.
- kompaneets
- Kompaneets equation: Compton scattering of photons off thermal electrons.
- output
- Structured output types and serialization for solver results.
- prelude
- Convenient imports for common usage.
- recombination
- Hydrogen and helium recombination history.
- solver
- Main PDE solver for the cosmological thermalization problem.
- spectrum
- Spectral shapes and distributions for CMB spectral distortions.
Constants§
- PHYSICS_
HASH - Content hash of the physics-relevant Rust source files at compile time.