1use sciforge::hub::prelude::constants::elements::atomic_mass;
2use sciforge::hub::prelude::constants::{ATM_TO_PASCAL, EARTH_MASS, EARTH_RADIUS, G, N_A, R_GAS};
3use std::sync::LazyLock;
4pub fn m_n2() -> f64 {
5 2.0 * atomic_mass(7) * 1e-3
6}
7pub fn m_o2() -> f64 {
8 2.0 * atomic_mass(8) * 1e-3
9}
10pub fn m_ar() -> f64 {
11 atomic_mass(18) * 1e-3
12}
13pub fn m_h2o() -> f64 {
14 (2.0 * atomic_mass(1) + atomic_mass(8)) * 1e-3
15}
16pub fn m_co2() -> f64 {
17 (atomic_mass(6) + 2.0 * atomic_mass(8)) * 1e-3
18}
19pub fn m_dry_air() -> f64 {
20 0.78084 * m_n2() + 0.20946 * m_o2() + 0.00934 * m_ar() + 0.00036 * m_co2()
21}
22pub fn m_nacl() -> f64 {
23 (atomic_mass(11) + atomic_mass(17)) * 1e-3
24}
25pub fn m_sio2() -> f64 {
26 (atomic_mass(14) + 2.0 * atomic_mass(8)) * 1e-3
27}
28pub fn m_na2o() -> f64 {
29 (2.0 * atomic_mass(11) + atomic_mass(8)) * 1e-3
30}
31pub fn m_k2o() -> f64 {
32 (2.0 * atomic_mass(19) + atomic_mass(8)) * 1e-3
33}
34pub fn m_mgo() -> f64 {
35 (atomic_mass(12) + atomic_mass(8)) * 1e-3
36}
37pub fn m_feo() -> f64 {
38 (atomic_mass(26) + atomic_mass(8)) * 1e-3
39}
40pub fn m_caco3() -> f64 {
41 (atomic_mass(20) + atomic_mass(6) + 3.0 * atomic_mass(8)) * 1e-3
42}
43pub fn m_fe() -> f64 {
44 atomic_mass(26) * 1e-3
45}
46pub static SURFACE_GRAVITY: LazyLock<f64> =
47 LazyLock::new(|| G * EARTH_MASS / (EARTH_RADIUS * EARTH_RADIUS));
48pub static R_VAPOR: LazyLock<f64> = LazyLock::new(|| R_GAS / m_h2o());
49pub static SEA_LEVEL_AIR_DENSITY: LazyLock<f64> = LazyLock::new(|| {
50 let r_specific = R_GAS / m_dry_air();
51 ATM_TO_PASCAL / (r_specific * 288.15)
52});
53pub static L_VAPORIZATION: LazyLock<f64> = LazyLock::new(|| 45_054.0 / m_h2o());
54pub static CP_FRESHWATER: LazyLock<f64> = LazyLock::new(|| 75.375 / m_h2o());
55pub static QUARTZ_DENSITY: LazyLock<f64> = LazyLock::new(|| {
56 let a = 4.9133e-10_f64;
57 let c = 5.4053e-10;
58 let v_cell = a * a * c * (60.0_f64.to_radians().sin());
59 3.0 * m_sio2() / (N_A * v_cell)
60});
61pub static IRON_DENSITY: LazyLock<f64> = LazyLock::new(|| {
62 let a = 2.8665e-10_f64;
63 2.0 * m_fe() / (N_A * a.powi(3))
64});
65pub static ICE_DENSITY: LazyLock<f64> = LazyLock::new(|| {
66 let a = 4.5181e-10_f64;
67 let c = 7.3560e-10;
68 let v_cell = a * a * c * (60.0_f64.to_radians().sin());
69 4.0 * m_h2o() / (N_A * v_cell)
70});
71pub const VAPOR_PRESSURE_0C: f64 = 611.657;
72pub const CP_SEAWATER: f64 = 3994.0;
73pub const CELSIUS_TO_KELVIN: f64 = 273.15;
74pub const SECONDS_PER_YEAR: f64 = 3.155_76e7;
75pub const OMEGA_EARTH: f64 = 7.292_115_9e-5;
76pub const KT_TNT_TO_JOULE: f64 = 4.184e12;
77pub const MT_TNT_TO_JOULE: f64 = 4.184e15;
78pub const FRESHWATER_DENSITY: f64 = 1000.0;
79pub const STONY_ASTEROID_DENSITY: f64 = 3000.0;
80pub fn iron_asteroid_density() -> f64 {
81 *IRON_DENSITY
82}
83pub fn ice_asteroid_density() -> f64 {
84 *ICE_DENSITY
85}
86pub const ARM_A: f64 = 6.112;
87pub const ARM_B: f64 = 17.67;
88pub const ARM_C: f64 = 243.5;
89pub const EA_WEATHERING: f64 = 60_000.0;
90pub const Q_ICE_CREEP: f64 = 60_000.0;
91pub const VISCOSITY_SHAW_A: f64 = 2.818_382_931_264_455_7e-5;
92pub const EA_VISCOSITY_MAGMA: f64 = 2.5e5;
93pub const LITHOSPHERE_THICKNESS_ALPS: f64 = 30_000.0;
94pub const HIMALAYA_CONVERGENCE_M_YR: f64 = 0.045;
95pub const CONTINENTAL_GEOTHERMAL: f64 = 0.045;
96pub const KLEIBER_A: f64 = 3.5;
97pub const MCNAB_A: f64 = 0.024;
98pub const GEN_TIME_A: f64 = 4.88;
99pub const LIFESPAN_A: f64 = 11.8;
100pub const OCEAN_SURFACE_AREA: f64 = 3.61e14;
101pub const PAR_FRACTION: f64 = 0.45;
102pub const PAR_W_TO_UMOL: f64 = 4.57;
103pub const CLOUD_EXTINCTION_COEFF: f64 = 0.13;
104pub const CLOUD_LWC_SCALE: f64 = 0.3;
105pub const MANNING_N_SAND: f64 = 0.025;
106pub const MANNING_N_GRAVEL: f64 = 0.035;
107pub const MANNING_N_ROCK: f64 = 0.045;
108pub const MANNING_N_VEGETATED: f64 = 0.060;
109pub const ALBEDO_EMA_ALPHA: f64 = 0.001;
110pub const TROPOPAUSE_EQUATOR_M: f64 = 17_000.0;
111pub const TROPOPAUSE_POLE_M: f64 = 9_000.0;
112pub const SMITH_DRAG_COEFF: f64 = 1.2e-3;
113pub const STONE_MERIDIONAL_D: f64 = 3.8;
114pub const J2_EARTH: f64 = 1.082_63e-3;
115pub const H2_LOVE: f64 = 0.6078;
116pub const K2_LOVE: f64 = 0.2980;
117pub const L2_LOVE: f64 = 0.0847;
118pub const LUNAR_ECCENTRICITY: f64 = 0.0549;
119pub const LUNAR_INCLINATION_DEG: f64 = 5.145;
120pub mod atmosphere;
121pub mod biosphere;
122pub mod geodata;
123pub mod geology;
124pub mod hydrology;
125pub mod lighting;
126pub mod physics;
127pub mod rendering;
128pub mod satellites;
129pub mod temporal;
130pub mod terrain;