blob: 48f9bd12ba420dd9aaa59597b748c3b1310b2294 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import math
class Atmosphere():
def __init__(self, avg_sea_level_pressure: int, molar_mass_air: float, standard_temp: float):
self.avg_sea_level_pressure = avg_sea_level_pressure
self.molar_mass_air = molar_mass_air
self.standard_temp = standard_temp
#https://math24.net/barometric-formula.html
def density_at_height(self, height: int, g: float) -> None:
R = 8.3144598 #universal gas constant
pressure = self.avg_sea_level_pressure * math.e ** (-(self.molar_mass_air * g * height)/(R * self.standard_temp))
density = pressure / (R * 10000)
return density
|