From 08d72659050ddaefbd4cbbed46d9e5f00497c64f Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 27 Nov 2024 22:49:12 +0100 Subject: [PATCH] atmosphere: fix pressure calculation (convert km to m) --- doc/research.md | 8 ++++---- src/nature.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/research.md b/doc/research.md index 62c3515..1935a83 100644 --- a/doc/research.md +++ b/doc/research.md @@ -79,10 +79,10 @@ Based on Figure 27 from SRC1, and Figure 28 using the middle of the 3 temperatur ### Regression analysis -- 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) +- 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) ### Designing the in-game atmosphere diff --git a/src/nature.rs b/src/nature.rs index 843eb0c..3c5cb5b 100644 --- a/src/nature.rs +++ b/src/nature.rs @@ -278,11 +278,11 @@ pub fn jupiter_altitude_to_pressure(altitude: f64) -> f64 { if a >= 1e6 { return 0.0; } else if a >= 350e3 { - return (-8.0920583983 - 0.0066339143 * a).exp(); + return (-8.0920583983 - 0.0000066339143 * a).exp(); } else if a >= 50e3 { - return (-0.969198983 - 0.027000953 * a).exp(); + return (-0.969198983 - 0.000027000953 * a).exp(); } else if a >= -125e3 { - return (0.0626589359 - 0.0473755348 * a).exp(); + return (0.0626589359 - 0.0000473755348 * a).exp(); } - return -715.5577817531 * a - 89044.7227191413; + return -0.7155577817531 * a - 89044.7227191413; }