lcdm-core 0.1.0

Core logical units and specifications for ΛCDM cosmology
Documentation
// lcdm-core/src/constants.rs

//! Physical and Astronomical Constants
//!
//! Numerical values are taken from commonly used recommended standards
//! (e.g., IAU resolutions and CODATA recommendations). Where applicable,
//! constants are exact by definition.

/// Astronomical Unit in meters (IAU 2012 Resolution B2; exact).
pub const AU: f64 = 149_597_870_700.0;

/// Parsec in meters (derived from the definition of the parsec in terms of AU).
pub const PC: f64 = (648_000.0 / std::f64::consts::PI) * AU;

/// Megaparsec in meters.
pub const MPC: f64 = 1.0e6 * PC;

/// Speed of light in vacuum in m/s (exact).
pub const C: f64 = 299_792_458.0;

/// Gravitational constant in m^3 kg^-1 s^-2 (CODATA 2018 recommended value).
pub const G: f64 = 6.67430e-11;

/// Boltzmann constant in J/K (exact, SI 2019 redefinition).
pub const KB: f64 = 1.380_649e-23;

/// Stefan–Boltzmann constant in W m^-2 K^-4.
pub const SIGMA_SB: f64 = 5.670_374_419e-8;

/// Planck constant in J·s (exact, SI 2019 redefinition).
pub const H_PLANCK: f64 = 6.626_070_15e-34;

/// Electron volt in Joules (exact).
pub const EV: f64 = 1.602_176_634e-19;

// -----------------------------------------------------------------------------
// Derived cosmology / unit-conversion constants
// -----------------------------------------------------------------------------

/// Meters per kilometer.
pub const KM_PER_M: f64 = 1000.0;

/// Conversion factor from (km/s)/Mpc to 1/s.
///
/// Since 1 (km/s)/Mpc = (1000 m/s) / MPC, this yields:
///   H_SI [1/s] = H[(km/s)/Mpc] * (KM_PER_M / MPC)
///
/// For example, if H0 = 100 h (km/s)/Mpc:
///   H0_SI = 100 h * (KM_PER_M / MPC)
pub const H0_UNITS_TO_INV_SEC: f64 = KM_PER_M / MPC;

// -----------------------------------------------------------------------------
// Solar / time constants
// -----------------------------------------------------------------------------

/// Solar mass in kg (IAU 2015 Resolution B3).
pub const M_SUN: f64 = 1.988_47e30;

/// Seconds per (Julian) year (365.25 days).
pub const YEAR: f64 = 365.25 * 86_400.0;

/// Seconds per gigayear.
pub const GYR: f64 = 1.0e9 * YEAR;