pub use sciforge::hub::prelude::constants::{
C, G, H, HBAR, K_B, LIGHT_YEAR, PARSEC, SIGMA_SB, SOLAR_MASS,
};
pub const STELLAR_MASS_MIN_SOLAR: f64 = 3.0;
pub const STELLAR_MASS_MAX_SOLAR: f64 = 100.0;
pub const INTERMEDIATE_MASS_MIN_SOLAR: f64 = 100.0;
pub const INTERMEDIATE_MASS_MAX_SOLAR: f64 = 1e5;
pub const SUPERMASSIVE_MASS_MIN_SOLAR: f64 = 1e5;
pub const SUPERMASSIVE_MASS_MAX_SOLAR: f64 = 1e10;
pub const PRIMORDIAL_MASS_MIN_KG: f64 = 1e-8;
pub const PRIMORDIAL_MASS_MAX_KG: f64 = 1e23;
pub const UNIVERSE_AGE: f64 = 4.35e17;
pub fn schwarzschild_radius(mass: f64) -> f64 {
2.0 * G * mass / (C * C)
}
pub fn gravitational_radius(mass: f64) -> f64 {
G * mass / (C * C)
}
pub fn isco_radius(mass: f64, spin: f64) -> f64 {
let rg = gravitational_radius(mass);
let a = spin.clamp(-1.0, 1.0);
let z1 = 1.0 + (1.0 - a * a).cbrt() * ((1.0 + a).cbrt() + (1.0 - a).cbrt());
let z2 = (3.0 * a * a + z1 * z1).sqrt();
rg * (3.0 + z2 - ((3.0 - z1) * (3.0 + z1 + 2.0 * z2)).sqrt())
}
pub fn photon_sphere_radius(mass: f64) -> f64 {
1.5 * schwarzschild_radius(mass)
}
pub fn eddington_luminosity(mass: f64) -> f64 {
1.26e38 * mass / SOLAR_MASS
}
pub fn hawking_temperature(mass: f64) -> f64 {
HBAR * C * C * C / (8.0 * std::f64::consts::PI * G * mass * K_B)
}
pub fn evaporation_time(mass: f64) -> f64 {
5120.0 * std::f64::consts::PI * G * G * mass.powi(3) / (HBAR * C * C * C * C)
}