#[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: "H2O",
abundance_fraction: 0.87,
scale_height_km: 40.0,
},
ExosphereSpecies {
name: "N2",
abundance_fraction: 0.04,
scale_height_km: 30.0,
},
ExosphereSpecies {
name: "CO2",
abundance_fraction: 0.032,
scale_height_km: 25.0,
},
ExosphereSpecies {
name: "CH4",
abundance_fraction: 0.018,
scale_height_km: 50.0,
},
ExosphereSpecies {
name: "H2",
abundance_fraction: 0.02,
scale_height_km: 100.0,
},
ExosphereSpecies {
name: "NH3",
abundance_fraction: 0.02,
scale_height_km: 35.0,
},
]
}
pub fn dominant_species(species: &[ExosphereSpecies]) -> Option<ExosphereSpecies> {
species
.iter()
.copied()
.max_by(|left, right| left.abundance_fraction.total_cmp(&right.abundance_fraction))
}