atmosphere: update pressure regression

This commit is contained in:
yuni 2024-11-28 01:39:53 +01:00
parent f405774904
commit 74cb35d3ac
2 changed files with 15 additions and 13 deletions

View file

@ -105,10 +105,12 @@ Based on Table 8 from SRC1:
### Regression analysis
- 350km-850km: `p[bar](a[m]) = e^(-8.0920583983 - 0.0000066339143 * a)`
- 50km-350km: `p[bar](a[m]) = e^(-0.969198983 - 0.000027000953 * a)`
- -125km-50km: `p[bar](a[m]) = e^(0.0626589359 - 0.0000473755348 * a)`
- <-125km: `p[bar](a[m]) = -0.7155577817531 * a - 89044.7227191413` (low-effort linear regression assuming p(-70000km) = 5e7 bar)
Pressure:
- 500km-1029.2km: `p[bar](x[m]) = exp(-13.3961516218 - 0.0000071595 * x)`
- 200km-500km: `p[bar](x[m]) = exp(-3.4340885227 - 0.0000277865 * x)`
- 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)]`)
### Designing the in-game atmosphere

View file

@ -289,15 +289,15 @@ pub fn format_seconds_to_hour_min(seconds: f64) -> String {
pub fn jupiter_altitude_to_pressure(altitude: f64) -> f64 {
// See doc/research.md
let a = altitude - JUPITER_RADIUS;
if a >= 1e6 {
let x = altitude - JUPITER_RADIUS;
if x >= 1030e3 {
return 0.0;
} else if a >= 350e3 {
return (-8.0920583983 - 0.0000066339143 * a).exp();
} else if a >= 50e3 {
return (-0.969198983 - 0.000027000953 * a).exp();
} else if a >= -125e3 {
return (0.0626589359 - 0.0000473755348 * a).exp();
} else if x >= 500e3 {
return (-13.3961516218 - 0.0000071595 * x).exp();
} else if x >= 200e3 {
return (-3.4340885227 - 0.0000277865 * x).exp();
} else if x >= 0.0 {
return (-0.0020248515 - 0.0000454102 * x).exp();
}
return -0.7155577817531 * a - 89044.7227191413;
return -(1.45773e-16) * x.powf(3.0) + 1;
}