-
-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Labels
Help wantedExtra attention is neededExtra attention is needed
Milestone
Description
Describe the bug
Looking at how the pressure function is calculated for "StandardAtmosphere" I found that lines 2672 and 2673 are incoherent:
RocketPy/rocketpy/Environment.py
Lines 2670 to 2707 in 48d6949
| def pressure_function(h): | |
| # Convert geometric to geopotential height | |
| H = ER * h / (ER + h) | |
| H = h | |
| if H < -2000: | |
| return pressure[0] | |
| elif H > 80000: | |
| return pressure[-1] | |
| # Find layer that contains height h | |
| layer = bisect.bisect(geopotential_height, H) - 1 | |
| # Retrieve layer base geopotential height, temp, beta and pressure | |
| Hb = geopotential_height[layer] | |
| Tb = temperature[layer] | |
| Pb = pressure[layer] | |
| B = beta[layer] | |
| # Compute presure | |
| if B != 0: | |
| P = Pb * (1 + (B / Tb) * (H - Hb)) ** (-g / (B * R)) | |
| else: | |
| T = Tb + B * (H - Hb) | |
| P = Pb * np.exp(-(H - Hb) * (g / (R * T))) | |
| # Return answer | |
| return P | |
| # Save international standard atmosphere pressure profile | |
| self.pressureISA = Function( | |
| pressure_function, | |
| inputs="Height Above Sea Level (m)", | |
| outputs="Pressure (Pa)", | |
| ) | |
| return None | |
The same thing happens in 2654 and 2655
RocketPy/rocketpy/Environment.py
Lines 2652 to 2656 in 48d6949
| # Convert geopotential height to geometric height | |
| ER = self.earthRadius | |
| height = [ER * H / (ER - H) for H in geopotential_height] | |
| height = geopotential_height | |
Additional context
I believe @giovaniceotto might know what is going on here.
This issue continues the discussion on #313.
Metadata
Metadata
Assignees
Labels
Help wantedExtra attention is neededExtra attention is needed