• No results found

Computational Fluid Dynamics CFD. Solving system of equations, Grid generation

N/A
N/A
Protected

Academic year: 2021

Share "Computational Fluid Dynamics CFD. Solving system of equations, Grid generation"

Copied!
52
0
0

Loading.... (view fulltext now)

Full text

(1)

Computational Fluid Dynamics

CFD

(2)

Finite differences

H.O.T.

!

3

!

2

3 3 2 2 2 1









=

+ n j n j n j n j n j

t

t

t

t

t

t

φ

φ

φ

φ

φ

( )

t

O

t

t

n j n j n j

+

=

φ

φ

+1

φ

Truncation error

First order forward difference, the truncation error is directly proportional to the time step.

Note that we can not from this say anything about the exact size of

(3)

Finite differences

H.O.T.

3

2

3 3 2 1 1

+





=

+ − n j n j n j n j

t

t

t

t

φ

φ

φ

φ

Second order central difference, the truncation error is proportional to the time step squared.

(4)

Finite differences

Dissipation error

0

2 2

=

x

x

c

φ

α

φ

Convection-diffusion equation

1st order FD appoximation of the first derivative and 2nd order for the second derivative:

(5)

Finite differences

Dispersion error

0

2 2

=

x

x

c

φ

α

φ

Convection-diffusion equation

2nd order FD appoximation of the first derivative and 2nd order for the second derivative:

( )

0

2

2

4 3 3 2 1 1

+

=

+

=

+ −

x

O

x

x

x

x

j j

φ

φ

φ

φ

( )

4 4 4 2 2 1 1 2 2

O

4

2

x

x

x

x

x

j j j j

+

+

=

φ

φ

+

φ

φ

φ

Even derivatives are dissipative Odd derivatives are dispersive

Cell Reynolds number:

α

x

c

c

=

Re

Dispersive schemes are unstable if

2

(6)
(7)

Solution error: The difference between the exact solution of the governing PDEs and the exact solution to the system of

algebraic equations

(

)

n j n j n j

φ

x

t

φ

ε

=

,

Convergence: The exact solution to the system of algebraic

equations will approach the exact solution of the governing PDEs when grid spacing and time step go to zero

(8)

Consistency: The system of algebraic equations will be equivalent to the

governing PDEs at each grid point when grid spacing and time step go to zero

Stability: If spontaneous perturbations in the solution to the system of

algebraic equations decay, we have stability

Convergence: The exact solution to the system of algebraic

(9)

Solving system of equations

P Domain of

dependence Region of influence Region of influence Domain of

dependence P

P

Every point influences all other points

Parabolic

Hyperbolic

Elliptic The flow situation the equations desides the character of the governing equations.

(10)

Solving system of equations

Parabolic Hyperbolic Elliptic

Different solution strategies can therefore be employed depending on the character.

Marching methods may be used since the solution only depends on previous data.

Has to be solved for the

whole domain simultaneously, since all points depend on each other. Relaxation techniques.

Examples:

•Inviscid supersonic flow

Examples:

•Steady incompressible flow

(11)

Marching methods

Lax-Wendroff scheme

Consider the inviscid Burger equation

=

0

+

x

u

u

t

u

Conserved form

0

F

F

(

u

)

x

F

t

u

=

=

+

Start with a Taylor expansion around (x,t+∆t)

(12)

Marching methods

Lax-Wendroff scheme

The idea is to replace the time derivatives in the expansion by spacial ones, which gives a scheme that is 2nd order accurate in space and time.

First derivative:

x

F

t

u

=

=

=

t

F

x

x

t

F

t

u

2 2 2 Second derivative:

Since F is a function of u we can write

(13)

Marching methods

Lax-Wendroff scheme Hence,

=

x

F

A

x

t

u

2 2

The Taylor expansion can now be written as:

(14)

Marching methods

Lax-Wendroff scheme

Apply 2nd order central differencing:

(

)

(

)

[

n

]

j n j n j n j n j n j n j n j n j n j

A

F

F

A

F

F

x

t

F

F

x

t

u

u

1/2 1 1/2 1 2 1 1 1

2

1

2

+ + − − − + +

+

+

=

Since

u

u

F

A

u

F

=

=

=

2

2

the Jacobian is calculated as

2

1 2 / 1 j j j

u

u

A

+

=

+

+

A stability analysis gives

1

2

(

1

cos

θ

)

2

sin

θ

(15)

Marching methods

MacCormack scheme

(16)

Relaxation techniques

Basic techniques for solving a system of equations

(17)

Relaxation techniques

Basic techniques for solving a system of equations

Jacobi, easy but slow

Ax

=

b

(18)

Relaxation techniques

Basic techniques for solving a system of equations

Gauss-Seidel

Ax

=

b

=

=

N j i j ij

x

b

a

1 ii i j k j ij i j k j ij i k i

a

x

a

x

a

b

x

> − <

=

1 In interation step k:

(19)

Relaxation techniques

Basic techniques for solving a system of equations

Successive over-relaxation (SOR)

In interation step k:

Applying extrapolation to the Gauss-Seidel method

(

)

1

1

+

=

k i k i k i

x

x

x

ω

ω

(20)
(21)

Relaxation techniques

Point relaxation y x i i+1 i-1 j j+1 j-1

0

2 2 2 2

=

+

y

x

φ

φ

0

2

2

2 1 , 1 , 2 , 1 , 1

=

+

+

+

+ +

y

x

j i ij j i j i ij j i

φ

φ

φ

φ

φ

φ

(

)

(

2

)

1 1 , 1 , 2 1 , 1 , 1 1

1

2

β

φ

φ

β

φ

φ

φ

+

+

+

=

+ − + + − + + ikj k j i k j i k j i k ij

Example: Potential flow

Gauss-Seidel, point relaxation:

(22)

Relaxation techniques

Line relaxation y x i i+1 i-1 j j+1 j-1

(

)

(

2

)

1 1 , 1 , 2 1 , 1 1 , 1 1

1

2

β

φ

φ

β

φ

φ

φ

+

+

+

=

+ − + + − + + + ikj k j i k j i k j i k ij

Gauss-Seidel, line relaxation in x:

(23)

Relaxation techniques

ADI, alternating direction implicit

y x i i+1 i-1 j j+1 j-1

(

)

(

2

)

2 / 1 1 , 1 , 2 2 / 1 , 1 2 / 1 , 1 2 / 1

1

2

β

φ

φ

β

φ

φ

φ

+

+

+

=

+ − + + − + + + ikj k j i k j i k j i k ij Gauss-Seidel, ADI

Further improvement of numerical convergence speed. Computational time can be reduced with up to 20-40 % as compared to Gauss-Seidel with SOR

(

)

(

2

)

1 1 , 1 1 , 2 1 , 1 2 / 1 , 1 1

1

2

β

φ

φ

β

φ

φ

φ

+

+

+

=

+ − + + + − + + + ikj k j i k j i k j i k ij

First along x-direction

(24)

Relaxation techniques

Thomas algorithm Gauss elimination on a tridiagonal system

=

N N N N N

c

c

c

x

x

x

d

b

a

b

a

d

b

a

d

2 1 2 1 2 2 2 1 1 1

0

0

0

0

1 1 1 1 − − − −

=

=

j j j j j j j j j j

c

d

b

c

c

a

d

b

d

d

Put on upper triangular form:

(25)
(26)

Governing equations

Incompressible flow j j i j i j i j i

x

x

u

x

p

f

x

u

u

t

u

+

=

+

2

1

ν

ρ

0

=

i i

x

u

Mass Momentum

Questions:

•Is there a difference between compressible and

incompressible flow that can cause problems? If so, which?

•Can we use our compressible code to solve incompressible

(27)

Pressure correction

Let’s use the MacCormack scheme, for example

Stable if 2 2

1

1

1

y

x

a

y

v

x

u

t

+

+

+

(28)

Pressure correction

pressure-velocity decoupling checker board errors

(29)

Multigrid methods

Multigrid methods are used to increase the computational efficiency of an implicit method

Consider the equation:

f

( )

x

dx

u

d

=

22

0

≤ x

1

Periodic boundary conditions

(30)

Multigrid methods

von Neumann stability analysis

Use the numerical error

ξ

jm

=

u

mj

u

mj *

1 1 1

2

− + −

+

=

m j m j m j

ξ

ξ

ξ

to rewrite the equation

α θ α α

ξ

m n m ij j

c

e

− =

=

2 1 0 Fourier modes of the error:

n

πα

h

πα

θ

α

=

=

2

(31)

Multigrid methods

von Neumann stability analysis

(32)

Multigrid methods

von Neumann stability analysis

( )

( )

4 1 2 1 1

2

1

1

θ

θ

θ

O

G

+

+

=

Use

θ

1

=

2

π

h

( )

1 2 2

( )

4

4

1

1

h

O

h

G

+

+

=

π

θ

( )

1

lim

1 0

=

G

θ

h

Note: What does this tell us?

( )

2 2

( )

4

1

1

4

h

O

h

G

θ

=

π

+

(33)

Multigrid methods

( )

1

lim

1 0

=

G

θ

h

The longer the wave length of the error mode, the more effort one has to put in to converge the solution since the amplification factor will be closer to unity.

The basic idea of multigrid is to create a

(34)

Multigrid methods

Example of a linear problem, the Laplace equation

0

2 2 2 2

=

+

y

u

x

u

2 1 , , 1 , 2 , 1 , , 1 ,

2

2

y

u

u

u

x

u

u

u

Lu

i j i j i j i j i j i j i j

+

+

+

=

− + − +

On each grid, m, we solve:

Lu

im,j

=

R

im,j

Procedure for the Correction Storage (CS) scheme:

1. On the finest grid, M, do a few relaxations (iterations) of to reduce the short wave length error modes.

0

,

=

M j i

Lu

2. Calculate the residual and transfer it to the next coarser grid, restriction: M

(35)

Multigrid methods

Example of a linear problem, the Laplace equation

3. On the coarser grid solve

6. Transfer the correction back to finer grid, prolongation,

and do a few relaxations on each grid until the finest grid is reached

0

, ,

+

=

m j i m j i

R

u

L

m j i m j i m j i

u

u

u

,

=

ˆ −

, ,

4. Repeat steps 2 and 3 until the coarsest grid is reached

5. On the coarsest grid, solve the problem exactly.

(36)

Multigrid methods

Example of a non-linear problem

(37)

Multigrid methods

Example of a non-linear problem On each grid, m, we solve:

(

m

)

i m m m i m i m m m i m i

R

I

R

R

I

u

u

L

−1

=

−1

−1

+

−1 −1

Similar procedure as for linear problems.

Differences:

1. Fine grid solution also restricted, i.e. and more complex residual term

m i m m m i

I

u

u

−1

=

−1 Coarse grid residual Restricted fine grid residual

Coarse grid residual

(38)
(39)
(40)

Discretisation and grid

Questions:

•How complex is the geometry?

•What accuracy is required? Grid quality? •What about stability?

(41)
(42)

Grid types

(43)

Unstructured grid

Grid types

(44)

Grid types

(45)

Grid types

(46)

Grid quality

(47)

Equilateral volume skew:

size

cell

optimal

size

cell

-size

cell

optimal

Optimal cell cell Aspect ratio:

(48)
(49)
(50)
(51)
(52)

References

Related documents

If the control is switched to AES/AUTO or AC/GAS mode of operation while the CHECK indicator lamp is on, it will function properly, but the CHECK indicator lamp will not go off

To overcome this problem, different serological tests using single Leptospiral recombinant outer membrane proteins (OMP) such as Lipl32, LipL21, OmpL1/2, Lipl41 and rLoa22 and

At the tranche (bond) level, CMAlert provides information on the name of the tranche, the issuance amount, denominator, ratings (name of the credit rating agencies and ratings

What is the influence on water quality in temperate eutrophic lakes of a reduction of planktivorous and benthivorous fish (performed directly or indirectly through stocking

 Add, delete, and edit data and insert new records using the table and form view  Create, and modify tables, forms, report, and queries in design view.. Excel 2003: Basic

The application of our computational methodology to study the effect of the partial surface charge compensation in ferroelectric ultrathin films led to the prediction that, de-

All have found significant harmful effects on children and youth (e.g., the 1954 Kefauver hearings; the 1969 National Commission on the Causes and Prevention of Violence; the

On any given day, mill ions of consumers use HUL products and they strive ha rd to increase their consumer base by developing innovative products that cater to different consumer