atmosphere Module

Contains the following atmospheric functions:

  • density = atm_density(alt, mach)
  • mach = atm_mach(alt, velocity)
  • velocity = atm_velocity(alt, mach)
  • pressure = atm_pressure(alt)
  • temperature = atm_temperature(alt)
  • sos = atm_speed_of_sound(alt)
  • mu = atm_dynamic_viscosity_mu(alt)
  • nu = atm_kinematic_viscosity_nu(alt)
  • eas = atm_equivalent_airspeed(alt, mach)
  • rho, machs, velocity = make_flfacts_alt_sweep(
    mach, alts, eas_limit=1000., alt_units=’m’, velocity_units=’m/s’, density_units=’kg/m^3’, eas_units=’m/s’)
  • rho, machs, velocity = make_flfacts_mach_sweep(
    alt, machs, eas_limit=1000., alt_units=’m’, velocity_units=’m/s’, density_units=’kg/m^3’, eas_units=’m/s’)

All the default units are in English units because the source equations are in English units.

pyNastran.utils.atmosphere.atm_density(alt, R=1716.0, alt_units='ft', density_units='slug/ft^3')[source]

Freestream Density f$ rho_{infty} f$

Parameters:
alt : float

altitude in feet or meters

R : float; default=1716.

gas constant for air in english units (???)

alt_units : str; default=’ft’

the altitude units; ft, kft, m

density_units : str; default=’slug/ft^3’

the density units; slug/ft^3, slinch/in^3, kg/m^3

Returns:
rho : float

density f$ rho f$ in density_units

Based on the formula P=pRT
f[ large rho=frac{p}{R T} f]
pyNastran.utils.atmosphere.atm_dynamic_pressure(alt, mach, alt_units='ft', pressure_units='psf')[source]

Freestream Dynamic Pressure f$ q_{infty} f$

Parameters:
alt : float

Altitude in alt_units

mach : float

Mach Number f$ M f$

alt_units : str; default=’ft’

the altitude units; ft, kft, m

pressure_units : str; default=’psf’

the pressure units; psf, psi, Pa, kPa, MPa

Returns:
dynamic_pressure : float

Returns dynamic pressure in pressure_units

The common method that requires many calculations…
f[ large q = frac{1}{2} rho V^2 f]
f[ large p = rho R T f]
f[ large M = frac{V}{a} f]
f[ large a = sqrt{gamma R T} f]
so…
f[ large q = frac{gamma}{2} p M^2 f]
pyNastran.utils.atmosphere.atm_dynamic_viscosity_mu(alt, alt_units='ft', visc_units='(lbf*s)/ft^2')[source]

Freestream Dynamic Viscosity f$ mu_{infty} f$

Parameters:
alt : float

Altitude in alt_units

alt_units : str; default=’ft’

the altitude units; ft, kft, m

visc_units : str; default=’(lbf*s)/ft^2’

the viscosity units; (lbf*s)/ft^2, (N*s)/m^2, Pa*s

Returns:
mu : float

dynamic viscosity f$ mu_{infty} f$ in (lbf*s)/ft^2 or (N*s)/m^2 (SI)

See also

sutherland_viscoscity ..

pyNastran.utils.atmosphere.atm_equivalent_airspeed(alt, mach, alt_units='ft', eas_units='ft/s')[source]
Freestream equivalent airspeed
Parameters:
alt : float

altitude in alt_units

Mach : float

Mach Number

$ M
$
alt_units : str; default=’ft’

the altitude units; ft, kft, m

eas_units : str; default=’ft/s’

the equivalent airspeed units; ft/s, m/s, in/s, knots

Returns:
eas : float

equivalent airspeed in eas_units

EAS = TAS * sqrt(rho/rho0) p = rho * R * T rho = p/(RT) rho/rho0 = p/T * T0/p0 TAS = a * M EAS = a * M * sqrt(p/T * T0/p0) EAS = a * M * sqrt(p*T0 / (T*p0))

pyNastran.utils.atmosphere.atm_kinematic_viscosity_nu(alt, alt_units='ft', visc_units='ft^2/s')[source]

Freestream Kinematic Viscosity f$ nu_{infty} f$

Parameters:
alt : float

Altitude in alt_units

alt_units : str; default=’ft’

the altitude units; ft, kft, m

visc_units : str; default=’slug/ft^3’

the kinematic viscosity units; ft^2/s, m^2/s

Returns:
nu : float

kinematic viscosity f$ nu_{infty} f$ in visc_units

f[ large nu = frac{mu}{rho} f]

See also

sutherland_viscoscity ..

Todo

better debug ..

pyNastran.utils.atmosphere.atm_mach(alt, V, alt_units='ft', velocity_units='ft/s')[source]

Freestream Mach Number

Parameters:
alt : float

altitude in alt_units

V : float

Velocity in velocity_units

alt_units : str; default=’ft’

the altitude units; ft, kft, m

velocity_units : str; default=’ft/s’

the velocity units; ft/s, m/s, in/s, knots

Returns:
mach : float

Mach Number f$ M f$

f[ large M = frac{V}{a} f]
pyNastran.utils.atmosphere.atm_pressure(alt, alt_units='ft', pressure_units='psf')[source]

Freestream Pressure f$ p_{infty} f$

Parameters:
alt : float

Altitude in alt_units

alt_units : str; default=’ft’

the altitude units; ft, kft, m

pressure_units : str; default=’psf’

the pressure units; psf, psi, Pa, kPa, MPa

Returns:
pressure : float

Returns pressure in pressure_units

Note

from BAC-7006-3352-001-V1.pdf # Bell Handbook of Aerodynamic Heatingn page ~236 - Table C.1n These equations were used b/c they are valid to 300k ft.n Extrapolation is performed above that.n

pyNastran.utils.atmosphere.atm_speed_of_sound(alt, alt_units='ft', velocity_units='ft/s', gamma=1.4)[source]

Freestream Speed of Sound f$ a_{infty} f$

Parameters:
alt : float

Altitude in alt_units

alt_units : str; default=’ft’

the altitude units; ft, kft, m

velocity_units : str; default=’ft/s’

the velocity units; ft/s, m/s, in/s, knots

Returns:
speed_of_sound, a : float

Returns speed of sound in velocity_units

f[ large a = sqrt{gamma R T} f]
pyNastran.utils.atmosphere.atm_temperature(alt, alt_units='ft', temperature_units='R')[source]

Freestream Temperature f$ T_{infty} f$

Parameters:
alt : float

Altitude in alt_units

alt_units : str; default=’ft’

the altitude units; ft, kft, m

temperature_units : str; default=’R’

the altitude units; R, K

Returns:
T : float

temperature in degrees Rankine or Kelvin (SI)

Note

from BAC-7006-3352-001-V1.pdf # Bell Handbook of Aerodynamic Heatingn page ~236 - Table C.1n These equations were used because they are valid to 300k ft.n Extrapolation is performed above that.

pyNastran.utils.atmosphere.atm_unit_reynolds_number(alt, mach, alt_units='ft', reynolds_units='1/ft')[source]

Returns the Reynolds Number per unit length.

Parameters:
alt : float

Altitude in alt_units

mach : float

Mach Number f$ M f$

alt_units : str; default=’ft’

the altitude units; ft, kft, m

reynolds_units : str; default=‘1/ft’

the altitude units; 1/ft, 1/m, 1/in

Returns:
ReynoldsNumber/L : float

Reynolds number per unit length in reynolds_units

f[ large Re = frac{ rho V L}{mu} f]
f[ large Re_L = frac{ rho V }{mu} f]
pyNastran.utils.atmosphere.atm_unit_reynolds_number2(alt, mach, alt_units='ft', reynolds_units='1/ft')[source]

Returns the Reynolds Number per unit length.

Parameters:
alt : float

Altitude in alt_units

mach : float

Mach Number f$ M f$

alt_units : str; default=’ft’

the altitude units; ft, kft, m

reynolds_units : str; default=‘1/ft’

the altitude units; 1/ft, 1/m, 1/in

Returns:
ReynoldsNumber/L : float

the Reynolds Number per unit length

f[ large Re_L = frac{ rho V}{mu} = frac{p M a}{mu R T} f]

Note

this version of Reynolds number directly caculates the base quantities, so multiple calls to atm_press and atm_temp are not made

pyNastran.utils.atmosphere.atm_velocity(alt, mach, alt_units='ft', velocity_units='ft/s')[source]

Freestream Velocity f$ V_{infty} f$

Parameters:
alt : float

altitude in alt_units

Mach : float

Mach Number f$ M f$

alt_units : str; default=’ft’

the altitude units; ft, kft, m

velocity_units : str; default=’ft/s’

the velocity units; ft/s, m/s, in/s, knots

Returns:
velocity : float

Returns velocity in velocity_units

f[ large V = M a f]
pyNastran.utils.atmosphere.convert_altitude(alt, alt_units_in, alt_units_out)[source]

nominal unit is ft

pyNastran.utils.atmosphere.convert_density(density, density_units_in, density_units_out)[source]

nominal unit is slug/ft^3

pyNastran.utils.atmosphere.convert_pressure(pressure, pressure_units_in, pressure_units_out)[source]

nominal unit is psf

pyNastran.utils.atmosphere.convert_velocity(velocity, velocity_units_in, velocity_units_out)[source]

nominal unit is ft/s

pyNastran.utils.atmosphere.get_alt_for_density(density, density_units='slug/ft^3', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a given air density.

Parameters:
density : float

the air density in slug/ft^3

density_units : str; default=’slug/ft^3’

the density units; slug/ft^3, slinch/in^3, kg/m^3

alt_units : str; default=’ft’

sets the units for the output altitude; ft, m, kft

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in feet

pyNastran.utils.atmosphere.get_alt_for_eas_with_constant_mach(equivalent_airspeed, mach, velocity_units='ft/s', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a equivalent airspeed.

Parameters:
equivalent_airspeed : float

the equivalent airspeed in velocity_units

mach : float

the mach to hold constant

alt_units : str; default=’ft’

the altitude units; ft, kft, m

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in alt units

pyNastran.utils.atmosphere.get_alt_for_pressure(pressure, pressure_units='psf', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a pressure.

Parameters:
pressure : float

the pressure lb/ft^2 (SI=Pa)

pressure_units : str; default=’psf’

the pressure units; psf, psi, Pa, kPa, MPa

alt_units : str; default=’ft’

the altitude units; ft, kft, m

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in alt_units

pyNastran.utils.atmosphere.get_alt_for_q_with_constant_mach(q, mach, pressure_units='psf', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a dynamic pressure.

Parameters:
q : float

the dynamic pressure lb/ft^2 (SI=Pa)

mach : float

the mach to hold constant

pressure_units : str; default=’psf’

the pressure units; psf, psi, Pa, kPa, MPa

alt_units : str; default=’ft’

the altitude units; ft, kft, m

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in alt_units

pyNastran.utils.atmosphere.make_flfacts_alt_sweep(mach, alts, eas_limit=1000.0, alt_units='m', velocity_units='m/s', density_units='kg/m^3', eas_units='m/s')[source]
Makes a sweep across altitude for a constant Mach number.
Parameters:
alt : List[float]

Altitude in alt_units

Mach : float

Mach Number

$ M
$
eas_limit : float

Equivalent airspeed limiter in eas_units

alt_units : str; default=’m’

the altitude units; ft, kft, m

velocity_units : str; default=’m/s’

the velocity units; ft/s, m/s, in/s, knots

density_units : str; default=’kg/m^3’

the density units; slug/ft^3, slinch/in^3, kg/m^3

eas_units : str; default=’m/s’

the equivalent airspeed units; ft/s, m/s, in/s, knots

pyNastran.utils.atmosphere.make_flfacts_eas_sweep(alt, eass, alt_units='m', velocity_units='m/s', density_units='kg/m^3', eas_units='m/s')[source]

Makes a sweep across equivalent airspeed for a constant altitude.

Parameters:
alt : float

Altitude in alt_units

eass : List[float]

Equivalent airspeed in eas_units

alt_units : str; default=’m’

the altitude units; ft, kft, m

velocity_units : str; default=’m/s’

the velocity units; ft/s, m/s, in/s, knots

density_units : str; default=’kg/m^3’

the density units; slug/ft^3, slinch/in^3, kg/m^3

eas_units : str; default=’m/s’

the equivalent airspeed units; ft/s, m/s, in/s, knots

pyNastran.utils.atmosphere.make_flfacts_mach_sweep(alt, machs, eas_limit=1000.0, alt_units='m', velocity_units='m/s', density_units='kg/m^3', eas_units='m/s')[source]
Makes a sweep across Mach number for a constant altitude.
Parameters:
alt : float

Altitude in alt_units

Machs : List[float]

Mach Number

$ M
$
eas_limit : float

Equivalent airspeed limiter in eas_units

alt_units : str; default=’m’

the altitude units; ft, kft, m

velocity_units : str; default=’m/s’

the velocity units; ft/s, m/s, in/s, knots

density_units : str; default=’kg/m^3’

the density units; slug/ft^3, slinch/in^3, kg/m^3

eas_units : str; default=’m/s’

the equivalent airspeed units; ft/s, m/s, in/s, knots

pyNastran.utils.atmosphere.sutherland_viscoscity(T)[source]

Helper function that calculates the dynamic viscosity f$ mu f$ of air at a given temperature.

Parameters:
T : float

Temperature T is in Rankine

Returns:
mu : float

dynamic viscosity f$ mu f$ of air in (lbf*s)/ft^2

Note

prints a warning if T>5400 deg R

Sutherland’s Equationn
From Aerodynamics for Engineers 4th Editionn
John J. Bertin 2002n
page 6 eq 1.5bn