#[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: "N2",
abundance_fraction: 0.92,
scale_height_km: 40.0,
},
ExosphereSpecies {
name: "CH4",
abundance_fraction: 0.025,
scale_height_km: 25.0,
},
ExosphereSpecies {
name: "H2",
abundance_fraction: 0.015,
scale_height_km: 100.0,
},
ExosphereSpecies {
name: "C2H6",
abundance_fraction: 0.012,
scale_height_km: 15.0,
},
ExosphereSpecies {
name: "C2H2",
abundance_fraction: 0.018,
scale_height_km: 18.0,
},
ExosphereSpecies {
name: "HCN",
abundance_fraction: 0.01,
scale_height_km: 12.0,
},
]
}
pub fn dominant_species(species: &[ExosphereSpecies]) -> Option<ExosphereSpecies> {
species
.iter()
.copied()
.max_by(|a, b| a.abundance_fraction.total_cmp(&b.abundance_fraction))
}