#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ExosphereSpecies {
pub name: &'static str,
pub abundance_fraction: f64,
pub scale_height_km: f64,
}
pub fn reference_composition() -> Vec<ExosphereSpecies> {
vec![
ExosphereSpecies {
name: "O2",
abundance_fraction: 0.78,
scale_height_km: 120.0,
},
ExosphereSpecies {
name: "H2",
abundance_fraction: 0.08,
scale_height_km: 300.0,
},
ExosphereSpecies {
name: "Na",
abundance_fraction: 0.04,
scale_height_km: 60.0,
},
ExosphereSpecies {
name: "K",
abundance_fraction: 0.03,
scale_height_km: 50.0,
},
ExosphereSpecies {
name: "H2O",
abundance_fraction: 0.05,
scale_height_km: 80.0,
},
ExosphereSpecies {
name: "CO2",
abundance_fraction: 0.02,
scale_height_km: 40.0,
},
]
}
pub fn dominant_species(species: &[ExosphereSpecies]) -> Option<ExosphereSpecies> {
species
.iter()
.copied()
.max_by(|left, right| left.abundance_fraction.total_cmp(&right.abundance_fraction))
}