Lid Driven Cavity

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Created in COMSOL Multiphysics 5.

3a

Lid-Driven Cavity

This model is licensed under the COMSOL Software License Agreement 5.3a.
All trademarks are the property of their respective owners. See www.comsol.com/trademarks.
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:

2
  u   u = – p +   u
u
By nondimensionalizing the velocity ( u = --- ), pressure ( p = p     ), and
2
r 
length scale ( r = ----  = L ), the nondimensional Navier-Stokes equations can be
L
written as:

1 2
 u   u = – p + -------  u
Re

where Re =  L    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).

2 | LID-DRIVEN CAVITY
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.

Figure 1: A mapped mesh with symmetric distributions efficiently resolves the high gradients
in 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.

3 | LID-DRIVEN CAVITY
Results and Discussion

Figure 2: A large vortex forms in the center of the cavity. For the higher Reynolds number flow
(Re =10,000), the vortex extends more prominently into the cavity due to the increased
inertia.

4 | LID-DRIVEN CAVITY
Figure 1 and Figure 2 show 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: The velocity profile at the vertical centerline from Ghia et al matches closely with the
COMSOL Multiphysics simulation results.

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).

5 | LID-DRIVEN CAVITY
Figure 4: The velocity profile at the horizontal centerline from Ghia et al matches closely with
the COMSOL Multiphysics simulation results.

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.

6 | LID-DRIVEN CAVITY
Figure 5: Two corner vortices appear in the flow for a Reynolds number of 100. Their
placement, as well as the position of the center vortex, are in close agreement with the results
published by Ghia et al.

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.

Reference
1. 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.

7 | LID-DRIVEN CAVITY
Modeling Instructions
From the File menu, choose New.

NEW
In the New window, click Model Wizard.

MODEL WIZARD
1 In the Model Wizard window, click 2D.
2 In the Select Physics tree, select Fluid Flow>Single-Phase Flow>Laminar Flow (spf).
3 Click Add.
4 Click Study.
5 In the Select Study tree, select Preset Studies>Stationary.
6 Click Done.

GEOMETRY 1
Set the global unit system to "No Units". This is the first step in defining the problem in
non-dimensional form.

ROOT
1 In the Model Builder window, click the root node.
2 In the root node’s Settings window, locate the Unit System section.
3 From the Unit system list, choose None.

GLOBAL DEFINITIONS

Parameters
1 In the Model Builder window, under Global Definitions click Parameters.
2 In the Settings window for Parameters, locate the Parameters section.
3 Click Load from File.
4 Browse to the model’s Application Libraries folder and double-click the file
lid_driven_cavity_parameters.txt.

GEOMETRY 1

Square 1 (sq1)
On the Geometry toolbar, click Primitives and choose Square.

8 | LID-DRIVEN CAVITY
By setting the density to 1 and the viscosity to 1/Re, the non-dimensionalized Navier-
Stokes equations will be solved. The Reynolds number "Re" will be changed dynamically
in Study 1 using an auxiliary sweep.

MATERIALS

Material 1 (mat1)
1 In the Model Builder window, under Component 1 (comp1) right-click Materials and
choose Blank Material.
2 In the Settings window for Material, locate the Material Contents section.
3 In the table, enter the following settings:

Property Variable Value Unit Property group


Density rho 1 Basic
Dynamic viscosity mu 1/Re Basic

LAMINAR FLOW (SPF)

Wall 2
1 On the Physics toolbar, click Boundaries and choose Wall.
2 Select Boundary 3 only.
3 In the Settings window for Wall, click to expand the Wall Movement section.
4 Select the Sliding wall check box.
5 In the Uw text field, type 1.

A pressure point constraint is necessary in the closed system when performing stationary
analysis in order to create a well-defined problem. It is applied in the corner far away from
high gradients. By assigning a relative pressure of p=0, the absolute pressures in the cavity
will be similar to the reference pressure level of 1 atm defined under Laminar Flow .

Pressure Point Constraint 1


1 On the Physics toolbar, click Points and choose Pressure Point Constraint.
2 Select Point 1 only.

MESH 1
Mapped meshing can be used in some cases to efficiently discretize four sided geometries.
It also allows the user to control the distribution of elements in order to better resolve the
high gradients near the no slip walls. In this case, a symmetric distribution with geometric
spacing is used to place more elements near the sides of the cavity.

9 | LID-DRIVEN CAVITY
Distribution 1
1 In the Model Builder window, under Component 1 (comp1) right-click Mesh 1 and choose
Mapped.
2 Right-click Mapped 1 and choose Distribution.
3 In the Settings window for Distribution, locate the Boundary Selection section.
4 From the Selection list, choose All boundaries.
5 Locate the Distribution section. From the Distribution properties list, choose
Predefined distribution type.
6 In the Number of elements text field, type 100.
7 In the Element ratio text field, type 5.
8 From the Distribution method list, choose Geometric sequence.
9 Select the Symmetric distribution check box.
10 Click Build All.

STUDY 1

Step 1: Stationary
By adding an auxiliary sweep, multiple values of the Reynolds number can be computed.
An auxiliary sweep uses the solution to the previously computed parameter as an initial

10 | LID-DRIVEN CAVITY
condition to solving for the current parameter, which speeds up the computation when
solving for multiple parameters. This technique can also be used to improve the
convergence of a simulation in a process known as nonlinearity ramping.

1 In the Model Builder window, under Study 1 click Step 1: Stationary.


2 In the Settings window for Stationary, click to expand the Study Extensions section.
3 Select the Auxiliary sweep check box.
4 Click Add.
5 Click to select row number 1 in the table.
6 In the table, enter the following settings:

Parameter name Parameter value list Parameter unit


Re 100 400 1000 3200 5000 7500 10000

7 On the Home toolbar, click Compute.

RESULTS

Velocity (spf)
1 In the Model Builder window, under Results click Velocity (spf).
2 In the Settings window for 2D Plot Group, locate the Data section.
3 From the Parameter value (Re) list, choose 100.

Arrow Surface 1
1 Right-click Results>Velocity (spf) and choose Arrow Surface.
2 In the Settings window for Arrow Surface, locate the Coloring and Style section.
3 From the Color list, choose White.

11 | LID-DRIVEN CAVITY
4 On the Velocity (spf) toolbar, click Plot.

Velocity (spf)
1 In the Model Builder window, under Results click Velocity (spf).
2 In the Settings window for 2D Plot Group, locate the Data section.
3 From the Parameter value (Re) list, choose 10000.

12 | LID-DRIVEN CAVITY
4 On the Velocity (spf) toolbar, click Plot.

Cut Line 2D 1
1 On the Results toolbar, click Cut Line 2D.
2 In the Settings window for Cut Line 2D, locate the Line Data section.
3 In row Point 1, set x to .5.
4 In row Point 2, set x to .5.
5 In row Point 2, set y to 1.

Cut Line 2D 2
1 On the Results toolbar, click Cut Line 2D.
2 In the Settings window for Cut Line 2D, locate the Line Data section.
3 In row Point 1, set y to .5.
4 In row Point 2, set y to .5.

The data from Ghia et al is imported in order to compare it to the results from COMSOL.

Table 1
1 On the Results toolbar, click Table.
2 In the Settings window for Table, locate the Data section.

13 | LID-DRIVEN CAVITY
3 Click Import.
4 Browse to the model’s Application Libraries folder and double-click the file
lid_driven_cavity_literature1.txt.

Table 2
1 On the Results toolbar, click Table.
2 In the Settings window for Table, locate the Data section.
3 Click Import.
4 Browse to the model’s Application Libraries folder and double-click the file
lid_driven_cavity_literature2.txt.

The x-component of the velocity "u" is compared along the vertical centerline between
the data from Ghia et al and the COMSOL results.

1D Plot Group 3
1 On the Results toolbar, click 1D Plot Group.
2 In the Settings window for 1D Plot Group, type u vs y in the Label text field.
3 Locate the Data section. From the Data set list, choose Cut Line 2D 1.
4 Locate the Legend section. From the Position list, choose Upper left.

Line Graph 1
1 Right-click u vs y and choose Line Graph.
2 In the Settings window for Line Graph, locate the y-Axis Data section.
3 In the Expression text field, type u.
4 Click to expand the Legends section. Select the Show legends check box.

Table Graph 1
1 In the Model Builder window, under Results right-click u vs y and choose Table Graph.
2 In the Settings window for Table Graph, locate the Coloring and Style section.
3 Find the Line style subsection. From the Line list, choose None.
4 Find the Line markers subsection. From the Marker list, choose Cycle.
5 From the Positioning list, choose In data points.

14 | LID-DRIVEN CAVITY
u vs y

The y-component of the velocity "v" is compared along the horizontal centerline between
the data from Ghia et al and the COMSOL results.

1D Plot Group 4
1 On the Results toolbar, click 1D Plot Group.
2 In the Settings window for 1D Plot Group, type v vs x in the Label text field.
3 Locate the Data section. From the Data set list, choose Cut Line 2D 2.

Line Graph 1
1 Right-click v vs x and choose Line Graph.
2 In the Settings window for Line Graph, locate the y-Axis Data section.
3 In the Expression text field, type v.
4 Locate the Legends section. Select the Show legends check box.

Table Graph 1
1 In the Model Builder window, under Results right-click v vs x and choose Table Graph.
2 In the Settings window for Table Graph, locate the Data section.
3 From the Table list, choose Table 2.

15 | LID-DRIVEN CAVITY
4 Locate the Coloring and Style section. Find the Line style subsection. From the Line list,
choose None.
5 Find the Line markers subsection. From the Marker list, choose Cycle.
6 From the Positioning list, choose In data points.

v vs x

2D Plot Group 5
1 On the Results toolbar, click 2D Plot Group.
2 In the Settings window for 2D Plot Group, type Streamline Plot in the Label text field.
3 Locate the Data section. From the Parameter value (Re) list, choose 100.
Streamlines are plotted for a Reynolds number of 100, and the locations of the center
and corner vortices are compared to those from Ghia et al using annotations.

Streamline 1
1 Right-click Streamline Plot and choose Streamline.
2 In the Settings window for Streamline, locate the Streamline Positioning section.
3 From the Positioning list, choose Uniform density.
4 In the Separating distance text field, type 0.02.

16 | LID-DRIVEN CAVITY
Annotation 1
1 In the Model Builder window, under Results right-click Streamline Plot and choose
Annotation.
2 In the Settings window for Annotation, locate the Annotation section.
3 In the Text text field, type Center.
4 Locate the Position section. In the x text field, type xC.
5 In the y text field, type yC.

Annotation 2
1 Right-click Streamline Plot and choose Annotation.
2 In the Settings window for Annotation, locate the Annotation section.
3 In the Text text field, type Right vortex.
4 Locate the Position section. In the x text field, type xR.

Annotation 3
1 Right-click Streamline Plot and choose Annotation.
2 In the Settings window for Annotation, locate the Annotation section.
3 In the Text text field, type Right vortex.
4 Locate the Position section. In the x text field, type 1.
5 In the y text field, type yR.

Annotation 4
1 Right-click Streamline Plot and choose Annotation.
2 In the Settings window for Annotation, locate the Annotation section.
3 In the Text text field, type Left vortex.
4 Locate the Position section. In the y text field, type yL.

Annotation 5
1 Right-click Streamline Plot and choose Annotation.
2 In the Settings window for Annotation, locate the Annotation section.
3 In the Text text field, type Left vortex.
4 Locate the Position section. In the x text field, type xL.

17 | LID-DRIVEN CAVITY
Streamline Plot

18 | LID-DRIVEN CAVITY

You might also like