#[derive(Debug, Clone, Copy, PartialEq)]
pub struct RegolithLayer {
    pub thickness_m: f64,
    pub density_kg_m3: f64,
    pub ice_fraction: f64,
}

impl RegolithLayer {
    pub fn porosity(&self) -> f64 {
        (1.0 - self.density_kg_m3 / 2_200.0).clamp(0.0, 1.0)
    }
    pub fn thermal_inertia(&self) -> f64 {
        self.density_kg_m3 * (200.0 + 300.0 * self.ice_fraction)
    }
}

pub fn primary_regolith() -> RegolithLayer {
    RegolithLayer {
        thickness_m: 10.0,
        density_kg_m3: 1_100.0,
        ice_fraction: 0.40,
    }
}

pub fn icy_regolith() -> RegolithLayer {
    RegolithLayer {
        thickness_m: 5.0,
        density_kg_m3: 950.0,
        ice_fraction: 0.65,
    }
}
