use crate::physics::orbit::MERCURY_RADIUS;
use sciforge::hub::domain::common::constants::K_B;

pub const SOLAR_WIND_SPEED_KM_S: f64 = 400.0;
pub const SOLAR_WIND_DENSITY_CM3: f64 = 60.0;
pub const IMF_MAGNITUDE_NT: f64 = 35.0;

pub fn solar_wind_dynamic_pressure() -> f64 {
    let n = SOLAR_WIND_DENSITY_CM3 * 1e6;
    let v = SOLAR_WIND_SPEED_KM_S * 1000.0;
    let m_proton = 1.6726e-27;
    0.5 * n * m_proton * v * v
}

pub fn magnetopause_standoff_m() -> f64 {
    crate::MAGNETOPAUSE_STANDOFF_R * MERCURY_RADIUS
}

pub fn magnetopause_altitude_m() -> f64 {
    magnetopause_standoff_m() - MERCURY_RADIUS
}

pub fn surface_exposure_fraction() -> f64 {
    0.40
}

pub fn thermal_velocity(molar_mass_kg: f64, temperature_k: f64) -> f64 {
    (2.0 * K_B * temperature_k / molar_mass_kg).sqrt()
}

pub fn sodium_photoionization_rate() -> f64 {
    1.5e-5
}

pub fn sodium_radiation_pressure_accel() -> f64 {
    0.5 * crate::SURFACE_GRAVITY
}

pub fn sodium_tail_length_estimate_m() -> f64 {
    2.5 * MERCURY_RADIUS
}
