enceladuss 0.0.3

Enceladus celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use crate::{ENCELADUS_RADIUS_M, SATURN_ENCELADUS_DISTANCE_M, SATURN_MASS};

pub const LOVE_NUMBER_K2: f64 = 0.7;
pub const QUALITY_FACTOR_Q: f64 = 20.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: 8.0,
        }
    }
}

pub fn saturn_tidal_acceleration(angle_deg: f64) -> f64 {
    let angle_factor = angle_deg.to_radians().cos();
    2.0 * G * SATURN_MASS * ENCELADUS_RADIUS_M / SATURN_ENCELADUS_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.58e10 * response.love_number / response.quality_factor
}