ioss 0.0.3

Io celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
use crate::COSMIC_RAY_DOSE_MSV_DAY;

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct RadiationEnvironment {
    pub jovian_trapped_particle_flux: f64,
    pub galactic_cosmic_ray_dose_msv_day: f64,
    pub regolith_shielding_g_cm2: f64,
}

impl RadiationEnvironment {
    pub fn nominal_surface() -> Self {
        Self {
            jovian_trapped_particle_flux: 5.0,
            galactic_cosmic_ray_dose_msv_day: COSMIC_RAY_DOSE_MSV_DAY,
            regolith_shielding_g_cm2: 0.0,
        }
    }
    pub fn sheltered(regolith_depth_m: f64) -> Self {
        Self {
            jovian_trapped_particle_flux: 0.50,
            galactic_cosmic_ray_dose_msv_day: COSMIC_RAY_DOSE_MSV_DAY,
            regolith_shielding_g_cm2: regolith_depth_m.max(0.0) * 180.0,
        }
    }
    pub fn effective_daily_dose_msv(&self) -> f64 {
        let attenuation = (-self.regolith_shielding_g_cm2 / 180.0).exp();
        self.galactic_cosmic_ray_dose_msv_day * attenuation
            + self.jovian_trapped_particle_flux * 2.5
    }
}

pub fn annual_crew_dose_msv(environment: RadiationEnvironment) -> f64 {
    environment.effective_daily_dose_msv() * 365.25
}