.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fluids/water_waves/plot_kelvin_ship_wake.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_fluids_water_waves_plot_kelvin_ship_wake.py: Kelvin's ship wake: the 19.47 degree wedge ========================================== Kelvin (1887) explained the V of waves behind a ship in deep water. A ship moving at speed :math:`U` keeps pace only with waves whose crests move along with it: a wave travelling at angle :math:`\theta` to the track needs :math:`c(k) = U\cos\theta`, so that :math:`k = g/(U^2\cos^2\theta)`. Adding these waves up by stationary phase leaves crests along .. math:: x = -\frac{2\pi n U^2}{g}\cos\theta\,(1 + \sin^2\theta), \qquad y = \frac{2\pi n U^2}{g}\cos^2\theta\,\sin\theta . They form *transverse* waves across the track, spaced :math:`2\pi U^2/g` apart, and *diverging* waves along the arms. The two families meet in cusps on the lines :math:`|y/x| = 1/(2\sqrt2)`, a half-angle of :math:`\arcsin(1/3) = 19.47^\circ`. Since :math:`U` only sets the length scale, the angle is the same for a duck and for a supertanker. .. GENERATED FROM PYTHON SOURCE LINES 24-33 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.fluids.systems.water_waves import kelvin_wake, phase_velocity g = 9.81 alpha = np.arcsin(1 / 3) .. GENERATED FROM PYTHON SOURCE LINES 34-39 The crest pattern ----------------- The cusps (red) of every crest lie on the two dashed lines at :math:`\pm 19.47^\circ`, the edge of the wake. .. GENERATED FROM PYTHON SOURCE LINES 39-60 .. code-block:: Python U = 5.0 wake = kelvin_wake(U, n_crests=6, n_points=4001) fig, ax = plt.subplots(figsize=(12, 5)) t = wake.cusp_theta for n, c in enumerate(wake.crests, start=1): ax.plot(c[:, 0], c[:, 1], color="C0", lw=1.4) a = n * wake.transverse_wavelength for sgn in (1, -1): ax.plot(-a * np.cos(t) * (1 + np.sin(t) ** 2), sgn * a * np.cos(t) ** 2 * np.sin(t), "r.", ms=6) xs = np.array([0.0, 1.05 * wake.crests[-1][:, 0].min()]) ax.plot(xs, np.tan(alpha) * xs, "k--", lw=1, label=r"$\pm\arcsin(1/3) = 19.47^\circ$") ax.plot(xs, -np.tan(alpha) * xs, "k--", lw=1) ax.plot(0, 0, "k>", ms=12, label=f"ship, U = {U:g} m/s") ax.set_aspect("equal") ax.set_xlabel("x (m)") ax.set_ylabel("y (m)") ax.set_title(f"Kelvin wake: transverse wavelength {wake.transverse_wavelength:.1f} m") ax.legend(loc="upper left", fontsize=8) fig.tight_layout() .. image-sg:: /api/gallery/fluids/water_waves/images/sphx_glr_plot_kelvin_ship_wake_001.png :alt: Kelvin wake: transverse wavelength 16.0 m :srcset: /api/gallery/fluids/water_waves/images/sphx_glr_plot_kelvin_ship_wake_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 61-67 Where the angle comes from -------------------------- Along a crest, :math:`|y/x| = \cos\theta\sin\theta/(1 + \sin^2\theta)`. It is largest at :math:`\sin^2\theta = 1/3`, where it equals :math:`1/(2\sqrt2)`. No crest reaches further from the track. .. GENERATED FROM PYTHON SOURCE LINES 67-78 .. code-block:: Python theta = np.linspace(0, np.pi / 2, 2001) slope = np.cos(theta) * np.sin(theta) / (1 + np.sin(theta) ** 2) fig2, axes = plt.subplots(1, 2, figsize=(12, 4)) axes[0].plot(np.degrees(theta), np.degrees(np.arctan(slope)), lw=2) axes[0].axhline(np.degrees(alpha), color="k", ls="--") axes[0].axvline(np.degrees(wake.cusp_theta), color="r", ls=":", label=r"$\sin^2\theta = 1/3$") axes[0].set_xlabel(r"wave direction $\theta$ (degrees)") axes[0].set_ylabel("angle of crest point from track (degrees)") axes[0].legend(fontsize=8) .. image-sg:: /api/gallery/fluids/water_waves/images/sphx_glr_plot_kelvin_ship_wake_002.png :alt: plot kelvin ship wake :srcset: /api/gallery/fluids/water_waves/images/sphx_glr_plot_kelvin_ship_wake_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 79-83 The same wedge at every speed ----------------------------- Doubling the speed quadruples the wavelength, yet the wedge is unchanged. .. GENERATED FROM PYTHON SOURCE LINES 83-97 .. code-block:: Python speeds = np.array([1.0, 2.0, 5.0, 10.0, 20.0]) angles = [np.degrees(kelvin_wake(u, n_crests=1, n_points=20001).half_angle) for u in speeds] lams = [kelvin_wake(u, n_crests=1).transverse_wavelength for u in speeds] axes[1].loglog(speeds, lams, "o-", label="transverse wavelength (m)") axes[1].loglog(speeds, 2 * np.pi * speeds**2 / g, "k:", label=r"$2\pi U^2/g$") ax_r = axes[1].twinx() ax_r.plot(speeds, angles, "s--", color="C1") ax_r.set_ylim(0, 30) ax_r.set_ylabel("half-angle (degrees)", color="C1") axes[1].set_xlabel("U (m/s)") axes[1].legend(fontsize=8, loc="upper left") fig2.tight_layout() .. GENERATED FROM PYTHON SOURCE LINES 98-103 Check ----- The half-angle is arcsin(1/3) = 19.47 degrees at every speed, the cusps sit at sin^2(theta) = 1/3, and the transverse waves have the wavelength of a deep-water wave moving at the ship's speed, 2 pi U^2 / g. .. GENERATED FROM PYTHON SOURCE LINES 103-109 .. code-block:: Python assert np.allclose(angles, np.degrees(alpha), atol=1e-5) assert round(float(np.degrees(alpha)), 2) == 19.47 assert abs(np.max(slope) - 1 / (2 * np.sqrt(2))) < 1e-6 assert abs(np.sin(wake.cusp_theta) ** 2 - 1 / 3) < 1e-12 assert np.allclose(lams, 2 * np.pi * speeds**2 / g) assert abs(phase_velocity(2 * np.pi / wake.transverse_wavelength) - U) < 1e-12 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.130 seconds) .. _sphx_glr_download_api_gallery_fluids_water_waves_plot_kelvin_ship_wake.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_kelvin_ship_wake.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_kelvin_ship_wake.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_kelvin_ship_wake.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_