implement density calculation and HUD gauge
This commit is contained in:
parent
9cc6d7ea1f
commit
b348b3524a
|
@ -44,8 +44,10 @@
|
|||
## Jupiter
|
||||
|
||||
- SRC1: [Thermal structure of Jupiter's atmosphere near the edge of a 5µm hot spot in the north equatorial belt](https://doi.org/10.1029/98JE01766)
|
||||
- SRC2: [NASA Jupiter Fact Sheet](https://nssdc.gsfc.nasa.gov/planetary/factsheet/jupiterfact.html)
|
||||
- SRC3: ["THE INTERIORS OF JUPITER AND SATURN" by Ravit Helled](https://arxiv.org/pdf/1812.07436)
|
||||
|
||||
Based on Table 8 from SRC1:
|
||||
Based on Table 8 from SRC1, with additional values for altitude=0 from SRC2 and interior density values from SRC3:
|
||||
|
||||
| Altitude (km) | Pressure (bar) | Temperature (K) | Density (kg/m³) |
|
||||
| ------------- | -------------- | --------------- | --------------- |
|
||||
|
@ -101,7 +103,10 @@ Based on Table 8 from SRC1:
|
|||
| 60 | 4.37E-02 | 122.6 | 0.009915 |
|
||||
| 40 | 1.36E-01 | 113.2 | 0.03335 |
|
||||
| 23.3 | 3.52E-01 | 122.9 | 0.07945 |
|
||||
| 0 | 1 | | |
|
||||
| 0 | 1 | 165 | 0.16 |
|
||||
| -62000 | ? | ? | 4500 |
|
||||
| -62500 | ? | ? | 20000 |
|
||||
| -70000 | ? | ? | 25000 |
|
||||
|
||||
### Regression analysis
|
||||
|
||||
|
@ -112,12 +117,20 @@ Pressure:
|
|||
- 0km-200km: `p[bar](x[m]) = exp(-0.0020248515 - 0.0000454102 * x)`
|
||||
- <0km: `p[bar](x[m]) = -(1.45773e-16) * x^3 + 1` (low-effort cubic regression on `[(-70000km, 50Mbar), (0m, 1bar)]`)
|
||||
|
||||
Density:
|
||||
|
||||
- 500km-1029.2km: `rho[kg/m³](x[m]) = exp(-15.98781474626208 - 0.00000816092074*x)`
|
||||
- 200km-500km: `rho[kg/m³](x[m]) = exp(-4.22487505187567 - 0.00003251947782*x)`
|
||||
- 0km-200km: `rho[kg/m³](x[m]) = exp(-1.83275074106303 - 0.00004486861245*x)`
|
||||
- -62000km-0km: `rho[kg/m³](x[m]) = -0.0725781*x + 0.16` (linear regression)
|
||||
- -70000km-62000km: `rho[kg/m³](x[m]) = 25000.0 / (1 + exp(0.00580528 * x + 361.44394)))` (logistic regression)
|
||||
|
||||
### Designing the in-game atmosphere
|
||||
|
||||
New mechanics:
|
||||
|
||||
- [ ] Ambient Pressure
|
||||
- [ ] Depends on altitude
|
||||
- [X] Ambient Pressure
|
||||
- [X] Depends on altitude
|
||||
- [ ] Temperature
|
||||
- [ ] Ambient temperature
|
||||
- [ ] Space suit temperature
|
||||
|
@ -142,6 +155,7 @@ Relations between mechanics:
|
|||
- [ ] Death at pressure of ~400 bar through implosion (depending on vehicle)
|
||||
- [ ] Death at high temperatures through continuous damage when temperature exceeds 60°C
|
||||
- [ ] Hydrogen + Oxygen = Water, used for evaporative cooling (works only at right pressure/temperature)
|
||||
- [ ] Refill Hydrogen inside Jupiter's atmosphere
|
||||
|
||||
## Io
|
||||
|
||||
|
|
|
@ -1166,8 +1166,10 @@ fn handle_atmosphere(
|
|||
}
|
||||
|
||||
if player.is_some() {
|
||||
let density = nature::jupiter_altitude_to_density(distance);
|
||||
settings.atmo_pressure = Some(pressure);
|
||||
settings.atmo_altitude = Some(distance - nature::JUPITER_RADIUS);
|
||||
settings.atmo_density = Some(density);
|
||||
reset_player_gauges = false;
|
||||
}
|
||||
|
||||
|
@ -1187,5 +1189,6 @@ fn handle_atmosphere(
|
|||
if reset_player_gauges {
|
||||
settings.atmo_pressure = None;
|
||||
settings.atmo_altitude = None;
|
||||
settings.atmo_density = None;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -877,6 +877,9 @@ fn update_speedometer(
|
|||
if let Ok(mut speed_text) = q_node_speed.get_single_mut() {
|
||||
// Atmospheric conditions
|
||||
let mut atmo = String::new();
|
||||
if let Some(val) = settings.atmo_density {
|
||||
atmo += format!("dens: {}g/m³\n", nature::readable_si(val*1000.0)).as_str();
|
||||
}
|
||||
if let Some(val) = settings.atmo_altitude {
|
||||
atmo += format!("alt: {}m\n", nature::readable_si(val)).as_str();
|
||||
}
|
||||
|
|
|
@ -297,6 +297,7 @@ pub fn format_seconds_to_hour_min(seconds: f64) -> String {
|
|||
}
|
||||
|
||||
pub fn jupiter_altitude_to_pressure(altitude: f64) -> f64 {
|
||||
// Units: meter (relative to 1-bar "surface") -> bar
|
||||
// See doc/research.md
|
||||
let x = altitude - JUPITER_RADIUS;
|
||||
if x >= 1030e3 {
|
||||
|
@ -310,3 +311,21 @@ pub fn jupiter_altitude_to_pressure(altitude: f64) -> f64 {
|
|||
}
|
||||
return -(1.45773e-16) * x.powf(3.0) + 1.0;
|
||||
}
|
||||
|
||||
pub fn jupiter_altitude_to_density(altitude: f64) -> f64 {
|
||||
// Units: meter (relative to 1-bar "surface") -> kg/(m^3)
|
||||
// See doc/research.md
|
||||
let x = altitude - JUPITER_RADIUS;
|
||||
if x >= 1030e3 {
|
||||
return 0.0;
|
||||
} else if x >= 500e3 {
|
||||
return (-15.98781474626208 - 0.00000816092074 * x).exp();
|
||||
} else if x >= 200e3 {
|
||||
return (-4.22487505187567 - 0.00003251947782 * x).exp();
|
||||
} else if x >= 0.0 {
|
||||
return (-1.83275074106303 - 0.00004486861245 * x).exp();
|
||||
} else if x >= -62000e3 {
|
||||
return -0.0725781 * x + 0.16;
|
||||
}
|
||||
return 25000.0 / (1.0 + (0.00580528 * x + 361.44394)).exp();
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ pub struct Settings {
|
|||
pub zoom_fov: f32,
|
||||
pub zoom_sensitivity_factor: f32,
|
||||
pub atmo_pressure: Option<f64>,
|
||||
pub atmo_density: Option<f64>,
|
||||
pub atmo_altitude: Option<f64>,
|
||||
pub font_size_hud: f32,
|
||||
pub font_size_fps: f32,
|
||||
|
@ -203,6 +204,7 @@ impl Default for Settings {
|
|||
zoom_fov: 15.0,
|
||||
zoom_sensitivity_factor: 0.25,
|
||||
atmo_pressure: None,
|
||||
atmo_density: None,
|
||||
atmo_altitude: None,
|
||||
font_size_hud: 24.0,
|
||||
font_size_fps: 14.0,
|
||||
|
|
Loading…
Reference in a new issue