.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fluid_engineering/measurement/plot_02_venturi_meter.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_fluid_engineering_measurement_plot_02_venturi_meter.py: Venturi's tube (1797) ===================== Giovanni Battista Venturi reported in 1797 that water flowing through a contraction drops in pressure at the narrowest point and recovers most of it in a gentle expansion. Clemens Herschel turned the effect into the Venturi water meter in 1887: continuity and Bernoulli's equation give the flow from the pressure drop between inlet and throat, :math:`Q = C_d A_2\sqrt{2\Delta p/[\rho(1 - (A_2/A_1)^2)]}` (:func:`~engineeringkit.fluid_engineering.venturi_flow`). This example draws the pressure along a meter and reads the flow back from it. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.fluid_engineering import bernoulli_pressure, continuity_velocity, venturi_flow .. GENERATED FROM PYTHON SOURCE LINES 22-28 Pressure along the meter ------------------------ A 150 mm pipe narrows to a 75 mm throat over 0.2 m and widens again over 0.6 m, carrying 30 L/s of water. Without losses the pressure follows the area. .. GENERATED FROM PYTHON SOURCE LINES 28-44 .. code-block:: Python rho, Q, p_in = 998.0, 0.030, 200e3 x = np.linspace(0, 1.0, 201) d = np.interp(x, [0, 0.1, 0.3, 0.35, 0.95, 1.0], [0.15, 0.15, 0.075, 0.075, 0.15, 0.15]) A = np.pi * d**2 / 4 v = continuity_velocity(A[0], Q / A[0], A) p = bernoulli_pressure(p_in, rho, v[0], v) fig, ax = plt.subplots(figsize=(6, 4)) ax.plot(x, p / 1e3) ax.set(xlabel="position [m]", ylabel="pressure [kPa]", title="Ideal pressure along a Venturi meter") fig.tight_layout() dp = p[0] - p.min() print(f"throat speed {v.max():.2f} m/s, pressure drop {dp / 1e3:.1f} kPa") .. image-sg:: /api/gallery/fluid_engineering/measurement/images/sphx_glr_plot_02_venturi_meter_001.png :alt: Ideal pressure along a Venturi meter :srcset: /api/gallery/fluid_engineering/measurement/images/sphx_glr_plot_02_venturi_meter_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none throat speed 6.79 m/s, pressure drop 21.6 kPa .. GENERATED FROM PYTHON SOURCE LINES 45-50 Reading the flow ---------------- The meter inverts the pressure drop. A real tube reads about 2% low because of friction, which the discharge coefficient corrects. .. GENERATED FROM PYTHON SOURCE LINES 50-59 .. code-block:: Python A1, A2 = A[0], A.min() print(f"ideal meter: {1e3 * venturi_flow(dp, rho, A1, A2):.2f} L/s") print(f"with C_d = 0.98: {1e3 * venturi_flow(dp, rho, A1, A2, 0.98):.2f} L/s") assert np.isclose(venturi_flow(dp, rho, A1, A2), Q) assert np.isclose(p[-1], p_in) and np.isclose(v.max(), 4 * v[0]) plt.show() .. rst-class:: sphx-glr-script-out .. code-block:: none ideal meter: 30.00 L/s with C_d = 0.98: 29.40 L/s .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.025 seconds) .. _sphx_glr_download_api_gallery_fluid_engineering_measurement_plot_02_venturi_meter.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/fluid_engineering/measurement/plot_02_venturi_meter.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_venturi_meter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_venturi_meter.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_venturi_meter.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_