.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fluid_engineering/plot_fluid_engineering_benchmark.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_plot_fluid_engineering_benchmark.py: Poiseuille profile and volume flow ================================== Integrate the laminar parabolic velocity profile over a circular cross section and compare it with the volume-flow helper. The radius dependence is fourth power. .. GENERATED FROM PYTHON SOURCE LINES 8-26 .. image-sg:: /api/gallery/fluid_engineering/images/sphx_glr_plot_fluid_engineering_benchmark_001.png :alt: plot fluid engineering benchmark :srcset: /api/gallery/fluid_engineering/images/sphx_glr_plot_fluid_engineering_benchmark_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from scipy.integrate import trapezoid from engineeringkit.fluid_engineering import poiseuille_flow radius, length, mu, dp = 0.005, 1, 0.001, 10 r = np.linspace(0, radius, 10001) v = dp * (radius**2 - r**2) / (4 * mu * length) Q = poiseuille_flow(dp, radius, length, mu) assert np.isclose(trapezoid(2 * np.pi * r * v, r), Q, rtol=1e-7) assert np.isclose(poiseuille_flow(dp, 2 * radius, length, mu), 16 * Q) fig, ax = plt.subplots() ax.plot(r * 1000, v) ax.set(xlabel="radial position [mm]", ylabel="axial speed [m/s]") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.062 seconds) .. _sphx_glr_download_api_gallery_fluid_engineering_plot_fluid_engineering_benchmark.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/plot_fluid_engineering_benchmark.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_fluid_engineering_benchmark.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_fluid_engineering_benchmark.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_fluid_engineering_benchmark.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_