.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/aerodynamics/compressible/plot_01_laplace_speed_of_sound.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_compressible_plot_01_laplace_speed_of_sound.py: Newton, Laplace and the speed of sound ====================================== Newton's *Principia* (1687) predicted the speed of sound assuming the compressions are isothermal, :math:`a = \sqrt{p/\rho} = \sqrt{RT}`, about 15% below measurement. Pierre-Simon Laplace (1816) argued that the compressions are too fast to exchange heat, so they are adiabatic and the stiffness rises by :math:`\gamma`: :math:`a = \sqrt{\gamma R T}` (:func:`~engineeringkit.aerodynamics.speed_of_sound`). The Mach number (:func:`~engineeringkit.aerodynamics.mach_number`) measures speed in units of this local sound speed. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.aerodynamics import R_AIR, isa_atmosphere, mach_number, speed_of_sound .. GENERATED FROM PYTHON SOURCE LINES 22-24 Isothermal versus adiabatic --------------------------- .. GENERATED FROM PYTHON SOURCE LINES 24-33 .. code-block:: Python T = np.linspace(200, 320, 121) newton = np.sqrt(R_AIR * T) laplace = speed_of_sound(1.4, R_AIR, T) a_measured_20C = 343.2 a_laplace = float(speed_of_sound(1.4, R_AIR, 293.15)) print(f"at 293.15 K: Newton {np.sqrt(R_AIR * 293.15):.1f} m/s, Laplace {a_laplace:.1f} m/s, measured {a_measured_20C} m/s") assert np.allclose(laplace / newton, np.sqrt(1.4)) .. rst-class:: sphx-glr-script-out .. code-block:: none at 293.15 K: Newton 290.1 m/s, Laplace 343.2 m/s, measured 343.2 m/s .. GENERATED FROM PYTHON SOURCE LINES 34-36 The same airspeed is a higher Mach number at altitude ----------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 36-50 .. code-block:: Python h = np.linspace(0, 20000, 81) state = isa_atmosphere(h) fig, axes = plt.subplots(1, 2, figsize=(9, 3.6)) axes[0].plot(T, newton, label="Newton (isothermal)") axes[0].plot(T, laplace, label="Laplace (adiabatic)") axes[0].plot(293.15, a_measured_20C, "ko", label="measured, 20 °C") axes[0].set(xlabel="temperature [K]", ylabel="speed of sound [m/s]") axes[0].legend() axes[1].plot(mach_number(250.0, state.speed_of_sound), h / 1e3) axes[1].set(xlabel="Mach number at 250 m/s", ylabel="altitude [km]", title="ISA") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/aerodynamics/compressible/images/sphx_glr_plot_01_laplace_speed_of_sound_001.png :alt: ISA :srcset: /api/gallery/aerodynamics/compressible/images/sphx_glr_plot_01_laplace_speed_of_sound_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.201 seconds) .. _sphx_glr_download_api_gallery_aerodynamics_compressible_plot_01_laplace_speed_of_sound.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/compressible/plot_01_laplace_speed_of_sound.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_laplace_speed_of_sound.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_laplace_speed_of_sound.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_laplace_speed_of_sound.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_