Sie sind auf Seite 1von 30

Computational Fluid Dynamics

Indo-European Winter Academy 2013

Presentation by

Tutors

Oliver Lindblad Petersen, student of


Engineering physics, KTH Stockholm, Sweden

- Prof. V. Buwa
- Prof. S. Chakraborty

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Contents
What is Computational Fluid Dynamics (CFD)?
Finite volume method (FVM) in CFD.
Method 1: Stream function - vorticity approach.
Method 2: SIMPLE algorithm.
Comparison Lid-driven cavity flow.

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Contents
What is Computational Fluid Dynamics (CFD)?
1. The Navier-Stokes' equations.
2. Initial values, boundary conditions.
Finite volume method (FVM).
Method 1: Stream function - vorticity approach.
Method 2: SIMPLE algorithm.
Comparison Lid-driven cavity flow.

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. The Navier Stokes equations.

SIMPLE algorithm Comparison

2. Initial values, boundary conditions.

Definition: (Navier-Stokes' equations)


The Navier-Stokes' equations (Newtonian fluid):

v
2
+v v = p+ v
t

where

v =v (t , x ) ,

p= p (t , x ) .

Computational fluid dynamics: Solve the fluid flow problems numerically.


Usually: Solve Navier-Stokes' equations numerically with given boundary
conditions.
Use the finite volume method!

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. The Navier Stokes equations.

2. Initial values, boundary conditions.

Initial values (non stationary):


v (0,x )= v0

SIMPLE algorithm Comparison

p (0, x )= p 0

Example:
Arrows velocity of the fluid.

Boundary conditions (for example):


Wall:

v (t )=0 normal to the boundary

No fluid can go
through a wall.
No-slip condition:
v (t )=0 parallell to the boundary

The fluid cannot move


on the boundary.

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Contents
What is Computational Fluid Dynamics (CFD)?
Finite volume method (FVM).
1. Repetition.
Method 1: Stream function - vorticity approach.
Method 2: SIMPLE algorithm.
Comparison Lid-driven cavity flow.

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

1. Repetition.

RECALL!
The finite volume method has two main advantages:
Mass, momentum and energy are conserved.
Can be applied to unstructured meshes.

Remember:
Divergence theorem,
.
CV u dV =(CV ) udS

Question:
How do we apply this to
Navier Stokes equations?

Figure: Grid arrangement for FVM.


http://nptel.iitm.ac.in/courses/112104030/14
Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Contents
What is Computational Fluid Dynamics (CFD)?
Finite volume method (FVM) in CFD.
Method 1: Stream function - vorticity approach.
1. Rewriting Navier-Stokes' equations.
2. Boundary conditions.
Method 2: SIMPLE algorithm.
Comparison Lid-driven cavity flow.

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Rewriting NS equations.

SIMPLE algorithm Comparison

2. Boundary conditions.

2-D Navier-Stokes equations without time dependence in an incompressible fluid:

u
u
u
p
2
+u
+v
=
+ u
t
x
y
x

v
v
u
p
2
+u
+v
=
+ v
t
x
y
y

velocity

Definition:
The stream function vorticity approach:

Continuity equation
u v
+
=0
x y

(3.3)

Introduce new variables:

u=

v u
, v=
, =
y
x
x y

Note: The continuity equation is satisfied with the new variables. Therefore, this
method works when and only when we are considering incompressible fluids.

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Rewriting NS equations.

Stream function - vorticity

SIMPLE algorithm Comparison

2. Boundary conditions.

The 2-D Navier-Stokes' equations now become (after differentiating and


subtracting):
2

(*)

+
= 2 ,
t y x x y

:=

Solution procedure:

1. Set initial and boundary values for and .


2. Solve equation (*).
3. Step forward in time using:

n+1
n
2
i , j = i , j + t
+

y x x y
4. Repeat step 2-4 using ni ,+1
j .

i, j

10

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Rewriting NS equations.

SIMPLE algorithm Comparison

2. Boundary conditions.

Assume now we have a discretization of the problem, with indices (i,j).

Orthogonal to the walls:


Vertical walls:
Horizontal walls:

i , j
=0
y
i , j
v i , j =
=0
x
ui , j=

=C

Along the walls!

=0

Normal derivatives
are zero!

Parallel to the walls non slip condition:


Vertical walls:
Horizontal walls:

i , j
v i , j =
=0
x
i , j
ui , j=
=0
y

11

Computational Fluid Dynamics

What is CFD?

Finite volume method

Stream function - vorticity

1. Rewriting NS equations.

SIMPLE algorithm Comparison

2. Boundary conditions.

Example: Vorticity at wall y=0.


v i ,0
=0 ( v=0 along the boundary)
x

v
u
u
i ,0
i ,0= i ,0 i ,0 = i ,0 =
x
y
y
y2

Taylor expansion:
Insert equation:

1 i ,0
2
i ,1 =i ,0+ i ,0 y+
(
y
)
+...
y
2 y2
i ,0
u i ,0 =
=0 (non-slip)
y

j=2
j=1
Boundary

i ,0=

2 (i ,1 1,0 )
( y)2

The difference in
produces vorticity!

j=0
12

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Contents
What is Computational Fluid Dynamics (CFD)?
Finite volume method (FVM) in CFD.
Method 1: Stream function - vorticity approach.
Method 2: SIMPLE algorithm.
1. Staggered grid.
2. SIMPLE algorithm.
Comparison Lid-driven cavity flow.

13

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Staggered grid

Stream function - vorticity

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

Definition: (Staggered grid)


The scalars (such as pressure) are stored in the CENTER of each control volume.
The vectors (such as velocity) are stored at the FACES of each control volume.

Figure: Staggered Grid.


http://nptel.iitm.ac.in/courses/112104030/27

14

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Staggered grid

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

SIMPLE = Semi-Implicit Method for Pressure Linked Equations


Incompressible Navier-Stokes' equation in x-direction:

u (u ) (uv ) 1 p 2 u 2 u
+
+
+
=
+
t
x
y
x x2 y 2

Continuity equation:

u v
+
=0
x y

Integrate over a control volume [CV]:

[ (

) (

)]

2 u
p
uv u dx dy + 1
u
dx
dy+
u

+
dx dy=0

x y
y

CV
CV x
CV x
t
Greens theorem gives:

u
u

1
p
2
u
dx
dy+

uv

dx+
u

dy+
dx dy=0

CV
(CV
)
CV
t
y
x
x

15

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Staggered grid

SIMPLE algorithm Comparison

2. SIMPLE algorithm.
n

u (t n , x i , y j )=:u i , j

We discretize in the following way:


n+1

ui , j u i , j
u
(t , x , y )=
,
t n i j
t
n

n +1

n+1

(v i , j +v i +1, j )(u i , j +ui , j+1 )


vu (t n , x i , y j +1/ 2 )=
4
n+1

n +1

(u +u
)(u +u i+1, j )
2
u (t n , x i+1 /2 , y j )= i , j i+1, j i , j
,
4

p
pi , j
p
(t n , x i , y j )= i +1, j
x
x

etc...

Figure: Staggered Grid.


http://nptel.iitm.ac.in/courses/112104030/27
16

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Staggered grid

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

Therefore, the discretization will look like this (x-direction only):

) (

u
u

1
p
2
u
dx
dy+

uv

dx+
u

dy+
dx dy=0

y
x

CV
(CV )
CV x
t

xy
n
n +1
n
n+1
n
n +1
n+1
+a i , j u i , j + a nb u nb +b + y ( p i+1, j p i , j )=0
t
n

where a i , j , a nb , b

(1)

only depend on previous time step.

The subscript nb stands for neighboring point.

(Set =1.)

Remaining question:
How do we solve this equation?

17

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Staggered grid

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

Solution procedure part 1:


We have solution for time n, but want a solution for time n+1.
*

Step 1: Find approximate solution u i , j .

xy
n
*
n
*
n
n
n
+a i , j u i , j + a nb u nb +b + y ( pi +1, j pi , j )=0
t

Step 2: Find equations for

n+1

(2)

u i , j :=ui , j u i , j

Subtract the equation (2) from equation (1):

xy
n
c
n
c
+a i , j u i , j + a nb u nb + y ( pi +1, j p i , j )=0
t

where

n+1

(3)

pi , j= pi , j pi , j .

18

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

1. Staggered grid

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

Solution procedure part 2:


Step 3: Simplify by approximating:

a nnb u cnb 0.
This gives, using equation (3):
c

u i , j =d i , j ( p i , j pi +1, j ).

(4)

Step 4: For v, we have a corresponding equation to equation (4), call it (4*).

Continuity equation:
n+1
n +1
u
v
+
=0
+ (3)
x
y

(3*)

a ' i , j p i , j = a ' nb p nb +b '


n

19

Computational Fluid Dynamics

c
Oliver
Petersen, KTH
u Lindblad
.

What is CFD?

Finite volume method

1. Staggered grid

Stream function - vorticity

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

Solution procedure part 2:


Step 4: Find p i , j .

a i , j p i , j = a nb p nb +b .
p

Step 5: Find u i , j .

Solve using
over-/underrelaxation!

Insert p i , j in the equation (3):

xy
n
c
n
c
+a i , j u i , j + a nb u nb + y ( pi +1, j p i , j )=0 .
t

20

Computational Fluid Dynamics

c
Oliver
Petersen, KTH
u Lindblad
.

What is CFD?

Finite volume method

Stream function - vorticity

1. Staggered grid

SIMPLE algorithm Comparison

2. SIMPLE algorithm.

Solution procedure part 3:

Step 6:
n+1

Compute u i , j =u i , j +u i , j ,
and

n +1
i, j

n+1

v i , j =v i , j +v i , j

n
i, j

= p + p i , j .

We got a solution for time n+1!

where (0,1) is a relaxation parameter.


DONE!

21

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Contents
What is Computational Fluid Dynamics (CFD)?
Finite volume method (FVM) in CFD.
Method 1: Stream function - vorticity approach.
Method 2: SIMPLE algorithm.
Comparison Lid-driven cavity flow.
1. Problem.
2. Results.
3. Conclusion.

22

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Problem

Stream function - vorticity

2. Result

SIMPLE algorithm Comparison

3. Conclusion

Lid-driven cavity flow:

Stream function vorticity:

ext ( upper boundary)=

2
h

1 m/s

SIMPLE:

u ( upper boundary)=1

1m

1m
23

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Problem

Stream function - vorticity

2. Result

SIMPLE algorithm Comparison

3. Conclusion

Vertical velocity component using grid size: 4040.


Implementations in Matlab, using code from other authors,
see references on slide 26.

Stream function vorticity approach

SIMPLE algorithm

24

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Problem

Stream function - vorticity

2. Result

SIMPLE algorithm Comparison

3. Conclusion

CPU-time
Implementations in Matlab, using code from other authors,
see references on slide 26.
GRID:

Stream function vorticity

SIMPLE

1010

0.3 s

4.5 s

2020

1.0 s

42.7 s

3030

3.2 s

159.4 s

4040

8.6 s

508.1 s

25

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Problem

Stream function - vorticity

2. Result

SIMPLE algorithm Comparison

3. Conclusion

Rescaled CPU-time
In order to minimize influence of particular implementation,
we rescale so that the CPU time was 1 second in both
for grid size 100=1010.

26

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Problem

Stream function - vorticity

2. Result

SIMPLE algorithm Comparison

3. Conclusion

Conclusion:
The non-trivial boundary condition was possible to implement in a natural
way in both cases. For the Lid-driven flow, the Stream function vorticity
approach was faster than the SIMPLE algorithm.

Note:
The Stream function vorticity approach only works in 2 dimensions. This
is due to the fact that an analogue of Stream function does not exist in
3 dimensions.

27

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

1. Problem

Stream function - vorticity

2. Result

SIMPLE algorithm Comparison

3. Conclusion

References:
Matlab code:
Stream function vorticity, Matlab program from:
http://www.fem.unicamp.br/~phoenics/SITE_PHOENICS/
Apostilas/CFD-1_U%20Michigan_Hong/Lecture05.pdf, slide 33
SIMPLE, Matlab program by:
Ryan Picardo, Jason. CFDT project Steady flow of an Incompressible
Fluid in a Lid Driven Cavity. IIT Madras.
http://www.scribd.com/doc/92468216/Lid-Driven-Cavity-SIMPLE
Literature:
NPTEL
nptel.iitm.ac.in/courses/112104030/

28

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

What is CFD?

Finite volume method

Stream function - vorticity

SIMPLE algorithm Comparison

Questions?

29

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

Thank you!
Presentation by

Tutors

Oliver Lindblad Petersen, student of


Engineering physics, KTH Stockholm, Sweden

- Prof. V. Buwa
- Prof. S. Chakraborty

30

Computational Fluid Dynamics

Oliver Lindblad Petersen, KTH

Das könnte Ihnen auch gefallen