.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/aerodynamics/atmosphere/plot_01_international_standard_atmosphere.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_aerodynamics_atmosphere_plot_01_international_standard_atmosphere.py: The International Standard Atmosphere ===================================== Aircraft performance depends on air density, which changes with weather. Albert Toussaint proposed a reference atmosphere in 1919, and ICAO adopted the International Standard Atmosphere in 1952: a 6.5 K/km linear lapse to the tropopause at 11 km, then an isothermal layer. Hydrostatic balance and the ideal-gas law give closed-form pressure and density (:func:`~engineeringkit.aerodynamics.isa_atmosphere`). This example checks hydrostatic balance numerically and shows how thin air raises the stall speed. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.aerodynamics import isa_atmosphere, stall_speed .. GENERATED FROM PYTHON SOURCE LINES 21-23 Profiles and the hydrostatic check ---------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 23-35 .. code-block:: Python h = np.linspace(0, 20000, 401) state = isa_atmosphere(h) residual = np.gradient(state.pressure, h) + state.density * 9.80665 print(f"max |dp/dh + rho g| / (rho g) = {np.max(np.abs(residual[1:-1] / (state.density[1:-1] * 9.80665))):.1e}") for km in [0, 5, 11, 20]: s = isa_atmosphere(km * 1e3) print(f"{km:2d} km: T = {float(s.temperature):6.2f} K, p = {float(s.pressure):8.0f} Pa, rho = {float(s.density):.4f} kg/m^3") fig, axes = state.plot() fig.suptitle("International Standard Atmosphere") fig.tight_layout() .. image-sg:: /api/gallery/aerodynamics/atmosphere/images/sphx_glr_plot_01_international_standard_atmosphere_001.png :alt: International Standard Atmosphere :srcset: /api/gallery/aerodynamics/atmosphere/images/sphx_glr_plot_01_international_standard_atmosphere_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none max |dp/dh + rho g| / (rho g) = 3.7e-04 0 km: T = 288.15 K, p = 101325 Pa, rho = 1.2250 kg/m^3 5 km: T = 255.65 K, p = 54020 Pa, rho = 0.7361 kg/m^3 11 km: T = 216.65 K, p = 22632 Pa, rho = 0.3639 kg/m^3 20 km: T = 216.65 K, p = 5475 Pa, rho = 0.0880 kg/m^3 .. GENERATED FROM PYTHON SOURCE LINES 36-38 True stall speed rises with altitude ------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 38-45 .. code-block:: Python fig, ax = plt.subplots(figsize=(5, 3.6)) ax.plot(stall_speed(10_000.0, state.density, 16.0, 1.6), h / 1e3) ax.set(xlabel="stall true airspeed [m/s]", ylabel="altitude [km]", title="W = 10 kN, S = 16 m², $C_{L,max}$ = 1.6") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/aerodynamics/atmosphere/images/sphx_glr_plot_01_international_standard_atmosphere_002.png :alt: W = 10 kN, S = 16 m², $C_{L,max}$ = 1.6 :srcset: /api/gallery/aerodynamics/atmosphere/images/sphx_glr_plot_01_international_standard_atmosphere_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.288 seconds) .. _sphx_glr_download_api_gallery_aerodynamics_atmosphere_plot_01_international_standard_atmosphere.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/aerodynamics/atmosphere/plot_01_international_standard_atmosphere.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_international_standard_atmosphere.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_international_standard_atmosphere.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_international_standard_atmosphere.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_