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::prelude::constants::elements::atomic_mass;
use sciforge::hub::prelude::constants::{ATM_TO_PASCAL, EARTH_MASS, EARTH_RADIUS, G, N_A, R_GAS};
use std::sync::LazyLock;
pub fn m_n2() -> f64 {
    2.0 * atomic_mass(7) * 1e-3
}
pub fn m_o2() -> f64 {
    2.0 * atomic_mass(8) * 1e-3
}
pub fn m_ar() -> f64 {
    atomic_mass(18) * 1e-3
}
pub fn m_h2o() -> f64 {
    (2.0 * atomic_mass(1) + atomic_mass(8)) * 1e-3
}
pub fn m_co2() -> f64 {
    (atomic_mass(6) + 2.0 * atomic_mass(8)) * 1e-3
}
pub fn m_dry_air() -> f64 {
    0.78084 * m_n2() + 0.20946 * m_o2() + 0.00934 * m_ar() + 0.00036 * m_co2()
}
pub fn m_nacl() -> f64 {
    (atomic_mass(11) + atomic_mass(17)) * 1e-3
}
pub fn m_sio2() -> f64 {
    (atomic_mass(14) + 2.0 * atomic_mass(8)) * 1e-3
}
pub fn m_na2o() -> f64 {
    (2.0 * atomic_mass(11) + atomic_mass(8)) * 1e-3
}
pub fn m_k2o() -> f64 {
    (2.0 * atomic_mass(19) + atomic_mass(8)) * 1e-3
}
pub fn m_mgo() -> f64 {
    (atomic_mass(12) + atomic_mass(8)) * 1e-3
}
pub fn m_feo() -> f64 {
    (atomic_mass(26) + atomic_mass(8)) * 1e-3
}
pub fn m_caco3() -> f64 {
    (atomic_mass(20) + atomic_mass(6) + 3.0 * atomic_mass(8)) * 1e-3
}
pub fn m_fe() -> f64 {
    atomic_mass(26) * 1e-3
}
pub static SURFACE_GRAVITY: LazyLock<f64> =
    LazyLock::new(|| G * EARTH_MASS / (EARTH_RADIUS * EARTH_RADIUS));
pub static R_VAPOR: LazyLock<f64> = LazyLock::new(|| R_GAS / m_h2o());
pub static SEA_LEVEL_AIR_DENSITY: LazyLock<f64> = LazyLock::new(|| {
    let r_specific = R_GAS / m_dry_air();
    ATM_TO_PASCAL / (r_specific * 288.15)
});
pub static L_VAPORIZATION: LazyLock<f64> = LazyLock::new(|| 45_054.0 / m_h2o());
pub static CP_FRESHWATER: LazyLock<f64> = LazyLock::new(|| 75.375 / m_h2o());
pub static QUARTZ_DENSITY: LazyLock<f64> = LazyLock::new(|| {
    let a = 4.9133e-10_f64;
    let c = 5.4053e-10;
    let v_cell = a * a * c * (60.0_f64.to_radians().sin());
    3.0 * m_sio2() / (N_A * v_cell)
});
pub static IRON_DENSITY: LazyLock<f64> = LazyLock::new(|| {
    let a = 2.8665e-10_f64;
    2.0 * m_fe() / (N_A * a.powi(3))
});
pub static ICE_DENSITY: LazyLock<f64> = LazyLock::new(|| {
    let a = 4.5181e-10_f64;
    let c = 7.3560e-10;
    let v_cell = a * a * c * (60.0_f64.to_radians().sin());
    4.0 * m_h2o() / (N_A * v_cell)
});
pub const VAPOR_PRESSURE_0C: f64 = 611.657;
pub const CP_SEAWATER: f64 = 3994.0;
pub const CELSIUS_TO_KELVIN: f64 = 273.15;
pub const SECONDS_PER_YEAR: f64 = 3.155_76e7;
pub const OMEGA_EARTH: f64 = 7.292_115_9e-5;
pub const KT_TNT_TO_JOULE: f64 = 4.184e12;
pub const MT_TNT_TO_JOULE: f64 = 4.184e15;
pub const FRESHWATER_DENSITY: f64 = 1000.0;
pub const STONY_ASTEROID_DENSITY: f64 = 3000.0;
pub fn iron_asteroid_density() -> f64 {
    *IRON_DENSITY
}
pub fn ice_asteroid_density() -> f64 {
    *ICE_DENSITY
}
pub const ARM_A: f64 = 6.112;
pub const ARM_B: f64 = 17.67;
pub const ARM_C: f64 = 243.5;
pub const EA_WEATHERING: f64 = 60_000.0;
pub const Q_ICE_CREEP: f64 = 60_000.0;
pub const VISCOSITY_SHAW_A: f64 = 2.818_382_931_264_455_7e-5;
pub const EA_VISCOSITY_MAGMA: f64 = 2.5e5;
pub const LITHOSPHERE_THICKNESS_ALPS: f64 = 30_000.0;
pub const HIMALAYA_CONVERGENCE_M_YR: f64 = 0.045;
pub const CONTINENTAL_GEOTHERMAL: f64 = 0.045;
pub const KLEIBER_A: f64 = 3.5;
pub const MCNAB_A: f64 = 0.024;
pub const GEN_TIME_A: f64 = 4.88;
pub const LIFESPAN_A: f64 = 11.8;
pub const OCEAN_SURFACE_AREA: f64 = 3.61e14;
pub const PAR_FRACTION: f64 = 0.45;
pub const PAR_W_TO_UMOL: f64 = 4.57;
pub const CLOUD_EXTINCTION_COEFF: f64 = 0.13;
pub const CLOUD_LWC_SCALE: f64 = 0.3;
pub const MANNING_N_SAND: f64 = 0.025;
pub const MANNING_N_GRAVEL: f64 = 0.035;
pub const MANNING_N_ROCK: f64 = 0.045;
pub const MANNING_N_VEGETATED: f64 = 0.060;
pub const ALBEDO_EMA_ALPHA: f64 = 0.001;
pub const TROPOPAUSE_EQUATOR_M: f64 = 17_000.0;
pub const TROPOPAUSE_POLE_M: f64 = 9_000.0;
pub const SMITH_DRAG_COEFF: f64 = 1.2e-3;
pub const STONE_MERIDIONAL_D: f64 = 3.8;
pub const J2_EARTH: f64 = 1.082_63e-3;
pub const H2_LOVE: f64 = 0.6078;
pub const K2_LOVE: f64 = 0.2980;
pub const L2_LOVE: f64 = 0.0847;
pub const LUNAR_ECCENTRICITY: f64 = 0.0549;
pub const LUNAR_INCLINATION_DEG: f64 = 5.145;
pub mod atmosphere;
pub mod biosphere;
pub mod geodata;
pub mod geology;
pub mod hydrology;
pub mod lighting;
pub mod physics;
pub mod rendering;
pub mod satellites;
pub mod temporal;
pub mod terrain;