.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fluids/vortex_dynamics/plot_vortex_pair.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_vortex_dynamics_plot_vortex_pair.py: Co-rotating pair versus translating dipole ============================================= An isolated point vortex of circulation :math:`\Gamma` induces a purely azimuthal velocity of magnitude :math:`\Gamma/(2\pi r)` at distance `r` (the 2D Biot-Savart law); for two vortices separated by distance :math:`d`, this is exactly the speed each one advects with, carried by the field of the *other*. What the pair then does depends only on the relative sign of their circulation. Equal circulations :math:`\Gamma` each orbit the common midpoint at radius :math:`d/2`, so their induced speed :math:`\Gamma/(2\pi d)` translates into a rigid-body angular velocity .. math:: \Omega = \frac{\Gamma/(2\pi d)}{d/2} = \frac{\Gamma}{\pi d^2}. Opposite circulations :math:`\pm\Gamma` instead induce velocity in the *same* direction on each other (a "vortex dipole"), so the pair self-propels together in a straight line at constant speed .. math:: v = \frac{\Gamma}{2\pi d}, perpendicular to the line joining them, advecting each other sideways forever rather than orbiting. Both trajectories come from exactly the same :class:`~physicskit.fluids.systems.vortex_dynamics.PointVortexSystem` -- only the sign of one circulation changes between them. .. GENERATED FROM PYTHON SOURCE LINES 31-38 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.fluids.systems.vortex_dynamics import PointVortexSystem from physicskit.fluids.visualizers import theme .. GENERATED FROM PYTHON SOURCE LINES 39-43 A co-rotating pair -------------------- Equal circulations orbit their midpoint at angular velocity :math:`\Omega = \Gamma / (\pi d^2)`. .. GENERATED FROM PYTHON SOURCE LINES 43-49 .. code-block:: Python Gamma, d = 1.0, 1.0 pair = PointVortexSystem(positions=[[d / 2, 0.0], [-d / 2, 0.0]], circulations=[Gamma, Gamma]) period = 2 * np.pi / (Gamma / (np.pi * d**2)) _, trajectory_pair = pair.trajectory(dt=period / 2000, n_steps=2000) .. GENERATED FROM PYTHON SOURCE LINES 50-54 A translating dipole ---------------------- Equal and opposite circulations instead translate together at constant speed :math:`\Gamma / (2\pi d)`, perpendicular to the line joining them. .. GENERATED FROM PYTHON SOURCE LINES 54-59 .. code-block:: Python dipole = PointVortexSystem(positions=[[0.0, d / 2], [0.0, -d / 2]], circulations=[Gamma, -Gamma]) travel_time = 4.0 * d / (Gamma / (2 * np.pi * d)) _, trajectory_dipole = dipole.trajectory(dt=travel_time / 2000, n_steps=2000) .. GENERATED FROM PYTHON SOURCE LINES 60-62 Plot both trajectories ------------------------- .. GENERATED FROM PYTHON SOURCE LINES 62-83 .. code-block:: Python fig, axes = plt.subplots(1, 2, figsize=(11, 5)) axes[0].plot(trajectory_pair[:, 0, 0], trajectory_pair[:, 0, 1], color=theme.PRIMARY, label="vortex 1") axes[0].plot(trajectory_pair[:, 1, 0], trajectory_pair[:, 1, 1], color=theme.ACCENT, label="vortex 2") axes[0].set_aspect("equal") axes[0].set_title("Co-rotating pair (same sign): rigid orbit") axes[0].legend() axes[1].plot(trajectory_dipole[:, 0, 0], trajectory_dipole[:, 0, 1], color=theme.PRIMARY, label="vortex 1") axes[1].plot(trajectory_dipole[:, 1, 0], trajectory_dipole[:, 1, 1], color=theme.ACCENT, label="vortex 2") axes[1].set_aspect("equal") axes[1].set_title("Vortex dipole (opposite sign): self-propulsion") axes[1].legend() fig.tight_layout() separation_pair = np.hypot(*(trajectory_pair[-1, 0] - trajectory_pair[-1, 1]).T) separation_dipole = np.hypot(*(trajectory_dipole[-1, 0] - trajectory_dipole[-1, 1]).T) print(f"pair separation: started at {d:.3f}, ended at {separation_pair:.3f} (conserved by rigid rotation)") print(f"dipole separation: started at {d:.3f}, ended at {separation_dipole:.3f} (conserved by rigid translation)") plt.show() .. image-sg:: /api/gallery/fluids/vortex_dynamics/images/sphx_glr_plot_vortex_pair_001.png :alt: Co-rotating pair (same sign): rigid orbit, Vortex dipole (opposite sign): self-propulsion :srcset: /api/gallery/fluids/vortex_dynamics/images/sphx_glr_plot_vortex_pair_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none pair separation: started at 1.000, ended at 1.000 (conserved by rigid rotation) dipole separation: started at 1.000, ended at 1.000 (conserved by rigid translation) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.060 seconds) .. _sphx_glr_download_api_gallery_fluids_vortex_dynamics_plot_vortex_pair.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_vortex_pair.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_vortex_pair.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_vortex_pair.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_