marss 0.0.3

Mars celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
pub struct HypotheticalVegetation {
    pub name: &'static str,
    pub min_temperature_k: f64,
    pub min_pressure_pa: f64,
    pub co2_requirement_ppm: f64,
    pub uv_tolerance: f64,
}

impl HypotheticalVegetation {
    pub fn could_survive_on_mars(&self) -> bool {
        self.min_temperature_k <= crate::SUBSOLAR_MAX_TEMP_K
            && self.min_pressure_pa <= crate::SURFACE_PRESSURE_PA
            && self.co2_requirement_ppm <= crate::CO2_FRACTION * 1e6
    }

    pub fn required_greenhouse_warming_k(&self) -> f64 {
        let deficit = self.min_temperature_k - crate::MEAN_TEMPERATURE_K;
        deficit.max(0.0)
    }
}

pub fn extremophile_lichen() -> HypotheticalVegetation {
    HypotheticalVegetation {
        name: "Extremophile lichen",
        min_temperature_k: 233.0,
        min_pressure_pa: 100.0,
        co2_requirement_ppm: 200.0,
        uv_tolerance: 0.9,
    }
}

pub fn cyanobacteria() -> HypotheticalVegetation {
    HypotheticalVegetation {
        name: "Engineered cyanobacteria",
        min_temperature_k: 253.0,
        min_pressure_pa: 1000.0,
        co2_requirement_ppm: 300.0,
        uv_tolerance: 0.6,
    }
}

pub fn surface_par_fraction() -> f64 {
    let distance_factor = 1.0 / (crate::SEMI_MAJOR_AXIS_AU * crate::SEMI_MAJOR_AXIS_AU);
    let dust_factor = (-crate::MEAN_DUST_OPTICAL_DEPTH).exp();
    distance_factor * dust_factor * 0.45
}

pub fn available_par_w_m2() -> f64 {
    let solar = sciforge::hub::domain::meteorology::radiation::solar_constant()
        / (crate::SEMI_MAJOR_AXIS_AU * crate::SEMI_MAJOR_AXIS_AU);
    solar * surface_par_fraction()
}