.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fluid_engineering/open_channel/plot_01_manning_formula.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_open_channel_plot_01_manning_formula.py: Manning's open-channel formula (1889) ===================================== Robert Manning, chief engineer of the Irish Board of Works, compared the open-channel formulas of his day against the best measurements in 1889 and proposed that the mean velocity of uniform flow is :math:`V = R^{2/3}S^{1/2}/n` in SI units (:func:`~engineeringkit.fluid_engineering.manning_velocity`), with :math:`R` the hydraulic radius (:func:`~engineeringkit.fluid_engineering.hydraulic_radius`), :math:`S` the bed slope and :math:`n` a roughness coefficient. It is Chézy's formula :math:`V = C\sqrt{RS}` with :math:`C = R^{1/6}/n`. This example finds the normal depth of a concrete channel and checks whether the flow is subcritical. .. GENERATED FROM PYTHON SOURCE LINES 19-25 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from scipy import optimize from engineeringkit.fluid_engineering import froude_number, hydraulic_radius, manning_flow, manning_velocity .. GENERATED FROM PYTHON SOURCE LINES 26-30 Rating curve of a rectangular channel ------------------------------------- A concrete channel (:math:`n = 0.013`) 3 m wide on a slope of 1 in 1000. .. GENERATED FROM PYTHON SOURCE LINES 30-40 .. code-block:: Python n, b, S = 0.013, 3.0, 1e-3 y = np.linspace(0.05, 2.5, 100) Q = manning_flow(n, b * y, b + 2 * y, S) fig, ax = plt.subplots(figsize=(6, 4)) ax.plot(Q, y) ax.set(xlabel="flow [m³/s]", ylabel="normal depth [m]", title="Rating curve, n = 0.013, S = 0.001") fig.tight_layout() .. image-sg:: /api/gallery/fluid_engineering/open_channel/images/sphx_glr_plot_01_manning_formula_001.png :alt: Rating curve, n = 0.013, S = 0.001 :srcset: /api/gallery/fluid_engineering/open_channel/images/sphx_glr_plot_01_manning_formula_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-45 Normal depth for a design flow ------------------------------ Manning's formula is solved for the depth that carries 10 m³/s. .. GENERATED FROM PYTHON SOURCE LINES 45-55 .. code-block:: Python Q_design = 10.0 y_n = optimize.brentq(lambda d: manning_flow(n, b * d, b + 2 * d, S) - Q_design, 0.01, 10.0) R = hydraulic_radius(b * y_n, b + 2 * y_n) V = manning_velocity(n, R, S) Fr = froude_number(V, y_n) ax.plot(Q_design, y_n, "ko") print(f"normal depth {y_n:.3f} m, R = {R:.3f} m, V = {V:.2f} m/s, Fr = {Fr:.2f}") print("subcritical: disturbances travel upstream" if Fr < 1 else "supercritical") .. rst-class:: sphx-glr-script-out .. code-block:: none normal depth 1.619 m, R = 0.779 m, V = 2.06 m/s, Fr = 0.52 subcritical: disturbances travel upstream .. GENERATED FROM PYTHON SOURCE LINES 56-61 Chézy's coefficient ------------------- Manning's :math:`C = R^{1/6}/n` changes slowly with depth, which is why Chézy's constant-C formula worked within a single river. .. GENERATED FROM PYTHON SOURCE LINES 61-70 .. code-block:: Python C = R ** (1 / 6) / n print(f"Chézy C = {C:.1f} m^(1/2)/s") assert np.isclose(manning_flow(n, b * y_n, b + 2 * y_n, S), Q_design) assert np.isclose(V, C * np.sqrt(R * S)) assert Fr < 1 and np.all(np.diff(Q) > 0) plt.show() .. rst-class:: sphx-glr-script-out .. code-block:: none Chézy C = 73.8 m^(1/2)/s .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.027 seconds) .. _sphx_glr_download_api_gallery_fluid_engineering_open_channel_plot_01_manning_formula.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/open_channel/plot_01_manning_formula.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_manning_formula.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_manning_formula.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_manning_formula.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_