FEATool Multiphysics
v1.10 Finite Element Analysis Toolbox |

Shallow Water Equations

Saint-Venant shallow water equations is a simplified model of fluid flow with a free surface. The non-conservative form of the equations read

\[ \left\{\begin{array}{l} \frac{\partial h}{\partial t} + (u\frac{\partial h}{\partial x} + v\frac{\partial h}{\partial y} ) + (h+H)(\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y}) = 0 \\ \frac{\partial u}{\partial t} + (u\frac{\partial u}{\partial x} + v\frac{\partial u}{\partial y} ) = -g\frac{\partial h}{\partial x} \\ \frac{\partial v}{\partial t} + (u\frac{\partial v}{\partial x} + v\frac{\partial v}{\partial y} ) = -g\frac{\partial h}{\partial y} \end{array}\right. \]

where *h* is the unknown free surface height relative to the mean level *H*.

This model is available as an automated tutorial by selecting **Model Examples and Tutorials...** > **Classic PDE** > **Shallow Water Equations** from the **File** menu. Or alternatively, follow the step-by-step instructions below.

- To start a new model click the
**New Model**toolbar button, or select*New Model...*from the*File*menu.

Both the *Custom Equation* and *Convection and Diffusion* physics modes are used in this example.

- Select the
**Custom Equation**physics mode from the*Select Physics*drop-down menu. - Enter
`h`

into the*Dependent Variable Names*edit field. - Press
**OK**to finish the physics mode selection. - Select
**Rectangle**from the*Geometry*menu. - Enter
`0`

into the*x*edit field._{min} - Enter
`5`

into the*x*edit field._{max} - Enter
`0`

into the*y*edit field._{min} - Enter
`1`

into the*y*edit field._{max} - Press
**OK**to finish and close the dialog box. - Switch to
**Grid**mode by clicking on the corresponding*Mode Toolbar*button. - Enter
`0.2`

into the*Grid Size*edit field. - Press the
**Generate**button to call the grid generation algorithm. - Switch to
**Equation**mode by clicking on the corresponding*Mode Toolbar*button. - Press the
**edit**button.

Define the equation for the height with a small disturbance as initial condition.

- Enter
`h' + (u*hx_t + v*hy_t) + (h+H)*(ux_t+vy_t) = 0`

into the*Equation for h*edit field. - Press
**OK**to finish and close the dialog box. - Enter
`0.2*exp(-((x-4)^2))`

into the*Initial condition for h*edit field.

Add two *Convection and Diffusion* physics modes for the two velocity components. Although the *Custom Equation* physics mode could also be used, the *Convection and Diffusion* physics modes feature pre-defined equations and convective stabilization which is necessary for these equations.

- Switch to the
**+**tab. - Select the
**Convection and Diffusion**physics mode from the*Select Physics*drop-down menu. - Enter
`u`

into the*Dependent Variable Names*edit field. - Press the
**Add Physics >>>**button. - Enter
`0`

into the*Diffusion coefficient*edit field. - Enter
`u`

into the*Convection velocity in x-direction*edit field. - Enter
`v`

into the*Convection velocity in y-direction*edit field. - Enter
`-g*hx`

into the*Reaction rate*edit field. - Press the
**Artificial Stabilization**button. - Select the
**Check to enable shock capturing**check box. - Select
**High order**from the*Shock capturing discretization order*drop-down menu. - Press
**OK**to finish and close the dialog box. - Switch to the
**+**tab. - Select the
**Convection and Diffusion**physics mode from the*Select Physics*drop-down menu. - Enter
`v`

into the*Dependent Variable Names*edit field. - Press the
**Add Physics >>>**button. - Enter
`0`

into the*Diffusion coefficient*edit field. - Enter
`u`

into the*Convection velocity in x-direction*edit field. - Enter
`v`

into the*Convection velocity in y-direction*edit field. - Enter
`-g*hy`

into the*Reaction rate*edit field. - Press the
**Artificial Stabilization**button. - Select the
**Check to enable shock capturing**check box. - Select
**High order**from the*Shock capturing discretization order*drop-down menu. - Press
**OK**to finish and close the dialog box. - Press
**OK**to finish the equation and subdomain settings specification.

Define the two constants for the mean fluid level *H = 1*, and the gravitational constant *g = 9.8*.

- Switch to
**Boundary**mode by clicking on the corresponding*Mode Toolbar*button.

The height *h* should not be constrained and should therefore be prescribed homogeneous Neumann conditions everywhere

- Select
**1**,**2**,**3**, and**4**in the*Boundaries*list box. - Select the
**Neumann, g_h**radio button. - Switch to the
**cd**tab.

A wall with zero velocities is prescribed at the right end, and the top and bottom boundaries are assumed to be symmetric (zero normal flow).

- Select
**4**in the*Boundaries*list box. - Select
**Concentration**from the*Convection and Diffusion*drop-down menu. - Switch to the
**cd2**tab. - Select
**1**,**3**, and**4**in the*Boundaries*list box. - Select
**Concentration**from the*Convection and Diffusion 2*drop-down menu. - Press
**OK**to finish the boundary condition specification. - Switch to
**Solve**mode by clicking on the corresponding*Mode Toolbar*button. - Press the
**Settings***Toolbar*button.

Select the **Time-Dependent** solver with the following parameters.

- Enter
`1e-3`

into the*Non-linear stopping criteria for solution differences (changes) between iterations*edit field. - Enter
`0.01`

into the*Time step size*edit field. - Enter
`1.5`

into the*Duration of time-dependent simulation (maximum time)*edit field. - Press the
**Solve**button.

Once the solver is done, turn on the height plot for *h* and visualize the free surface for different times.

- Press the
**Plot Options***Toolbar*button. - Select the
**Height Expression**check box. - Press
**OK**to plot and visualize the selected postprocessing options.

The *shallow water equations* fluid dynamics model has now been completed and can be saved as a binary (.fea) model file, or exported as a programmable MATLAB m-script text file, or GUI script (.fes) file.