.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/Analytic_Solutions_Height/plot_as_h_u_stoker.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_auto_examples_Analytic_Solutions_Height_plot_as_h_u_stoker.py: Analytical solution of a dam-break problem on a wet bed without friction (Stocker) ============================================================================================= This example presents the one-dimensional analytical solution proposed by Stocker for the dam-break problem on a wet, horizontal bed without friction. Model Assumptions ----------------- - Instantaneous dam break at position :math:`x = x_0` and at time :math:`t = 0`. - The bed is flat and horizontal (no slope). - No bed friction is considered. - A finite volume of still water of height :math:`h_0` is located to the left of the dam at :math:`0 < x \leq x_0`. - A shallow layer of water of height :math:`h_r` (with :math:`h_r < h_0`) exists to the right of the dam (:math:`x_0 < x`). - The fluid is incompressible and inviscid, subject only to gravity. Initial Conditions ------------------ .. math:: h(x, 0) = \begin{cases} h_0 > 0 & \text{for } 0 < x \leq x_0, \\\\ 0 < h_r < h_0 & \text{for } x_0 < x, \end{cases} .. math:: u(x, 0) = 0 where :math:`x_0` is the initial dam location and :math:`h_0` is the height of the water column at the left of the dam and :math:`h_r` is the height of the water column at the right of the dam. Analytical Solution ------------------- The water height and velocity profiles for :math:`t > 0` are given by: .. math:: h(x, t) = \begin{cases} h_0 & \text{if } x \leq x_A(t), \\\\ \frac{\left( 2 \sqrt{g h_0} - \frac{x}{t} \right)^2}{9 g} & \text{if } x_A(t) < x \leq x_B(t), \\\\ h_m = \frac{1}{2} h_r \left( \sqrt{1 + \frac{8 c_m^2}{g h_r}} - 1 \right) & \text{if } x_B(t) < x \leq x_C(t), \\\\ h_r & \text{if } x_C(t) < x, \end{cases} .. math:: u(x,t) = \begin{cases} 0 & \text{if } x \leq x_A(t), \\\\ \frac{2}{3} \left( \frac{x}{t} + \sqrt{g h_0} \right) & \text{if } x_A(t) < x \leq x_B(t), \\\\ 2 \sqrt{g h_0} - 2 \sqrt{g h_m} & \text{if } x_B(t) < x \leq x_C(t), \\\\ 0 & \text{if } x_C(t) < x, \end{cases} where the locations separating the flow regions evolve in time according to: .. math:: \begin{cases} x_A(t) = - t \sqrt{g h_0}, \\\\ x_B(t) = t \left( 2 \sqrt{g h_0} - 3 \sqrt{g h_m} \right), \\\\ x_C(t) = c_m t \end{cases} with :math:`c_m` is the front shock wave speed, obtained as the solution of the nonlinear equation: .. math:: c_m h_r - h_r \left( \sqrt{1 + \frac{8 c_m^2}{g h_r}} - 1 \right) \left( \frac{c_m}{2} - \sqrt{g h_0} + \sqrt{\frac{g h_r}{2} \left( \sqrt{1 + \frac{8 c_m^2}{g h_r}} - 1 \right)} \right) = 0 Implementation -------------- .. GENERATED FROM PYTHON SOURCE LINES 79-81 First import required packages and define the spatial domain for visualization. For following examples we will use a 1D space from -5.5 to 6 m. .. GENERATED FROM PYTHON SOURCE LINES 81-86 .. code-block:: Python import numpy as np from tilupy.analytic_sol import Stoker_SARKHOSH_wet x = np.linspace(-5.5, 6, 1000) .. GENERATED FROM PYTHON SOURCE LINES 87-88 ------------------- .. GENERATED FROM PYTHON SOURCE LINES 91-93 Case: Stocker's solution with dam at :math:`x_0 = 0 m`, initial fluid height :math:`h_0 = 0.5 m` and initial domain height :math:`h_r = 0.05 m` .. GENERATED FROM PYTHON SOURCE LINES 93-96 .. code-block:: Python case = Stoker_SARKHOSH_wet(h_0=0.5, h_r=0.025) .. GENERATED FROM PYTHON SOURCE LINES 97-98 Compute and plot fluid height at times :math:`t = {0, 0.5, 1, 1.5, 2} s`. .. GENERATED FROM PYTHON SOURCE LINES 98-102 .. code-block:: Python case.compute_h(x, [0, 0.5, 1, 1.5, 2]) ax = case.plot(show_h=True, linestyles=["", ":", "-.", "--", "-"]) .. image-sg:: /auto_examples/Analytic_Solutions_Height/images/sphx_glr_plot_as_h_u_stoker_001.png :alt: Flow height for t=[0, 0.5, 1, 1.5, 2] :srcset: /auto_examples/Analytic_Solutions_Height/images/sphx_glr_plot_as_h_u_stoker_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 103-104 Compute and plot fluid velocity at times :math:`t = {0, 0.5, 1, 1.5, 2} s`. .. GENERATED FROM PYTHON SOURCE LINES 104-107 .. code-block:: Python case.compute_u(x, [0, 0.5, 1, 1.5, 2]) ax = case.plot(show_u=True, linestyles=["", ":", "-.", "--", "-"]) .. image-sg:: /auto_examples/Analytic_Solutions_Height/images/sphx_glr_plot_as_h_u_stoker_002.png :alt: Flow velocity for t=[0, 0.5, 1, 1.5, 2] :srcset: /auto_examples/Analytic_Solutions_Height/images/sphx_glr_plot_as_h_u_stoker_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 108-109 ------------------- .. GENERATED FROM PYTHON SOURCE LINES 112-116 Original reference: Stoker, J.J., 1957, Water Waves: The Mathematical Theory with Applications, Pure and Applied Mathematics, vol. 4, Interscience Publishers, New York, USA. .. GENERATED FROM PYTHON SOURCE LINES 119-130 Papier original (pas d'accès) https://www.researchgate.net/publication/230513364_Water_Waves_The_Mathematical_Theory_with_Applications Code matlab: https://github.com/psarkhosh/Stoker_solution Article utilisant les travaux https://www.mdpi.com/2073-4441/15/21/3841# Article domaine humide sur pente inclinée (pas d'accès) https://ascelibrary.org/doi/10.1061/%28ASCE%29HY.1943-7900.0001683 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.118 seconds) .. _sphx_glr_download_auto_examples_Analytic_Solutions_Height_plot_as_h_u_stoker.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_as_h_u_stoker.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_as_h_u_stoker.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_as_h_u_stoker.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_