use sciforge::hub::domain::common::constants::SIGMA_SB;
pub struct Lake {
pub name: &'static str,
pub surfaceareakm2: f64,
pub maxdepthm: f64,
pub volumekm3: f64,
pub elevationm: f64,
}
impl Lake {
pub fn meandepthm(&self) -> f64 {
self.volumekm3 * 1e9 / (self.surfaceareakm2 * 1e6)
}
pub fn shorelinedevelopmentratio(&self, shorelinekm: f64) -> f64 {
shorelinekm
/ (2.0 * std::f64::consts::PI * (self.surfaceareakm2 / std::f64::consts::PI).sqrt())
}
pub fn residencetimeyears(&self, outflowm3s: f64) -> f64 {
self.volumekm3 * 1e9 / (outflowm3s * crate::SECONDSPERYEAR)
}
pub fn thermalstratificationenergyj(&self, surfacetempc: f64, bottomtempc: f64) -> f64 {
let rho = crate::FRESHWATERDENSITY;
let cp = *crate::CPFRESHWATER;
let dt = surfacetempc - bottomtempc;
let volumem3 = self.volumekm3 * 1e9;
0.5 * rho * cp * volumem3 * dt
}
pub fn evaporationratemmday(
&self,
airtempc: f64,
watertempc: f64,
windspeedms: f64,
humidity: f64,
) -> f64 {
let eswater = crate::ARMA * (crate::ARMB * watertempc / (watertempc + crate::ARMC)).exp();
let ea = humidity / 100.0
* crate::ARMA
* (crate::ARMB * airtempc / (airtempc + crate::ARMC)).exp();
let penmanfactor = (eswater - ea) * (1.0 + 0.536 * windspeedms);
penmanfactor * 0.35
}
pub fn longwaveradiationwm2(&self, watertempc: f64, emissivity: f64) -> f64 {
let tk = watertempc + crate::CELSIUSTOKELVIN;
emissivity * SIGMA_SB * tk.powi(4)
}
}
pub fn baikal() -> Lake {
Lake {
name: "Lake Baikal",
surfaceareakm2: 31722.0,
maxdepthm: 1642.0,
volumekm3: 23615.0,
elevationm: 455.5,
}
}
pub fn superior() -> Lake {
Lake {
name: "Lake Superior",
surfaceareakm2: 82100.0,
maxdepthm: 406.0,
volumekm3: 12100.0,
elevationm: 183.0,
}
}