venuss 0.0.1

Venus celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use sciforge::hub::domain::geology::petrology::{
    differentiation_index, liquidus_temperature, mg_number, solidus_depression,
};

pub struct VenusVolcanism {
    pub currently_active: bool,
    pub resurfacing_fraction: f64,
}

impl Default for VenusVolcanism {
    fn default() -> Self {
        Self::new()
    }
}

impl VenusVolcanism {
    pub fn new() -> Self {
        Self {
            currently_active: true,
            resurfacing_fraction: 0.8,
        }
    }

    pub fn total_volcanic_coverage(&self) -> f64 {
        self.resurfacing_fraction
    }

    pub fn major_volcanoes() -> Vec<VenusVolcano> {
        vec![
            VenusVolcano {
                name: "Maat Mons",
                height_m: 8000.0,
                diameter_km: 395.0,
            },
            VenusVolcano {
                name: "Ozza Mons",
                height_m: 3000.0,
                diameter_km: 250.0,
            },
            VenusVolcano {
                name: "Sapas Mons",
                height_m: 1500.0,
                diameter_km: 400.0,
            },
        ]
    }
}

pub struct VenusVolcano {
    pub name: &'static str,
    pub height_m: f64,
    pub diameter_km: f64,
}

impl VenusVolcano {
    pub fn slope_angle_deg(&self) -> f64 {
        (self.height_m / (self.diameter_km * 500.0))
            .atan()
            .to_degrees()
    }

    pub fn volume_km3(&self) -> f64 {
        let r = self.diameter_km / 2.0;
        let h = self.height_m / 1000.0;
        std::f64::consts::PI / 3.0 * r * r * h
    }
}

pub struct VenusMagma {
    pub sio2_wt_percent: f64,
    pub mgo_wt_percent: f64,
    pub feo_wt_percent: f64,
    pub h2o_wt_percent: f64,
}

impl VenusMagma {
    pub fn basaltic() -> Self {
        Self {
            sio2_wt_percent: 48.0,
            mgo_wt_percent: 8.0,
            feo_wt_percent: 12.0,
            h2o_wt_percent: 0.2,
        }
    }

    pub fn mg_number(&self) -> f64 {
        mg_number(self.mgo_wt_percent, self.feo_wt_percent)
    }
    pub fn liquidus_temp_c(&self) -> f64 {
        liquidus_temperature(self.sio2_wt_percent, self.h2o_wt_percent, 1000.0)
    }
    pub fn solidus_depression_c(&self) -> f64 {
        solidus_depression(self.h2o_wt_percent, 1000.0, 1.0)
    }
    pub fn differentiation_idx(&self) -> f64 {
        differentiation_index(
            self.sio2_wt_percent,
            self.mgo_wt_percent,
            self.feo_wt_percent,
            0.0,
        )
    }
}