moons 0.0.3

Moon celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use moons::exosphere::charging::SurfaceCharging;
use moons::exosphere::escape::{ballistic_hop_range_m, jeans_parameter};
use moons::exosphere::species::{dominant_species, reference_composition};

fn ensure_earth_binary() {
    let earth = moons::interactions::earths::ensure_earths_binary_or_simulate();
    assert!(earth.surface_speed_m_s > 400.0);
}

#[test]
fn reference_composition_has_dominant_species() {
    ensure_earth_binary();
    let composition = reference_composition();
    let dominant = dominant_species(&composition).unwrap();
    assert_eq!(dominant.name, "He");
}

#[test]
fn nightside_is_more_negatively_charged() {
    ensure_earth_binary();
    let day = SurfaceCharging::dayside();
    let night = SurfaceCharging::nightside();
    assert!(night.surface_potential_v() < day.surface_potential_v());
}

#[test]
fn ballistic_hop_range_is_positive() {
    ensure_earth_binary();
    assert!(ballistic_hop_range_m(100.0, 45.0) > 0.0);
}

#[test]
fn heavier_species_escape_less_easily() {
    ensure_earth_binary();
    let hydrogen_like = jeans_parameter(400.0, 0.002);
    let argon_like = jeans_parameter(400.0, 0.040);
    assert!(argon_like > hydrogen_like);
}