ambiance package

Submodules

ambiance.ambiance module

Compute atmospheric properties for heights ranging from -5 km to 80 km.

The implementation is based on the ICAO standard atmosphere from 1993.

References:

ICAO93(1,2)

International Civil Aviation Organization ; Manual Of The ICAO Standard Atmosphere – 3rd Edition 1993 (Doc 7488) – extended to 80 kilometres (262 500 feet)

WISA19

Wikipedia ; International Standard Atmosphere ; https://en.wikipedia.org/wiki/International_Standard_Atmosphere Accessed: 2019-07-28

class ambiance.ambiance.Atmosphere(h, check_bounds=True)

Bases: object

Representation of the ICAO standard atmosphere (1993)

  • All input and output is using SI units

  • The main constructor takes the geometric (actual) height as input

  • Single values, vectors or matrices are accepted as input

Usage:

Compute a properties such as pressure for a given height:

>>> Atmosphere(0).pressure
array([101325.])

Values out of valid height range will not be computed:

>>> Atmosphere(-6e3)
Traceback (most recent call last):
    ...
ValueError: Value out of bounds. Lower limit: -5004 m. Upper limit: 81020 m.

Create an atmosphere object with given support points (heights in metre):

>>> atmos = Atmosphere([0, 1000, 5000, 17777, 35e3, 80e3])
>>>

Compute basic properties such as density, temperature or pressure:

>>> atmos.density
array([1.22500002e+00, 1.11165967e+00, 7.36428613e-01, 1.25975595e-01,
       8.46333291e-03, 1.84578859e-05])
>>> atmos.temperature
array([288.15      , 281.65102237, 255.67554322, 216.65      ,
       236.51337209, 198.63857625])
>>> atmos.pressure
array([1.01325000e+05, 8.98762776e+04, 5.40482622e+04, 7.83442282e+03,
       5.74591263e+02, 1.05246447e+00])
property H

Geopotential heights \(H\)

static T2t(T)

Convert from temperature \(T\) in Kelvin to \(t\) in degree Celsius

\(t = T - T_i\)

property collision_frequency

Collision frequency \(\omega\)

property density

Air density \(\rho\)

property dynamic_viscosity

Dynamic viscosity \(\mu\)

classmethod from_density(rho)

Return a new instance for given density value(s)

classmethod from_pressure(p)

Return a new instance for given pressure value(s)

static geom2geop_height(h)

Convert geometric height \(h\) to geopotential height \(H\)

\(H = \frac{r h}{r + h}\)

static geop2geom_height(H)

Convert geopotential height \(H\) to geometric height \(h\)

\(h = \frac{r H}{r - H}\)

property grav_accel

Gravitational acceleration \(g\)

property h

Geometric heights \(h\)

property kinematic_viscosity

Kinematic viscosity \(\nu\)

property layer_name

Get layer names as strings

property layer_nums

Array of same shape as ‘self.H’ with layer numbers (int)

property mean_free_path

Mean free path \(l\)

property mean_particle_speed

Mean particle speed \(\bar{\nu}\)

property number_density

Number density \(n\)

property pressure

Air pressure \(p\)

property pressure_scale_height

Pressure scale height \(H_p\)

property specific_weight

Specific weight \(\gamma\)

property speed_of_sound

Speed of sound \(a\)

static t2T(t)

Convert from temperature \(t\) in degree Celsius to \(T\) in Kelvin

\(T = t + T_i\)

property temperature

Air temperature \(T\) in Kelvin

property temperature_in_celsius

Air temperature \(t\) in Celsius

property thermal_conductivity

Thermal conductivity \(\lambda\)

class ambiance.ambiance.CONST

Bases: object

Constants defined in the ICAO standard atmosphere (1993)

Notes:
  • All values are given in SI-units.

Attributes:
g_0

Standard gravitational acceleration [m/s^2]

M_0

Sea level molar mass [kg/mol]

N_A

Avogadro constant [1/mol]

P_0

Sea level atmospheric pressure [Pa]

R_star

Universal gas constant [J/(K*mol)]

R

Specific gas constant [J/(K*kg)]

S

Sutherland’s empirical constant in the equation for dynamic viscosity [K]

T_i

Temperature of the ice point at mean sea level [K]

T_0

Sea level temperature [K]

t_i

Celsius temperature of the ice point at mean sea level [degC]

t_0

Celsius sea level temperature [degC]

beta_s

Sutherland’s empirical constant in the equation for dynamic viscosity [kg/(m*s*K**(1/2))]

kappa

Adiabatic index [-]

rho_0

Sea level atmospheric density [kg/m^3]

sigma

Effective collision diameter of an air molecule [m]

r

Nominal Earth’s radius [m]

h_min

Lower boundary of acceptable geometric heights [m]

h_max

Upper boundary of acceptable geometric heights [m]

H_min

Lower boundary of acceptable geopotential heights [m]

H_max

Upper boundary of acceptable geopotential heights [m]

p_min

Lower boundary of acceptable pressures [Pa]

p_max

Upper boundary of acceptable pressures [Pa]

rho_min

Lower boundary of acceptable densities [kg/m^3]

rho_max

Upper boundary of acceptable densities [kg/m^3]

LAYER_SPEC_PROP

Table containing layer specific properties

LAYER_DICTS

Dictionary containing layer specific properties

Notes on ‘LAYER_SPEC_PROP’:
  • Table with columns
    1. H_b

      geopotential base height [m]

    2. T_b

      base temperature [K]

    3. beta

      base temperature gradient [kg/(m*s*K^(1/2))]

    4. p

      base pressure [Pa]

    5. layer name

      string representation of layer name

  • Values for (1,2,3) from table D in [ICAO93]

  • Values for (4) for pressure from [ICAO93]

  • Values for (5) from [WISA19]

H_base = 71000.0
H_max = 80000
H_min = -5000
H_top = 80000.0
LAYER_DICTS = {1: {'H_base': -5000.0, 'H_top': 0.0, 'T': 320.65, 'beta': -0.0065, 'name': 'troposphere', 'p': 177687.0}, 2: {'H_base': 0.0, 'H_top': 11000.0, 'T': 288.15, 'beta': -0.0065, 'name': 'troposphere', 'p': 101325.0}, 3: {'H_base': 11000.0, 'H_top': 20000.0, 'T': 216.65, 'beta': 0.0, 'name': 'tropopause', 'p': 22632.0}, 4: {'H_base': 20000.0, 'H_top': 32000.0, 'T': 216.65, 'beta': 0.001, 'name': 'stratosphere', 'p': 5474.87}, 5: {'H_base': 32000.0, 'H_top': 47000.0, 'T': 228.65, 'beta': 0.0028, 'name': 'stratosphere', 'p': 868.014}, 6: {'H_base': 47000.0, 'H_top': 51000.0, 'T': 270.65, 'beta': 0.0, 'name': 'stratopause', 'p': 110.906}, 7: {'H_base': 51000.0, 'H_top': 71000.0, 'T': 270.65, 'beta': -0.0028, 'name': 'mesosphere', 'p': 66.9384}, 8: {'H_base': 71000.0, 'H_top': 80000.0, 'T': 214.65, 'beta': -0.002, 'name': 'mesosphere', 'p': 3.95639}}
LAYER_NUM_FIRST = 1
LAYER_NUM_LAST = 8
LAYER_SPEC_PROP = [[-5000.0, 320.65, -0.0065, 177687.0, 'troposphere'], [0.0, 288.15, -0.0065, 101325.0, 'troposphere'], [11000.0, 216.65, 0.0, 22632.0, 'tropopause'], [20000.0, 216.65, 0.001, 5474.87, 'stratosphere'], [32000.0, 228.65, 0.0028, 868.014, 'stratosphere'], [47000.0, 270.65, 0.0, 110.906, 'stratopause'], [51000.0, 270.65, -0.0028, 66.9384, 'mesosphere'], [71000.0, 214.65, -0.002, 3.95639, 'mesosphere'], [80000.0, 196.65, -0.002, 0.886272, 'mesosphere']]
MAX_STR_LEN_LAYER_NAME = 12
M_0 = 0.02896442
N_A = 6.02257e+23
P_0 = 101325.0
R = 287.05287
R_star = 8.31432
S = 110.4
T = 214.65
T_0 = 288.15
T_i = 273.15
beta = -0.002
beta_s = 1.458e-06
g_0 = 9.80665
h_max = 81020
h_min = -5004
i = 8
kappa = 1.4
layer_name = 'mesosphere'
layer_pair = ([71000.0, 214.65, -0.002, 3.95639, 'mesosphere'], [80000.0, 196.65, -0.002, 0.886272, 'mesosphere'])
p = 3.95639
p_max = 177837.4089432764
p_min = 0.886216717024069
r = 6356766
rho_0 = 1.225
rho_max = 1.9317906916235779
rho_min = 1.569949463833277e-05
sigma = 3.65e-10
t_0 = 15.0
t_i = 0.0
ambiance.ambiance.pairwise(iterable)

Iterate pairwise

s -> (s0,s1), (s1,s2), (s2, s3), …

See: https://docs.python.org/3/library/itertools.html

Module contents