ioss 0.0.3

Io celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use crate::{IO_RADIUS_M, JUPITER_IO_DISTANCE_M, JUPITER_MASS};

pub const LOVE_NUMBER_K2: f64 = 0.7;
pub const QUALITY_FACTOR_Q: f64 = 36.0;
const G: f64 = 6.674_30e-11;

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TidalResponse {
    pub love_number: f64,
    pub quality_factor: f64,
    pub mean_displacement_m: f64,
}

impl TidalResponse {
    pub fn current() -> Self {
        Self {
            love_number: LOVE_NUMBER_K2,
            quality_factor: QUALITY_FACTOR_Q,
            mean_displacement_m: 100.0,
        }
    }
}

pub fn jupiter_tidal_acceleration(angle_deg: f64) -> f64 {
    let angle_factor = angle_deg.to_radians().cos();
    2.0 * G * JUPITER_MASS * IO_RADIUS_M / JUPITER_IO_DISTANCE_M.powi(3) * angle_factor
}

pub fn tidal_bulge_m(response: TidalResponse, angle_deg: f64) -> f64 {
    response.mean_displacement_m * angle_deg.to_radians().cos().abs()
}

pub fn dissipation_power_w(response: TidalResponse) -> f64 {
    1.0e14 * response.love_number / response.quality_factor
}