.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fluids/viscous_flow/plot_stokes_drag.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_viscous_flow_plot_stokes_drag.py: Stokes drag and the terminal velocity of a settling sphere ============================================================= In the creeping-flow limit :math:`Re = 2R|v|/\nu \ll 1`, the nonlinear advection term in the Navier-Stokes equations is negligible next to viscous diffusion, leaving the linear Stokes equations :math:`\mu\nabla^2\mathbf{u}=\nabla p` -- George Stokes' 1851 exact solution for uniform flow past a sphere of radius :math:`R`, giving a drag force .. math:: F_D = 6\pi\mu R v. A sphere of density :math:`\rho_s` settling under gravity through a fluid of density :math:`\rho_f` and viscosity :math:`\mu` reaches a terminal velocity :math:`v` where this drag exactly balances its net (gravity minus buoyancy) weight, .. math:: 6\pi\mu R v = \tfrac{4}{3}\pi R^3 (\rho_s - \rho_f)\,g. This example solves that balance for the terminal velocity across a range of sphere radii and checks, via :func:`~physicskit.fluids.utils.dimensionless.reynolds_number`, that Stokes' law remains a good approximation only while the resulting Reynolds number stays small -- exactly the regime the law assumes. .. GENERATED FROM PYTHON SOURCE LINES 30-38 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.fluids.systems.viscous_flow import stokes_drag from physicskit.fluids.utils.dimensionless import reynolds_number from physicskit.fluids.visualizers import theme .. GENERATED FROM PYTHON SOURCE LINES 39-43 Solve for the terminal velocity at each radius ------------------------------------------------- At terminal velocity, Stokes drag balances net weight: :math:`6\pi\mu R v = \tfrac{4}{3}\pi R^3 (\rho_s - \rho_f) g`. .. GENERATED FROM PYTHON SOURCE LINES 43-52 .. code-block:: Python mu, rho_fluid, rho_sphere, g = 1.0e-3, 1000.0, 2500.0, 9.81 # water, glass bead radii = np.geomspace(1e-5, 1e-3, 40) net_weight = (4.0 / 3.0) * np.pi * radii**3 * (rho_sphere - rho_fluid) * g v_terminal = net_weight / np.array([stokes_drag(mu, R, 1.0) for R in radii]) nu = mu / rho_fluid Re = np.array([reynolds_number(velocity=v, length=2 * R, nu=nu) for v, R in zip(v_terminal, radii)]) .. GENERATED FROM PYTHON SOURCE LINES 53-57 Plot terminal velocity and its Reynolds number ------------------------------------------------- The Reynolds number rises sharply with radius; Stokes' law is only self-consistent while it stays well below 1. .. GENERATED FROM PYTHON SOURCE LINES 57-76 .. code-block:: Python fig, axes = plt.subplots(1, 2, figsize=(10, 4)) axes[0].loglog(radii, v_terminal, color=theme.PRIMARY, marker="o", markersize=3) axes[0].set_xlabel("sphere radius (m)") axes[0].set_ylabel("terminal velocity (m/s)") axes[0].set_title("Stokes terminal velocity") axes[1].loglog(radii, Re, color=theme.ACCENT, marker="o", markersize=3) axes[1].axhline(1.0, color=theme.MUTED, ls="--", lw=1.0, label="Re = 1 (Stokes' law breaks down)") axes[1].set_xlabel("sphere radius (m)") axes[1].set_ylabel("Reynolds number") axes[1].legend() axes[1].set_title("Validity of Stokes' law") fig.tight_layout() valid = Re < 1.0 print(f"Stokes' law is self-consistent (Re < 1) for radii up to {radii[valid][-1] * 1e6:.1f} microns") plt.show() .. image-sg:: /api/gallery/fluids/viscous_flow/images/sphx_glr_plot_stokes_drag_001.png :alt: Stokes terminal velocity, Validity of Stokes' law :srcset: /api/gallery/fluids/viscous_flow/images/sphx_glr_plot_stokes_drag_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Stokes' law is self-consistent (Re < 1) for radii up to 52.2 microns .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.138 seconds) .. _sphx_glr_download_api_gallery_fluids_viscous_flow_plot_stokes_drag.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_stokes_drag.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_stokes_drag.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_stokes_drag.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_