implement nature::jupiter_altitude_to_pressure()
This commit is contained in:
parent
0a17410150
commit
aa98d8cebc
|
@ -82,6 +82,7 @@ Based on Figure 27 from SRC1, and Figure 28 using the middle of the 3 temperatur
|
|||
- 350km-850km: `p[bar](a[km]) = e^(-8.0920583983 - 0.0066339143 * a)`
|
||||
- 50km-350km: `p[bar](a[km]) = e^(-0.969198983 - 0.027000953 * a)`
|
||||
- -125km-50km: `p[bar](a[km]) = e^(0.0626589359 - 0.0473755348 * a)`
|
||||
- <-125km: `p[bar](a[km]) = -715.5577817531 * a - 89044.7227191413` (low-effort linear regression assuming p(-70000km) = 5e7 bar)
|
||||
|
||||
### Designing the in-game atmosphere
|
||||
|
||||
|
|
|
@ -271,3 +271,18 @@ pub fn format_seconds_to_hour_min(seconds: f64) -> String {
|
|||
(seconds % 3600.0) / 60.0
|
||||
);
|
||||
}
|
||||
|
||||
pub fn jupiter_altitude_to_pressure(altitude: f64) -> f64 {
|
||||
// See doc/research.md
|
||||
let a = altitude - JUPITER_RADIUS;
|
||||
if a >= 1e6 {
|
||||
return 0.0;
|
||||
} else if a >= 350e3 {
|
||||
return (-8.0920583983 - 0.0066339143 * a).exp();
|
||||
} else if a >= 50e3 {
|
||||
return (-0.969198983 - 0.027000953 * a).exp();
|
||||
} else if a >= -125e3 {
|
||||
return (0.0626589359 - 0.0473755348 * a).exp();
|
||||
}
|
||||
return -715.5577817531 * a - 89044.7227191413;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue