use sciforge::hub::domain::common::constants::{DEGREE_TO_RAD, R_GAS};
pub struct ErosionParams {
pub rainfall_mm_yr: f64,
pub slope_deg: f64,
pub rock_erodibility: f64,
pub vegetation_cover: f64,
}
impl ErosionParams {
pub fn fluvial_erosion_rate_mm_yr(&self) -> f64 {
let slope_rad = self.slope_deg * DEGREE_TO_RAD;
self.rock_erodibility
* self.rainfall_mm_yr.powf(1.5)
* slope_rad.tan()
* (1.0 - self.vegetation_cover)
}
pub fn sediment_yield_t_km2_yr(&self) -> f64 {
let quartz_sg = *crate::QUARTZ_DENSITY / crate::FRESHWATER_DENSITY;
self.fluvial_erosion_rate_mm_yr() * quartz_sg
}
}
pub fn chemical_weathering_rate(temperature_c: f64, precipitation_mm_yr: f64) -> f64 {
let temp_k = temperature_c + crate::CELSIUS_TO_KELVIN;
let ea = crate::EA_WEATHERING;
let a = 1e6;
a * (-ea / (R_GAS * temp_k)).exp() * precipitation_mm_yr.powf(0.65)
}
pub fn frost_weathering_rate(freeze_thaw_cycles: f64, porosity: f64) -> f64 {
0.001 * freeze_thaw_cycles * porosity
}
pub fn glacial_erosion_rate(ice_velocity_m_yr: f64, effective_pressure_pa: f64) -> f64 {
let abrasion_coeff = 1e-4;
abrasion_coeff * ice_velocity_m_yr * effective_pressure_pa / 1e6
}
pub fn wind_erosion_threshold_velocity(particle_diameter_m: f64, particle_density: f64) -> f64 {
let air_density = *crate::SEA_LEVEL_AIR_DENSITY;
let g = *crate::SURFACE_GRAVITY;
0.1 * ((particle_density - air_density) * g * particle_diameter_m / air_density).sqrt()
}