moons 0.0.2

Moon celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use moons::environment::dust::DustEnvironment;
use moons::environment::radiation::{RadiationEnvironment, annual_crew_dose_msv};
use moons::environment::thermal::{ThermalEnvironment, thermal_cycle_span_k};

fn ensure_earth_context() {
    let earth = moons::interactions::earths::ensure_earths_binary_or_simulate();
    assert!(earth.axial_tilt_deg > 20.0);
}

#[test]
fn radiation_shelter_reduces_dose() {
    ensure_earth_context();
    let open = RadiationEnvironment::nominal_surface();
    let sheltered = RadiationEnvironment::sheltered(3.0);
    assert!(sheltered.effective_daily_dose_msv() < open.effective_daily_dose_msv());
    assert!(annual_crew_dose_msv(open) > 100.0);
}

#[test]
fn terminator_dust_is_more_aggressive() {
    ensure_earth_context();
    let terminator = DustEnvironment::terminator();
    let habitat = DustEnvironment::sheltered_habitat();
    assert!(terminator.adhesion_risk(120.0) > habitat.adhesion_risk(20.0));
}

#[test]
fn equatorial_thermal_cycle_is_large() {
    ensure_earth_context();
    let noon = ThermalEnvironment {
        local_time_hours: moons::LUNAR_DAY_HOURS * 0.5,
        latitude_deg: 0.0,
        shadowed: false,
    };
    assert!(noon.surface_temperature_k() > 300.0);
    assert!(thermal_cycle_span_k(0.0) > 100.0);
}