## Lid-Driven Cavity

**Time: 6 min |**

###### A benchmark case for validating computational methods for fluid dynamic problems

This example demonstrates how to define the lid-driven cavity benchmark in the field of computational fluid dynamics. In the model setup, a 2D square cavity has a tangentially moving wall that induces a large vortex in the center of the cavity, and small vortices in the corners. The results show the velocity field for different values of the Reynolds number. The velocity profile and size and location of the vortices are compared to a paper by Ghia et al.

### Introduction

The lid-driven cavity is a benchmark case for validating computational methods for fluid dynamics problems. The problem consists of a 2D square cavity in which the upper wall has a tangential velocity. This movement induces a flow characterized by a large vortex in the center of the cavity and smaller vortices in the corners. The magnitude of the Reynolds number affects the size and number of vortices in the flow. This model demonstrates how to define the boundary conditions for this problem in COMSOL Multiphysics. Additionally, it compares results for the velocity profile as well as the size and location of the vortices to a paper published by Ghia et al.

### Model Definition

The lid-driven cavity problem is most elegantly modeled using a nondimensional form of the Navier-Stokes equations. Laminar Flow physics in COMSOL Multiphysics solve the traditional Navier-Stokes equations. For an incompressible stationary flow with no body forces, they are defined as:

$ \displaystyle \rho \left( {\vec{u}.\nabla } \right)\vec{u}=\ -\nabla p+\mu {{\nabla }^{2}}\vec{u}$

By nondimensionalizing the velocity ($ \displaystyle {{\vec{u}}^{*}}=\frac{u}{v}$), pressure ($ \displaystyle {{p}^{*}}=p/(\rho {{v}^{2}})$), and length scale ($ \displaystyle {{\vec{r}}^{}}=\frac{r}{L},{{\nabla }^{}}=L\nabla $), the nondimensional Navier-Stokes equations can be written as:

$ \displaystyle \left( {{{{\vec{u}}}^{}}.{{\nabla }^{}}} \right){{\vec{u}}^{}}=-\nabla {{p}^{}}+\frac{1}{{\operatorname{Re}}}{{\left( {{{\nabla }^{}}} \right)}^{2}}{{\vec{u}}^{}}$

Where $ \displaystyle \operatorname{Re}=\left( {\rho vL} \right)/\mu $ is the Reynolds number.

The advantage to solving with the nondimensional form of the Navier-Stokes equations is that the flow can be characterized as a function of the Reynolds number only. Comparing the two forms of the Navier-Stokes equations, the values for the density and viscosity can be chosen appropriately such that the nondimensional form is solved in COMSOL Multiphysics.

The geometry consists of a square cavity with a side length of 1, which is the characteristic length scale for the flow. The density of the fluid is set to 1 while the viscosity is defined as 1/ Re.

For boundary conditions, the upper wall is prescribed as a moving wall with a horizontal velocity of 1. The remaining boundaries are considered to be no slip walls (zero velocity). A pressure point constraint is used to create a well-defined problem. This condition is necessary for steady state analyses in closed systems since none of the boundary conditions fix the value of pressure in the domain.

A mapped mesh is applied with distributions such that more elements are stacked near the walls. This helps better resolve the boundary layer and corner vortices that appear in the flow. Higher mesh resolution near the walls is especially important when solving for higher Reynolds number flows. This meshing technique is an efficient way to discretize four-sided geometries while resolving the boundary layer.

In the study, an auxiliary sweep is used to solve for a range of Reynolds numbers (100 to 10000). By using an auxiliary sweep, the solution for each parameter is solved then passed as an initial condition to the next parameter in the sequence to be solved, which speeds up the computation. This technique is also referred to as nonlinearity ramping, and it can be used to improve the convergence of highly nonlinear models. The results are compared for each Reynolds number to the paper published by Ghia et al.

### Results and Discussion

Figure 2 shows the velocity profiles for a Reynolds number of 100 and 10000, respectively. In both cases, the fluid velocity approaches 1 near the top moving wall and zero near the no slip side and bottom walls. The central vortex rotates faster for Re = 10000 than for Re = 100 due to the increased inertia in the flow for the higher Reynolds number. Lower velocity regions appear in the bottom and left corners of the cavity where the secondary vortices are located.

Figure 3 plots the x component of velocity “u” versus the y location along a vertical line in the center of the cavity. At the bottom of the cavity (y=0), the no slip condition is satisfied (u=0). At the top of the cavity (y=1), the moving wall velocity is reached (u=1).

Figure 4 plots the y component of velocity “v” versus the x location along a horizontal line in the center of the cavity. The no slip condition (v=0) is satisfied on the left and right walls (x=0, x=1). As the Reynolds number increases, the magnitude of the maximum velocities increases and the locations of the peak velocities shift closer to the walls.

In Figure 3 & Figure 4, the simulation results (solid line) match closely with the results generated by Ghia et al (data points) for the entire range of Reynolds numbers solved.

Figure 5 plots streamlines for a Reynolds number of 100, which show the formation of a large central vortex and two smaller corner vortices. The central vortex spins clockwise, and due to separation near the corners, the two smaller corner vortices that spin counterclockwise are formed. The size of the corner vortices and the placement of the central vortex, indicated with annotations, are in close agreement with values generated by Ghia et al.

### Notes about the COMSOL Implementation

#### – Simulation Details:

**Physics:** Single-Phase Flow (Laminar Flow)

**Study:** Stationary (Time Independent)

**Geometry:** We set the global unit system to “No Units”. This is the first step in defining the problem in non-dimensional form.

**Materials:**

Property | Value | Unit |

Density | 1 | – |

Dynamic Viscosity | 1/Re | – |

**Pressure Point Reference:** We set the location of reference pressure point as zero (relative) in *bottom-left point*.

**Source:**

1. COMSOL Models, Blog, Cyclopedia

2. U. Ghia et al, “High-Re Solutions for Incompressible Flow Using the Navier-Stokes Equations and a Multigrid Method,” Journal of Computational Physics, 48, 387-411, 1982.

——————————————

01 – Main CAtegory: CMS