.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/aerodynamics/compressible/plot_08_prandtl_meyer_expansion.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_08_prandtl_meyer_expansion.py: The Prandtl-Meyer expansion fan (1907-1908) =========================================== Ludwig Prandtl (1907) and his student Theodor Meyer (1908) showed that a supersonic stream turning *away* from itself around a corner expands isentropically through a centred fan of Mach waves. The turning angle that takes a sonic stream to Mach :math:`M` is the Prandtl-Meyer function :math:`\nu(M)` (:func:`~engineeringkit.aerodynamics.prandtl_meyer_angle`), so a turn by :math:`\theta` sets :math:`\nu(M_2) = \nu(M_1) + \theta` (:func:`~engineeringkit.aerodynamics.prandtl_meyer_expansion`). Combined with Meyer's oblique shocks this gives *shock-expansion theory*, which this example applies to a flat plate at incidence and checks against Ackeret's linear supersonic lift :math:`c_l = 4\alpha/\sqrt{M^2-1}`. .. GENERATED FROM PYTHON SOURCE LINES 18-30 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.aerodynamics import ( oblique_shock, prandtl_meyer_angle, prandtl_meyer_expansion, stagnation_pressure, ) gamma = 1.4 .. GENERATED FROM PYTHON SOURCE LINES 31-33 Expansion round a 20° corner at Mach 1.5 ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 33-39 .. code-block:: Python M2 = float(prandtl_meyer_expansion(1.5, np.radians(20.0))) p_ratio = float(stagnation_pressure(1.0, 1.5) / stagnation_pressure(1.0, M2)) print(f"nu(1.5) = {np.degrees(prandtl_meyer_angle(1.5)):.2f} deg -> M2 = {M2:.3f}, p2/p1 = {p_ratio:.4f}") assert np.isclose(np.degrees(prandtl_meyer_angle(M2) - prandtl_meyer_angle(1.5)), 20.0) .. rst-class:: sphx-glr-script-out .. code-block:: none nu(1.5) = 11.91 deg -> M2 = 2.207, p2/p1 = 0.3398 .. GENERATED FROM PYTHON SOURCE LINES 40-46 Shock-expansion theory for a flat plate --------------------------------------- The upper surface turns away from the stream through a fan and the lower surface turns into it through an oblique shock. The pressure difference acts normal to the plate. .. GENERATED FROM PYTHON SOURCE LINES 46-73 .. code-block:: Python def flat_plate_cl(M, alpha): p_inf = 1.0 p0 = stagnation_pressure(p_inf, M, gamma) upper = stagnation_pressure(1.0, prandtl_meyer_expansion(M, alpha, gamma), gamma) p_upper = p0 / upper p_lower = p_inf * oblique_shock(M, alpha, gamma).pressure_ratio q = gamma / 2 * p_inf * M**2 return (p_lower - p_upper) / q * np.cos(alpha) alpha = np.radians(np.linspace(0.5, 15, 30)) fig, ax = plt.subplots(figsize=(7, 4)) for M in (2.0, 3.0, 4.0): exact = np.array([flat_plate_cl(M, a) for a in alpha]) (line,) = ax.plot(np.degrees(alpha), exact, label=f"shock-expansion, M = {M:g}") ax.plot(np.degrees(alpha), 4 * alpha / np.sqrt(M**2 - 1), "--", color=line.get_color()) ax.set(xlabel="angle of attack [deg]", ylabel="$c_l$", title="Flat plate: shock-expansion (solid) vs linear theory (dashed)") ax.legend() fig.tight_layout() small = np.radians(1.0) print(f"M = 2, alpha = 1 deg: c_l = {flat_plate_cl(2.0, small):.5f}, linear theory {4 * small / np.sqrt(3):.5f}") assert np.isclose(flat_plate_cl(2.0, small), 4 * small / np.sqrt(3), rtol=0.01) plt.show() .. image-sg:: /api/gallery/aerodynamics/compressible/images/sphx_glr_plot_08_prandtl_meyer_expansion_001.png :alt: Flat plate: shock-expansion (solid) vs linear theory (dashed) :srcset: /api/gallery/aerodynamics/compressible/images/sphx_glr_plot_08_prandtl_meyer_expansion_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none M = 2, alpha = 1 deg: c_l = 0.04031, linear theory 0.04031 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.200 seconds) .. _sphx_glr_download_api_gallery_aerodynamics_compressible_plot_08_prandtl_meyer_expansion.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_08_prandtl_meyer_expansion.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_08_prandtl_meyer_expansion.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_08_prandtl_meyer_expansion.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_08_prandtl_meyer_expansion.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_