pub struct ThermalCycle {
pub daytime_max_k: f64,
pub nighttime_min_k: f64,
pub thermal_inertia: f64,
pub latitude_deg: f64,
}
impl ThermalCycle {
pub fn equatorial_summer() -> Self {
Self {
daytime_max_k: 293.0,
nighttime_min_k: 175.0,
thermal_inertia: 300.0,
latitude_deg: 0.0,
}
}
pub fn equatorial_winter() -> Self {
Self {
daytime_max_k: 250.0,
nighttime_min_k: 170.0,
thermal_inertia: 300.0,
latitude_deg: 0.0,
}
}
pub fn polar_summer() -> Self {
Self {
daytime_max_k: 200.0,
nighttime_min_k: 150.0,
thermal_inertia: 250.0,
latitude_deg: 80.0,
}
}
pub fn polar_winter() -> Self {
Self {
daytime_max_k: 150.0,
nighttime_min_k: 130.0,
thermal_inertia: 250.0,
latitude_deg: 80.0,
}
}
pub fn temperature_swing_k(&self) -> f64 {
self.daytime_max_k - self.nighttime_min_k
}
pub fn temperature_at_phase(&self, phase: f64) -> f64 {
let mean = (self.daytime_max_k + self.nighttime_min_k) / 2.0;
let amp = (self.daytime_max_k - self.nighttime_min_k) / 2.0;
mean + amp * (2.0 * std::f64::consts::PI * (phase - 0.25)).cos()
}
pub fn thermal_stress_mpa(&self) -> f64 {
let alpha = 8e-6;
let youngs = 50e9;
alpha * youngs * self.temperature_swing_k() / 1e6
}
pub fn thermal_inertia_units(&self) -> f64 {
self.thermal_inertia
}
}
pub fn surface_type_from_thermal_inertia(ti: f64) -> &'static str {
if ti < 100.0 {
"Fine dust"
} else if ti < 250.0 {
"Sand / duricrust"
} else if ti < 600.0 {
"Gravel / cemented soil"
} else if ti < 1200.0 {
"Bedrock"
} else {
"Ice / exposed rock"
}
}
pub fn global_mean_thermal_inertia() -> f64 {
225.0
}