Skip to content

"StandardAtmosphere" environment pressure calculation #318

Closed
@MateusStano

Description

@MateusStano

Describe the bug

Looking at how the pressure function is calculated for "StandardAtmosphere" I found that lines 2672 and 2673 are incoherent:

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

# 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

Labels

Help wantedExtra attention is needed

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions