marss 0.0.1

Mars celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use sciforge::hub::domain::geology::seismology::{
    gutenberg_richter, moment_magnitude, p_wave_velocity, s_wave_velocity, seismic_moment,
    travel_time,
};

pub struct Marsquake {
    pub magnitude: f64,
    pub depth_km: f64,
    pub seismic_moment_nm: f64,
}

impl Marsquake {
    pub fn from_magnitude(mw: f64, depth_km: f64) -> Self {
        let moment = seismic_moment(mw);
        Self {
            magnitude: mw,
            depth_km,
            seismic_moment_nm: moment,
        }
    }

    pub fn moment_magnitude(&self) -> f64 {
        moment_magnitude(self.seismic_moment_nm)
    }

    pub fn p_wave_arrival_s(&self, distance_km: f64, vp: f64) -> f64 {
        travel_time(distance_km * 1000.0, vp)
    }

    pub fn s_wave_arrival_s(&self, distance_km: f64, vs: f64) -> f64 {
        travel_time(distance_km * 1000.0, vs)
    }
}

pub fn largest_detected_marsquake() -> Marsquake {
    Marsquake::from_magnitude(4.7, 25.0)
}

pub fn annual_frequency(magnitude: f64) -> f64 {
    gutenberg_richter(4.0, 0.95, magnitude)
}

pub fn crust_p_wave_velocity() -> f64 {
    p_wave_velocity(45e9, 25e9, crate::CRUST_DENSITY)
}

pub fn crust_s_wave_velocity() -> f64 {
    s_wave_velocity(25e9, crate::CRUST_DENSITY)
}

pub fn mantle_p_wave_velocity() -> f64 {
    p_wave_velocity(130e9, 70e9, crate::MANTLE_DENSITY)
}

pub fn mantle_s_wave_velocity() -> f64 {
    s_wave_velocity(70e9, crate::MANTLE_DENSITY)
}

pub fn low_frequency_event_count() -> u32 {
    72
}

pub fn high_frequency_event_count() -> u32 {
    800
}