marss 0.0.3

Mars celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
pub struct DustStorm {
    pub name: &'static str,
    pub area_km2: f64,
    pub optical_depth: f64,
    pub duration_sols: f64,
    pub max_wind_speed_m_s: f64,
}

impl DustStorm {
    pub fn local() -> Self {
        Self {
            name: "Local dust storm",
            area_km2: 1e4,
            optical_depth: 2.0,
            duration_sols: 3.0,
            max_wind_speed_m_s: 30.0,
        }
    }

    pub fn regional() -> Self {
        Self {
            name: "Regional dust storm",
            area_km2: 1e6,
            optical_depth: 3.0,
            duration_sols: 20.0,
            max_wind_speed_m_s: 40.0,
        }
    }

    pub fn global() -> Self {
        Self {
            name: "Planet-encircling dust storm",
            area_km2: crate::MARS_SURFACE_AREA / 1e6,
            optical_depth: crate::GLOBAL_STORM_OPTICAL_DEPTH,
            duration_sols: 100.0,
            max_wind_speed_m_s: 60.0,
        }
    }

    pub fn surface_solar_fraction(&self) -> f64 {
        (-self.optical_depth).exp()
    }

    pub fn atmospheric_heating_rate(&self) -> f64 {
        self.optical_depth * 1.0
    }
}

pub struct DustDevil {
    pub diameter_m: f64,
    pub height_m: f64,
    pub wind_speed_m_s: f64,
    pub pressure_drop_pa: f64,
}

impl DustDevil {
    pub fn typical() -> Self {
        Self {
            diameter_m: 100.0,
            height_m: 5_000.0,
            wind_speed_m_s: 20.0,
            pressure_drop_pa: 2.0,
        }
    }

    pub fn large() -> Self {
        Self {
            diameter_m: 700.0,
            height_m: 20_000.0,
            wind_speed_m_s: 35.0,
            pressure_drop_pa: 5.0,
        }
    }

    pub fn kinetic_energy_j(&self) -> f64 {
        let rho = crate::SURFACE_AIR_DENSITY;
        let volume = std::f64::consts::PI * (self.diameter_m / 2.0).powi(2) * self.height_m;
        0.5 * rho * volume * self.wind_speed_m_s.powi(2)
    }

    pub fn dust_lifting_capacity_kg_s(&self) -> f64 {
        1e-3 * self.pressure_drop_pa * self.wind_speed_m_s
    }
}

pub fn global_storm_frequency_per_mars_year() -> f64 {
    0.33
}

pub fn dust_devil_density_per_sol_km2() -> f64 {
    0.8
}