Skip to content

Commit 2369d58

Browse files
authored
Add Lid Driven Cavity Flow tutorial for pressure-based solver (#218)
* Create Inc_Lid_Driven_Cavity.md * Update tutorials.yml * Update index.md * Update Inc_Lid_Driven_Cavity.md * Added tutorial description * small bugfix
1 parent 73f9d9c commit 2369d58

5 files changed

Lines changed: 154 additions & 0 deletions

File tree

‎_data/tutorials.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- Inc_Von_Karman
3636
- Inc_Turbulent_Bend
3737
- Inc_Urban_City
38+
- Inc_Lid_Driven_Cavity
3839

3940
- title: Structural Mechanics
4041
tutorials:
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
---
2+
title: "Incompressible, Lid Driven Cavity Flow"
3+
permalink: "/tutorials/Inc_Lid_Driven_Cavity/"
4+
written_by: Thijs Aalbers
5+
for_version: 8.5.0
6+
revised_by:
7+
revision_date:
8+
revised_version:
9+
solver: INC_NAVIER_STOKES
10+
requires: SU2_CFD
11+
complexity: beginner
12+
follows:
13+
---
14+
15+
![LDC velocity contours](../../tutorials_files/incompressible_flow/Inc_Lid_Driven_Cavity/images/ldc_velocity.png)
16+
17+
## Goals
18+
19+
Upon completing this tutorial, the user will be familiar with performing a simulation of laminar, incompressible, lid-driven flow within a cavity. Consequently, the following capabilities of SU2 will be showcased in this tutorial:
20+
21+
- Steady, 2D, laminar, incompressible, Navier-Stokes equations
22+
- Dynamic mesh movement MOVING_WALL
23+
- Central Difference Scheme (CDS) convective scheme in space (2nd-order)
24+
- The pressure-correction solver for incompressible flow (PISO)
25+
26+
The intent of this tutorial is to demonstrate the pressure-correction solver (PISO) algorithm of the incompressible solver, by using a very simple test case.
27+
28+
## Resources
29+
30+
The resources for this tutorial can be found in the [Inc_Lid_Driven_Cavity](incompressible_flow/https://github.com/su2code/Tutorials/tree/master/incompressible_flow/Inc_Lid_Driven_Cavity) directory in the [tutorial repository](https://github.com/su2code/Tutorials). You will need the configuration file ([incomp_pb_liddrivencavity.cfg](https://github.com/su2code/Tutorials/tree/master/incompressible_flow/Inc_Lid_Driven_Cavity/incomp_pb_liddrivencavity.cfg)) and the mesh file ([mesh_cavity_257x257.su2](https://github.com/su2code/Tutorials/tree/master/incompressible_flow/Inc_Lid_Driven_Cavity/mesh_cavity_257x257.su2)).
31+
32+
33+
## Tutorial
34+
35+
The following tutorial will walk you through the steps required when solving for the flow in the lid-driven cavity using the pressure-correction incompressible flow solver in SU2. It is assumed you have already obtained and compiled the SU2_CFD code for a serial (or parallel) computation. If you have yet to complete these requirements, please see the [Download](/docs_v7/Download/) and [Installation](/docs_v7/Installation/) pages.
36+
37+
### Background
38+
39+
The lid-driven cavity is a classic benchmark problem for testing incompressible flow solvers. It consists of a simple 2D square cavity, with a moving lid. This moving lid creates a driving force on the fluid in the cavity trough the viscosity of the fluid. As the fluid is contained by the cavity, this driving force results in several vortices forming inside the cavity, depending on the Reynolds number.
40+
41+
### Problem Setup
42+
43+
The problem setup is meant to be entirely governed by the Reynolds number which is defined as $Re = \rho U L / \mu$. Here, for simplicity, we use $\rho=1$, $U=1$, and $L=1$. Then the Reynolds number is entirely determined by the dynamic viscosity. Here we use a moderate Reynolds number of $400$, we therefore do not have to worry about instabilities caused by turbulence, or require very fine meshes to resolve the boundary layers.
44+
45+
### Mesh Description
46+
47+
The computational mesh for the cavity is composed of quadrilaterals with 65 uniformly spaced nodes in both the x- and y-directions. The 4 boundaries of the cavity are no-slip walls. The cavity is 1 m by 1 m.
48+
49+
50+
### Configuration File Options
51+
52+
Here, we specify some of the important configuration file options, specifically related to the pressure-correction solver type. We however start with some more general options to set up the problem with a moving lid. We start with a constant density, and a viscosity to get a Reynolds number of 400
53+
54+
```
55+
% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------%
56+
%
57+
INC_DENSITY_MODEL= CONSTANT
58+
INC_DENSITY_INIT= 1.0
59+
INC_VELOCITY_INIT= ( 0.0, 0.0, 0.0 )
60+
61+
INC_DENSITY_REF= 1.0
62+
INC_VELOCITY_REF= 1.0
63+
INC_NONDIM= REFERENCE_VALUES
64+
65+
% --------------------------- VISCOSITY MODEL ---------------------------------%
66+
%
67+
VISCOSITY_MODEL= CONSTANT_VISCOSITY
68+
MU_CONSTANT= 2.5E-3
69+
```
70+
71+
We then define the upper wall to move to the right with a constant velocity as
72+
73+
```
74+
% ----------------------- DYNAMIC MESH DEFINITION -----------------------------%
75+
76+
% Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME,
77+
% MOVING_WALL, FLUID_STRUCTURE, AEROELASTIC, EXTERNAL)
78+
SURFACE_MOVEMENT= MOVING_WALL
79+
MARKER_MOVING= upper
80+
SURFACE_MOTION_ORIGIN = 0.0 0.0 0.0
81+
SURFACE_ROTATION_RATE = 0.0 0.0 0.0
82+
SURFACE_TRANSLATION_RATE = 1.0 0.0 0.0
83+
```
84+
85+
Now that the moving lid is set up, we continue by defining the pressure-correction algorithm. To activate the pressure-correction solver, we specify
86+
87+
```
88+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
89+
%
90+
SOLVER= INC_NAVIER_STOKES
91+
%
92+
% The kind of incompressible solver (DENSITY_BASED, PRESSURE_BASED)
93+
KIND_INCOMP_SYSTEM = PRESSURE_BASED
94+
95+
```
96+
97+
Once we have selected the pressure-correction solver instead of the default solver for incompressible flow, we can continue specifying options for the algorithm. Here, we use the PISO algoritm, which means that we use 2 corrections instead of 1, this is defined by setting the PISO_CORECTIONS setting to 2 (default is 1). We use a PISO algorithm (with multiple corrections) to improve the convergence speed by allowing a greater CFL number.
98+
99+
For a regular PISO algorithm, the pressure and momentum underrelaxation is commonly not used, as this is not needed, we therefore also do not touch these and leave these as 1. Lastly, we have the option to alter the influence of the transient term in the coefficients used by the algorithm. These coefficients are dependent on the time step, which means that the final solution can be dependent on the CFL. Here, this effect does not influence the final solution noticeably and we therefore keep it.
100+
101+
```
102+
% ----------------------- PRESSURE BASED PARAMETERS ---------------------------%
103+
%
104+
KIND_PB_ITER= SIMPLE
105+
PISO_CORRECTIONS = 2
106+
RELAXATION_FACTOR_PRESSURE= 1.0
107+
RELAXATION_FACTOR_MOMENTUM= 1.0
108+
TRANSIENT_TERM_REMOVAL_FACTOR= 0.0
109+
```
110+
111+
Lastly, we must take care of the solution method for the poisson equation that is required when solving for the pressure-correction. This is notoriously a bottleneck in the algorithm, as it often has difficulty to converge fast. For a low Reynolds number case such as this, this is not so much an issue which is why we use FGMRES. At the time of writing this, there does not yet exist a linear solver method specifically for the poisson solver which makes this more difficult and important at larger Reynolds numbers or finer meshes.
112+
113+
```
114+
POISSON_LINEAR_SOLVER= FGMRES
115+
POISSON_LINEAR_SOLVER_PREC= ILU
116+
POISSON_LINEAR_SOLVER_ERROR= 1E-4
117+
POISSON_LINEAR_SOLVER_ITER= 1000
118+
```
119+
120+
### Running SU2
121+
122+
To run this test case, the follwing steps can be applied. First, make sure that the config file and mesh file are copied to the same directory. Also make sure that SU2 is compiled, installed and that the install location was added to your path.
123+
124+
#### In Serial
125+
126+
To run the test case in serial, enter the following in the command line
127+
128+
```
129+
$ SU2_CFD incomp_pb_liddrivencavity.cfg
130+
```
131+
132+
#### In Parallel
133+
134+
To run it in parallel, using ```NP``` number of processors, enter the following command in the command line
135+
136+
```
137+
$ mpirun -np NP SU2_CFD incomp_pb_liddrivencavity.cfg
138+
```
139+
140+
### Results
141+
142+
Results of the test case are shown below. We compare the results (postprocessed in Paraview) to results obtained by Ghia et al. which shows excellent agreement.
143+
144+
145+
![Velocities along midlines](../../tutorials_files/incompressible_flow/Inc_Lid_Driven_Cavity/images/velocity_comparisons.png)
146+
147+
Figure (1): A plot of the velocities along the midlines ($x=0.5$ and $y=0.5$ respectively) compared to the results reported by Ghia et al.
148+
149+
150+
151+

‎_tutorials/index.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Simulation of unsteady laminar vortex shedding behind a circular cylinder.
8383
Simulation of turbulent flow in a 90 degree pipe bend using wall functions.
8484
* [Urban City](/tutorials/Inc_Urban_City/)
8585
Simulation of wind velocity and smoke through the city center of Amsterdam.
86+
* [Lid Driven Cavity](/tutorials/Inc_Lid_Driven_Cavity/)
87+
Simulation of a laminar, lid driven cavity, using the PISO algorithm
8688

8789
#### Structural Mechanics
8890

136 KB
Loading
51.4 KB
Loading

0 commit comments

Comments
 (0)