#[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: "SO2",
abundance_fraction: 0.62,
scale_height_km: 12.0,
},
ExosphereSpecies {
name: "SO",
abundance_fraction: 0.13,
scale_height_km: 15.0,
},
ExosphereSpecies {
name: "S",
abundance_fraction: 0.10,
scale_height_km: 20.0,
},
ExosphereSpecies {
name: "O",
abundance_fraction: 0.05,
scale_height_km: 25.0,
},
ExosphereSpecies {
name: "Na",
abundance_fraction: 0.06,
scale_height_km: 42.0,
},
ExosphereSpecies {
name: "K",
abundance_fraction: 0.04,
scale_height_km: 35.0,
},
]
}
pub fn dominant_species(species: &[ExosphereSpecies]) -> Option<ExosphereSpecies> {
species
.iter()
.copied()
.max_by(|a, b| a.abundance_fraction.total_cmp(&b.abundance_fraction))
}