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_constant_mach(

    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: float, R: float = 1716.0, alt_units: str = 'ft', density_units: str = 'slug/ft^3') float[source]

Freestream Density f$ rho_{infty} f$

Parameters:
altfloat

altitude in feet or meters

Rfloat; default=1716.

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

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

density_unitsstr; default=’slug/ft^3’

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

Returns:
rhofloat

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: float, mach: float, alt_units: str = 'ft', pressure_units: str = 'psf') float[source]

Freestream Dynamic Pressure f$ q_{infty} f$

Parameters:
altfloat

Altitude in alt_units

machfloat

Mach Number f$ M f$

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

pressure_unitsstr; default=’psf’

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

Returns:
dynamic_pressurefloat

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: float, alt_units: str = 'ft', visc_units: str = '(lbf*s)/ft^2') float[source]

Freestream Dynamic Viscosity f$ mu_{infty} f$

Parameters:
altfloat

Altitude in alt_units

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

visc_unitsstr; default=’(lbf*s)/ft^2’

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

Returns:
mufloat

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: float, mach: float, alt_units: str = 'ft', eas_units: str = 'ft/s') float[source]

Freestream equivalent airspeed

Parameters:
altfloat

altitude in alt_units

Machfloat

Mach Number

$ M
$
alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

eas_unitsstr; default=’ft/s’

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

Returns:
easfloat

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: float, alt_units: str = 'ft', visc_units: str = 'ft^2/s') float[source]

Freestream Kinematic Viscosity f$ nu_{infty} f$

Parameters:
altfloat

Altitude in alt_units

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

visc_unitsstr; default=’slug/ft^3’

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

Returns:
nufloat

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: float, V: float, alt_units: str = 'ft', velocity_units: str = 'ft/s') float[source]

Freestream Mach Number

Parameters:
altfloat

altitude in alt_units

Vfloat

Velocity in velocity_units

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

velocity_unitsstr; default=’ft/s’

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

Returns:
machfloat

Mach Number f$ M f$

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

Freestream Pressure f$ p_{infty} f$

Parameters:
altfloat

Altitude in alt_units

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

pressure_unitsstr; default=’psf’

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

Returns:
pressurefloat

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: float, alt_units: str = 'ft', velocity_units: str = 'ft/s', gamma: float = 1.4) float[source]

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

Parameters:
altfloat

Altitude in alt_units

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

velocity_unitsstr; default=’ft/s’

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

Returns:
speed_of_sound, afloat

Returns speed of sound in velocity_units

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

Freestream Temperature f$ T_{infty} f$

Parameters:
altfloat

Altitude in alt_units

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

temperature_unitsstr; default=’R’

the altitude units; R, K

Returns:
Tfloat

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: float, mach: float, alt_units: str = 'ft', reynolds_units: str = '1/ft') float[source]

Returns the Reynolds Number per unit length.

Parameters:
altfloat

Altitude in alt_units

machfloat

Mach Number f$ M f$

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

reynolds_unitsstr; default=’1/ft’

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

Returns:
ReynoldsNumber/Lfloat

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: float, mach: float, alt_units: str = 'ft', reynolds_units: str = '1/ft') float[source]

Returns the Reynolds Number per unit length.

Parameters:
altfloat

Altitude in alt_units

machfloat

Mach Number f$ M f$

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

reynolds_unitsstr; default=’1/ft’

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

Returns:
ReynoldsNumber/Lfloat

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 calculates the base quantities, so multiple calls to atm_press and atm_temp are not made

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

Freestream Velocity f$ V_{infty} f$

Parameters:
altfloat

altitude in alt_units

Machfloat

Mach Number f$ M f$

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

velocity_unitsstr; default=’ft/s’

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

Returns:
velocityfloat

Returns velocity in velocity_units

f[ large V = M a f]
pyNastran.utils.atmosphere.get_alt_for_density(density: float, density_units: str = 'slug/ft^3', alt_units: str = 'ft', nmax: int = 20, tol: float = 5.0) float[source]

Gets the altitude associated with a given air density.

Parameters:
densityfloat

the air density in slug/ft^3

density_unitsstr; default=’slug/ft^3’

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

alt_unitsstr; default=’ft’

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

nmaxint; default=20

max number of iterations for convergence

tolfloat; default=5.

tolerance in alt_units

Returns:
altfloat

the altitude in feet

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

Gets the altitude associated with a equivalent airspeed.

Parameters:
equivalent_airspeedfloat

the equivalent airspeed in velocity_units

machfloat

the mach to hold constant

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

nmaxint; default=20

max number of iterations for convergence

tolfloat; default=5.

tolerance in alt_units

Returns:
altfloat

the altitude in alt units

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

Gets the altitude associated with a pressure.

Parameters:
pressurefloat

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

pressure_unitsstr; default=’psf’

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

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

nmaxint; default=20

max number of iterations for convergence

tolfloat; default=5.

altitude tolerance in alt_units

Returns:
altfloat

the altitude in alt_units

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

Gets the altitude associated with a dynamic pressure.

Parameters:
qfloat

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

machfloat

the mach to hold constant

pressure_unitsstr; default=’psf’

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

alt_unitsstr; default=’ft’

the altitude units; ft, kft, m

nmaxint; default=20

max number of iterations for convergence

tolfloat; default=5.

tolerance in alt_units

Returns:
altfloat

the altitude in alt_units

pyNastran.utils.atmosphere.make_flfacts_alt_sweep_constant_mach(mach: float, alts: list[float], eas_limit: float = 1000.0, alt_units: str = 'm', velocity_units: str = 'm/s', density_units: str = 'kg/m^3', eas_units: str = 'm/s') tuple[NDArrayNfloat, NDArrayNfloat, NDArrayNfloat][source]

Makes a sweep across Mach number for a constant altitude.

Parameters:
machfloat

Mach Number

$ M
$
altslist[float]

Altitude in alt_units

eas_limitfloat

Equivalent airspeed limiter in eas_units

alt_unitsstr; default=’m’

the altitude units; ft, kft, m

velocity_unitsstr; default=’m/s’

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

density_unitsstr; default=’kg/m^3’

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

eas_unitsstr; default=’m/s’

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

pyNastran.utils.atmosphere.make_flfacts_eas_sweep_constant_alt(alt: float, eass: list[float], alt_units: str = 'm', velocity_units: str = 'm/s', density_units: str = 'kg/m^3', eas_units: str = 'm/s') tuple[NDArrayNfloat, NDArrayNfloat, NDArrayNfloat][source]

Makes a sweep across equivalent airspeed for a constant altitude.

Parameters:
altfloat

Altitude in alt_units

easslist[float]

Equivalent airspeed in eas_units

alt_unitsstr; default=’m’

the altitude units; ft, kft, m

velocity_unitsstr; default=’m/s’

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

density_unitsstr; default=’kg/m^3’

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

eas_unitsstr; default=’m/s’

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

pyNastran.utils.atmosphere.make_flfacts_eas_sweep_constant_mach(machs: np.ndarray, eass: np.ndarray, gamma: float = 1.4, alt_units: str = 'ft', velocity_units: str = 'ft/s', density_units: str = 'slug/ft^3', pressure_units: str = 'psf', eas_units: str = 'knots') tuple[NDArrayNfloat, NDArrayNfloat, NDArrayNfloat][source]

Veas = Vtrue * sqrt(rho/rho0) V = a * mach a = sqrt(gamma*R*T) p = rho*R*T -> rho = p/(R*T) V = Veas * sqrt(rho0 / rho)

Veas = mach * sqrt(gamma*R*T) * sqrt(p/(R*T*rho0)) Veas = mach * sqrt(gamma*p / rho0) Veas^2 / mach^2 = gamma * p / rho0 p = Veas^2 / mach^2 * rho0/gamma

pyNastran.utils.atmosphere.make_flfacts_mach_sweep_constant_alt(alt: float, machs: list[float], eas_limit: float = 1000.0, alt_units: str = 'm', velocity_units: str = 'm/s', density_units: str = 'kg/m^3', eas_units: str = 'm/s') tuple[NDArrayNfloat, NDArrayNfloat, NDArrayNfloat][source]

Makes a sweep across Mach number for a constant altitude.

Parameters:
altfloat

Altitude in alt_units

machslist[float]

Mach Number

$ M
$
eas_limitfloat

Equivalent airspeed limiter in eas_units

alt_unitsstr; default=’m’

the altitude units; ft, kft, m

velocity_unitsstr; default=’m/s’

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

density_unitsstr; default=’kg/m^3’

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

eas_unitsstr; default=’m/s’

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

pyNastran.utils.atmosphere.make_flfacts_tas_sweep_constant_alt(alt: float, tass: np.ndarray, eas_limit: float = 1000.0, alt_units: str = 'm', velocity_units: str = 'm/s', density_units: str = 'kg/m^3', eas_units: str = 'm/s') tuple[Any, Any, Any][source]

TODO: not validated

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

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

Parameters:
Tfloat

Temperature T is in Rankine

Returns:
mufloat

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