Professional Documents
Culture Documents
Maciej Matyka
maq@panoramix.ift.uni.wroc.pl
http://panoramix.ift.uni.wroc.pl/∼maq
May 8, 2003
Abstract
In that report solution to incompressible Navier - Stokes equations in non - dimensional form will be presented.
Standard fundamental methods: SIMPLE, SIMPLER (SIMPLE Revised) and Vorticity-Stream function approach are
compared and results of them are analyzed for standard CFD test case - Drived Cavity flow. Different aspect ratios
of cavity and different Reynolds numbers are studied.
D = ∇→
−
u =0 (2)
Solve Poisson eq.
Where equation (2) is a continuity equation which has for (P’)
If not coverged
1
∇ 2 p0 = (∇ · V ) (6)
∆t
After that we use simple relations to obtain corrected
values of pressure and velocity fields. Then we can check
if solution is coverged. Figure 2: Staggered grid: filled circles P , outline circles U
2 Subscripts denote computational step, where ”n+1” means cur-
x-velocity, cross V y-velocity component.
rent step.
2
Differential Discretization Type
∂u un+1 −un
˙ ni+0.5,j−1
(u2 )ni+1.5,j − (u2 )ni−0.5,j (uv̇)ni+0.5,j+1 − (uv̇)
∂t ∆t forward, O(h) a1 = − −
2 · ∆x 2 · ∆y
(11)
∂2u ui+1,j −2∗ui,j +ui−1,j
∂x2 (∆x)2 central, O(h2 )
˙ ni−1,j+0.5
(v 2 )ni,j+1.5 − (v 2 )ni,j−0.5 (v u̇)ni+1,j+0.5 − (v u̇)
b1 = − −
2 · ∆y 2 · ∆x
∂u2 u2i+1,j −u2i−1,j (12)
∂x (2·∆x) central, O(h2 )
uni+1.5,j − 2 · uni+0.5,j + uni−0.5,j
(a3 ) = (13)
∂p pi+1,j −pi,j (∆x)2
∂x (∆x) forward, O(h)
uni+0.5,j+1 − 2 · uni+0.5,j + uni+0.5,j−1
(a4 ) = (14)
(∆y)2
∂p pi,j+1 −pi,j
∂y (∆x) forward, O(h) n
vi,j+1.5 n
− 2 · vi,j+0.5 n
+ vi,j−0.5
(b3 ) = (15)
(∆y)2
Table 1: Discretizations used in SIMPLE algorithm n
vi+1,j+0.5 n
− 2 · vi,j+0.5 n
+ vi−1,j+0.5
(b4 ) = (16)
(∆x)2
3.2.2 Discretization Schemes Now we have defined almost everything. Dotted veloc-
ities should be also defined. I use simple expressions for
Let us now examine some numerical methods used in pre- it:
sented solution. For algorithm presented in the figure (1)
we have only three equations which have to be discretized
u̇ = 0.5 · (ui−0.5,j + ui−0.5,j+1 ) (17)
on a grid. First we have momentum equations (3) and (4).
Discrete schemes used in discretization of momentum
equations are presented in a table (1). Using presented u̇˙ = 0.5 · (ui+0.5,j + ui+0.5,j+1 ) (18)
discrete form of derivatives I obtain numerical scheme for
momentum equations exactly in the form presented in [1].
Equations (3) , (4) discretized on staggered grid can be v̇ = 0.5 · (vi,j+0.5 + vi+1,j+0.5 ) (19)
written3 as follows4 :
v̇˙ = 0.5 · (vi,j−0.5 + vi+1,j−0.5 ) (20)
−1
un+1 n
i+0.5,j = ui+0.5,j + ∆t · (A − (∆x) (pi+1,j − pi,j )) (7)
3.2.3 Poisson Equation
n+1
vi,j+0.5 = uni,j+0.5 + ∆t · (B − (∆y)−1 (pi,j+1 − pi,j )) (8) For equation I use simple iterative procedure. In the figure
(3) points used for calculation of pressure at each (i, j) grid
where A and B are defined as: points are marked.
equations, they should be rewritten with ”*” and ”’” chars for con-
Figure 3: Points on a grid used in iterative procedure for
crete steps of the algorithm Poisson equation solving.
3
I use simple 4 points scheme for Laplace operator. Di- In the figure (4) I present SIMPLE Revised algorithm.
rectly from [1] expression for one iterative step of poisson It is easy to extend existing SIMPLE solution to be SIM-
equation solver can be written as follows: PLER one.
Treating the boundary conditions and numerical meth-
ods used in SIMPLER solution is almost the same as in
p0i,j = −a−1 (b · (p0i+1,j + p0i−1,j ) + c · (p0i,j+1 + p0i,j−1 ) + d) SIMPLE, so I will not repeat myself.
(21)
where
· ¸ 4 Vorticity-Stream Function ap-
1 1
a = 2∆t + (22) proach
∆x2 ∆y 2
∆t Vorticity-Stream Function approach to two-dimensional
b=− (23)
∆x2 problem of solving Navier-Stokes equations is rather easy.
∆t A different form of equations can be scary at the beginning
c=− (24) but, mathematically, we have only two variables which
∆y 2
have to be obtained during computations: stream vortic-
1 1 ity vector ζ and stream function Ψ.
d= [ui+0.5,j − ui−0.5,j ]+ [vi,j+0.5 − vi,j−0.5 ] (25)
∆x ∆y First let us provide some definition which will simplify
NS equation. The main goal of that is to remove explic-
That iterative procedure is rather simple - we use equa-
itly Pressure from N-S equations. We can do it with the
tion (21) for all interior points on a grid. After that one
procedure as follows.
step of iterative procedure is done. Then we check if so-
lution coverges. We can do it simply to check maximum First let us define vorticity for 2D case:
change of pressure on a grid. If it is bigger than ² we
∂v ∂u
continue iterative process. Solution should finish when ζ = |ζ| = |∇ × V | = − (26)
pressure field is exactly coverged (² = 0, but in practice I ∂x ∂y
use different value of ² for different physical properties of And stream function definition is:
simulated models - it will be discussed later.
∂Ψ
=u (27)
3.3 SIMPLE Revised algorithm ∂y
∂Ψ
= −v (28)
Solve Momentum ∂x
Guess
eq. (without P)
(U^) n, (V^) n
We can combine these definitions with equations (3) and
(U^) n+1 , (V^) n+1
(4). It will eliminate pressure from these momentum equa-
tions. That combination will give us non-pressure vortic-
ity transport equation which in non-steady form can be
Solve Poisson eq.
for (P n+1 ) using
written as follows:
Solve Poisson eq.
(U^) n+1 , (V^) n+1
for (P’ ) using If not coverged
Solve Momentum Having combined equations (26), (27) and (28) we ob-
eq. (using P n+1 ) tain poisson equation for the Ψ variable:
(U*) n+1 , (V*) n+1
Un+1 = (U*) n + (U’)
V n+1 = (V*) n + (V’) ∂2Ψ ∂2Ψ
∇2 Ψ = + = −ζ (30)
If coverged
∂x2 ∂y 2
Visualize Results
Now we have all definitions and equations which are
needed for vorticity-stream solution. We will solve vortic-
ity transport equation, then new values of ζ will be used
Figure 4: Flow chart for SIMPLER algorithm. to solve equation (30).
4
Differential Discretization Type 4.3 Vorticity-Stream function algorithm
∂ζ ζ n+1 −ζ n
forward, O(h) Algorithm of solution for VS function solution is simplier
∂t ∆t
than for SIMPLE method. It is sketched in the figure (6).
∂ζ ζi+1,j −ζi−1,j
∂x (2·∆x) central, O(h2 )
If not coverged
5 Two-dimensional Driven-Lid
Figure 5: ζ and Ψ variables in non staggered grid. Cavity
Discretization is straightforward and easier to imple- Let us now provide some examples of practical calculation
ment in a non-staggered grid than in a staggered grid for for implemented methods6 . I will show results of Driven-
the SIMPLE algorithm. Lid Cavity flow - a standard CFD test case to check the
solution.
Driven Cavity problem is sketched in the figure (7). Up-
4.2 Discretization per lid is moving with u velocity. Main goal is to solve NS
equations inside the cavity to obtain velocity field (steady
We will use several schemes to discretize differential equa-
state). First of all we have to decide about boundary con-
tion (26). For Poisson equation we will use the same tech-
ditions for both: SIMPLE and VS approaches which will
nique which was presented in the SIMPLE algorithm de-
be quite different.
scription, so we will not repeat formulas5 .
5 Formulas for poisson equation will be a little bit different but it 6 In that section also boundary conditions will be provided, be-
is rather easy to obtain it by simple discretization of equation (30). cause they are specified especially for the given problem.
5
u
v0,j = 0 (34)
and
vnx−1,j = 0 (35)
The same work should be done for u velocities, for i =
0 . . . N X − 1 and for j = N Y − 1. Especially for driven
cavity problem we also have to set u velocity equal to 1.0
at j = 0 row, which is done in a straightforward way.
One problem is to set boundary conditions at other walls,
where no velocity grid points are present. We can do it
with a simple linear interpolation of near velocities i.e. for
u velocity, for every j = 0 . . . N Y − 1 we set:
7 For corners simple diagonal values are taken, i.e. p0,0 = p1,1
6
6 Results
In that section some numerical results of calculations with three different techniques will be presented. Since results of
calculations are the same I will try to show and compare differences between methods (accuracy, convergence speed).
Please note that all comments are under figures.
Figure 8: Streamlines plot for driven cavity with Re = 500 and 1 : 1 aspect ratio, grid size 40x40. Two vortexes are
found in the corners of the Cavity, computed with the Vorticity-Stream approach. Solution visualized with Streamline
plot technique.
7
6.2 Different Visualization Techniques, Driven Cavity, Re = 500, Grid: 40x40
Stream Vorticity
Function Distribution Function Distribution
Figure 9: There are presented different types of visualizations generated by my solver. Computations as above -
Re = 500 and other parameters are the same. (That is only a part of possibility visualizations, more will be available
on my web page soon).
8
6.3 SIMPLE, SIMPLER, Driven Cavity, Re = 100, Grid: 21x21
Figure 10: Streamlines plot for SIMPLE (and SIMPLER - because they are the same) calculation of driven cavity
with Re = 100 and different grid sizes and aspect ratios.
9
1.5
SIMPLE
1.4
1.3
convergence
1.2
1.1
0.9
0.8
0 10000 20000 30000 40000 50000 60000 70000
time step
|v n+1 |
Figure 11: That figure shows how convergence changes during iteration steps. On y axis we have |v n | variable.
1.5
Vorticity-Stream
1.4
1.3
convergence
1.2
1.1
0.9
0.8
0 10000 20000 30000 40000 50000 60000 70000
time step
|v n+1 |
Figure 12: That figure shows how convergence changes during iteration steps. On y axis we have |v n | variable.
10
6.5 Convergence comparision
1
SIMPLE
0.9 SIMPLE Revised
Vorticity-Stream
0.8
0.7
convergence
0.6
0.5
0.4
0.3
0.2
0.1
Figure 13: Convergence test for three solution algorithms. A lot of problems appeared there. Convergence speed
depends on a lot of things, so for different properties of calculation (Reynolds numbers, spatial grid resolution, poisson
equation accuracy etc.) different results appears. That results computed for Re = 300 and grid 30x30 shows that
Vorticity-Stream function solver converge faster than SIMPLER and SIMPLE. Anyway - more carefully study should
be made there to make sure about that results. On the y axis we have |v n−1 − v n | convergence coefficient.
11
7 Calculation For Flows over Obstacles
In that section I present some calculations made to test my SIMPLE solver for problems other than Driven Cavities.
There were some problems with boundary conditions and still more work is needed there, but fortunately results are
really nice.
Figure 14: Flow of Incompressible fluid over different types of obstacles. Calculations made for Re = 350 and grid
size 90x45.
12
8 Conclusion
I have developed three different methods for calculation of incompressible fluid flow. Tests for simple Driven Cavity
problem were made. I compared convergence speed for all the methods and it seems that convergence speed depends
on problem formulation and physical properties of simulated system. For future I will try to concern more on how
to treat boundary conditions for both - pressure based and vorticity-stream function methods. Also some kind of
user-friendly software will be released in near future. I would like to thank Grzegorz Juraszek for English language
checking.
13
Contents
1 Introduction 1
2 Math background 1
6 Results 7
6.1 Vorticity-Stream, Driven Cavity, Re = 500, Grid: 40x40 . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.2 Different Visualization Techniques, Driven Cavity, Re = 500, Grid: 40x40 . . . . . . . . . . . . . . . . 8
6.3 SIMPLE, SIMPLER, Driven Cavity, Re = 100, Grid: 21x21 . . . . . . . . . . . . . . . . . . . . . . . . 9
6.4 Convergence for SIMPLE and Vorticity-Sream algorthms . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.5 Convergence comparision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
8 Conclusion 13
14
References
[1] John D. Anderson, Jr. ’Computational Fluid Dynam-
ics: The Basics with Applications’, McGraw-Hill Inc,
1995.
15