computational fluid dynamics cfd - · pdf filesolving system of equations parabolic hyperbolic...

35
Computational Fluid Dynamics CFD Solving system of equations

Upload: dinhdang

Post on 19-Mar-2018

217 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Computational Fluid Dynamics

CFD

Solving system of equations

Page 2: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

2

Basic steps of CFD

Problem

?

•Gov. Eq.

•BC

•Init. Cond.

...,, jijti uu

•Discretization •Result

•Solution•OK?

Page 3: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Solving system of equations

PDomain of

dependenceRegion of influence

Region of influenceDomain of

dependence

P

P

Every point influences all other points

Parabolic

Hyperbolic

Elliptic

The type of equations decides solution strategy

Marching problems Equilibrium problems

Page 4: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Solving system of equations

Parabolic Hyperbolic Elliptic

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

Note! Time dependent incompressible flow

has a mixed character: elliptic in space and

parabolic in time.

Page 5: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Marching methods

1st order

Consider the inviscid Burger equation 0

x

uu

t

u

Conserved form )( 0 uFFx

F

t

u

Start with a Taylor expansion around (x,t)

HOT,,,

txt

uttxuttxu

u1,1 ui,1ui+1,1ui-1,1 uN,1

u1,n+1 ui,n+1ui+1,n+1ui-1,n+1 uN,n+1

u1,n ui,nui+1,nui-1,n uN,n

t

x

Page 6: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Marching methods

1st order

The idea is to replace the time derivatives in the expansion by spacial ones

First derivative:

x

F

t

u

Apply 2nd order central differencing:

2

111n

i

n

in

i

n

i

FF

x

tuu

u1,1 ui,1ui+1,1ui-1,1 uN,1

u1,n+1 ui,n+1ui+1,n+1ui-1,n+1 uN,n+1

u1,n ui,nui+1,nui-1,n uN,n

t

x

Page 7: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Marching methods

Lax-Wendroff scheme

Consider the inviscid Burger equation 0

x

uu

t

u

Conserved form )( 0 uFFx

F

t

u

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

HOT2

,,

,

2

22

,

txtx t

ut

t

uttxuttxu

Page 8: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

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

xxt

F

t

u 2

2

2

Second derivative:

Since F is a function of u we can write

x

uA

x

u

u

F

x

F

t

u

Jacobian

t

uA

t

u

u

F

t

F

Page 9: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Marching methods

Lax-Wendroff scheme

Hence,

x

FA

xt

u2

2

The Taylor expansion can now be written as:

HOT2

,,,

2

,

txtx x

FA

x

t

x

Fttxuttxu

Page 10: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Marching methods

Lax-Wendroff scheme

Apply 2nd order central differencing:

nj

nj

nj

nj

nj

nj

nj

njn

jnj FFAFFA

x

tFF

x

tuu 12/112/1

2111

2

1

2

Since uu

FA

uF

2

2

the Jacobian is calculated as2

12/1

jjj

uuA

A stability analysis gives sin2cos121

2

Ax

tiA

x

tG

Stable if 1

x

tuthe CFL-condition

Page 11: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Marching methods

MacCormack scheme

This is a two step version of the L-W with the advantage that

no Jacobians are needed. Otherwise it has identical properties

to the L-W

11

111

11

2

1 nj

nj

nj

nj

nj

nj

nj

nj

nj

FFx

tuuu

FFx

tuu Predictor

Corrector

Page 12: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Solving system of equations

PDomain of

dependenceRegion of influence

Region of influenceDomain of

dependence

P

P

Every point influences all other points

Parabolic

Hyperbolic

Elliptic

Marching problems Equilibrium problems

Page 13: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

13

Relaxation techniques

Sx

T

2

2

n

i

n

i

n

i

n

i SxOx

TTT

)(2 2

2

1

1

11

1

T1,k+1 Ti,k+1Ti+1,k+1Ti-1,k+1 TN,k+1

T1,k Ti,kTi+1,kTi-1,k TN,k

n

i

n

i

n

i

n

i SxTTT 21

1

11

1 2

nnnn SxTTT 2

21

1

1

2

1

3 2

nnnn SxTTT 3

21

2

1

3

1

4 2

nnnn SxTTT 4

21

3

1

4

1

5 2

Page 14: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Relaxation techniquesBasic techniques for solving a system of equations

bAx System of equations

NNNNN

N

b

b

b

x

x

x

aa

a

aaa

2

1

2

1

1

21

11211

Direct methods

•Cramer

•Gauss elimination

•Heavy

•Error accumulation

•Thomas algorithm

•Tri-diagonal systems

Iterative methods

Page 15: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Thomas algorithm

NNNN

N

c

c

c

x

x

x

db

a

b

adb

ad

2

1

2

1

1

3

222

11

0

0

00

1

1

1

1

j

j

jjj

j

j

jjj

cd

bcc

ad

bdd

Put on upper triangular form:

Unknowns computed using

back-substitution:

1

1

j

jjj

j

N

NN

a

xdcx

d

cx

Nj ,.......3,2

1.........2,1 NNj

Page 16: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Jacobi

Easy but slow

bAx

N

j

ijij bxa

1

ii

ij

kjiji

ki

a

xab

x

1

In interation step k:

n

i

n

i

n

i

n

i SxTTT 21

1

11

1 2

2

2

111n

i

k

i

k

ik

i

SxTTT

T1,k+1 Ti,k+1Ti+1,k+1Ti-1,k+1 TN,k+1

T1,k Ti,kTi+1,kTi-1,k TN,k

Page 17: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Gauss-Seidel

bAx

N

j

ijij bxa

1

ii

ij

kjij

ij

kjiji

ki

a

xaxab

x

1

In interation step k:

Always uses the best value available, gives faster solution

n

i

n

i

n

i

n

i SxTTT 21

1

11

1 2

2

21

111n

i

k

i

k

ik

i

SxTTT

T1,k+1 Ti,k+1Ti+1,k+1Ti-1,k+1 TN,k+1

T1,k Ti,kTi+1,kTi-1,k TN,k

t

Page 18: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

18

Successive Over-Relaxation (SOR)

• Accelerate convergence

• w > 1 overrelaxation

• w < 1 underrelaxation

(for stability)

k

T

Texact

T

k+1

Tk

Tk+1

k

T

Texact

wT

k+1

T*k

T*k+1

)( 11 k

i

k

i

k

i

k

i TTTT w

2

21

111n

i

k

i

k

ik

i

SxTTT

2

221

11

1

k

i

n

i

k

i

k

i

k

i

k

i

TSxTT

TT

w

Page 19: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

ResidualsWhen should we stop

the iterations?

m

ji

m

jiRLu

,,

Page 20: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Relaxation techniquesPoint relaxation

y

xi i+1i-1

j

j+1

j-1

02

2

2

2

yx

0

222

1,1,

2

,1,1

yx

jiijjijiijji

2

1

1,1,

21

,1,11

12

k

ji

k

ji

k

ji

k

jik

ij

Example: Potential flow

Gauss-Seidel, point relaxation:

2

2

y

x

Page 21: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Relaxation techniquesLine relaxation

y

xi i+1i-1

j

j+1

j-1

2

1

1,1,

21

,1

1

,11

12

k

ji

k

ji

k

ji

k

jik

ij

Gauss-Seidel, line relaxation in x:

In line relaxation a whole line is solved at once using a

direct method, for example the Thomas algoritm.

Page 22: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Relaxation techniquesADI, alternating direction implicit

y

xi i+1i-1

j

j+1

j-1

2

2/1

1,1,

22/1

,1

2/1

,12/1

12

k

ji

k

ji

k

ji

k

jik

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,

21

,1

2/1

,11

12

k

ji

k

ji

k

ji

k

jik

ij

First along x-direction

then along y-direction

Page 23: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methods

• Accelerate convergence

Page 24: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methods

• Accelerate convergence

Page 25: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methods

• Accelerate convergence

Page 26: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methods

• Accelerate convergence

Page 27: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methodsMultigrid methods are used to increase the

computational efficiency of an implicit method

Consider the equation: xfdx

ud

2

2

10 x

Periodic boundary conditions

Create a grid: jhxj 120 nj

nh

2

1

Discretisej

jjjf

h

uuu

2

112

Gauss-Seidelj

m

j

m

j

m

jfhuuu 21

112

nj 21

nj 21

01 uu

Page 28: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methodsvon Neumann stability analysis

Use the numerical error*m

j

m

j

m

juu

1

112

m

j

m

j

m

jto rewrite the equation

ijn

mm

jec

12

0

Fourier modes of

the error:h

n

2

1lim 10

Gh

What does this tell us?

Amplification factor

Remember:

))sin()(cos( bibee aiba

Page 29: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methods 1lim

10

Gh

Short wavelength (high frequency) errors damped faster

Create grids with different resolutions

Low frequency errors on fine grids are high(er) frequency errors on coarser grids (damps faster when relaxed on coarse

grids)

Page 30: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methodsExample of a linear problem, the Laplace equation

02

2

2

2

y

u

x

u

2

1,,1,

2

,1,,1

,

22

y

uuu

x

uuuLu

jijijijijiji

ji

On each grid, m, we solve:m

ji

m

jiRLu

,,

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

jiLu

2. Calculate the residual and transfer it to the next

coarser grid, restriction: M

ji

M

M

M

jiRIR

,

11

,

Residual

Page 31: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methodsExample 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

ji

m

jiRuL

m

ji

m

ji

m

jiuuu

,,,ˆ

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

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

correction Previous solution on

grid m

m

ji

m

m

m

ji

m

jiuIuu

,

11

,

1

Page 32: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methodsMultigrid cycles

V-cycle:

= relaxation

restrictionprolongation

m=M

m=1

Page 33: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Geometric multigrid

• Several grids

explicitly generated

• Suitable for structured

grids

• Several type of

cycles:

– V, W, ...

33

Page 34: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Algebraic multigrid

• Coarser levels built

’on-line’

• Can be used for

unstructured

meshes

• Mostly for elliptic

problems

• Too many/coarse

levels not

neccessarily help34

Page 35: Computational Fluid Dynamics CFD - · PDF fileSolving system of equations Parabolic Hyperbolic Elliptic Marching methods may be used since the solution only depends on previous data

Multigrid methods