earths 0.0.1

High-fidelity Earth simulation engine — orbit, atmosphere, geology, hydrology, biosphere, terrain, lighting, rendering, satellites, and temporal systems with full scientific coupling
Documentation
use sciforge::hub::domain::geology::seismology::{
    epicenter_distance, gutenberg_richter, moment_magnitude, omori_aftershock, p_wave_velocity,
    peak_ground_acceleration, s_wave_velocity, seismic_energy, seismic_moment, snell_seismic,
    travel_time,
};
pub struct Earthquake {
    pub latitude: f64,
    pub longitude: f64,
    pub depth_km: f64,
    pub seismic_moment_nm: f64,
}
impl Earthquake {
    pub fn from_moment(lat: f64, lon: f64, depth_km: f64, moment_nm: f64) -> Self {
        Self {
            latitude: lat,
            longitude: lon,
            depth_km,
            seismic_moment_nm: moment_nm,
        }
    }
    pub fn from_magnitude(lat: f64, lon: f64, depth_km: f64, mw: f64) -> Self {
        let moment = seismic_moment(mw);
        Self::from_moment(lat, lon, depth_km, moment)
    }
    pub fn moment_magnitude(&self) -> f64 {
        moment_magnitude(self.seismic_moment_nm)
    }
    pub fn energy_joules(&self) -> f64 {
        seismic_energy(self.moment_magnitude())
    }
    pub fn p_wave_arrival_time(&self, distance_km: f64, vp: f64) -> f64 {
        travel_time(distance_km * 1000.0, vp)
    }
    pub fn s_wave_arrival_time(&self, distance_km: f64, vs: f64) -> f64 {
        travel_time(distance_km * 1000.0, vs)
    }
    pub fn pga_at_distance(&self, distance_km: f64) -> f64 {
        peak_ground_acceleration(1.0, 1.0, self.moment_magnitude(), distance_km)
    }
}
pub fn aftershock_rate(mainshock_magnitude: f64, time_days: f64) -> f64 {
    let a = mainshock_magnitude - 1.2;
    let c = 0.05;
    let p = 1.1;
    omori_aftershock(a.powf(10.0), c, p, time_days)
}
pub fn annual_frequency(magnitude: f64) -> f64 {
    let a = 8.0;
    let b = 1.0;
    gutenberg_richter(a, b, magnitude)
}
pub fn crust_p_wave_velocity(density: f64, bulk_modulus: f64, shear_modulus: f64) -> f64 {
    p_wave_velocity(bulk_modulus, shear_modulus, density)
}
pub fn crust_s_wave_velocity(density: f64, shear_modulus: f64) -> f64 {
    s_wave_velocity(shear_modulus, density)
}
pub fn distance_from_sp_time(tp: f64, ts: f64, vp: f64, vs: f64) -> f64 {
    epicenter_distance(ts - tp, vp, vs)
}
pub fn refraction_angle(v1: f64, v2: f64, angle1_rad: f64) -> f64 {
    snell_seismic(v1, v2, angle1_rad)
}