#[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 * (150.0 + 200.0 * self.ice_fraction)
    }
}

pub fn deep_regolith() -> RegolithLayer {
    RegolithLayer {
        thickness_m: 100.0,
        density_kg_m3: 1_100.0,
        ice_fraction: 0.05,
    }
}

pub fn crater_floor_regolith() -> RegolithLayer {
    RegolithLayer {
        thickness_m: 50.0,
        density_kg_m3: 1_300.0,
        ice_fraction: 0.02,
    }
}
