Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM...

42
Remark: foils with „black background“ could be skipped, they are aimed to the more advanced courses Rudolf Žitný, Ústav procesní a zpracovatelské techniky ČVUT FS 2010 Solvers, schemes SIMPLEx, upwind,… Computer Fluid Dynamics E181107 CFD7 2181106

Transcript of Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM...

Page 1: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Remark: foils with „black background“could be skipped, they are aimed to the more advanced courses

Rudolf Žitný, Ústav procesní a zpracovatelské techniky ČVUT FS 2010

Solvers, schemes SIMPLEx, upwind,…

Computer Fluid Dynamics E181107CFD7

2181106

Page 2: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FINITE VOLUME METHODCFD7

x

δx

y

z

δzSouthWest

Top

E

North

Bottom

δx

δy

FINITE CONTROL VOLUME δδδδx = Fluid element dx

Finite size Infinitely small size

Page 3: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM diffusion problem 1DCFD7

CV - control volume

A – surface of CV

[ ( ) ] 0

( ) 0

CV

A CV

S dV

n dA S dV

Φ

Φ

∇ Γ∇Φ + =

Γ∇Φ + =

∫ ∫

i

i

Gauss theorem

1D case ( ) 0 ( ) ( )A B

d dS A B

dx dx

ΦΓ + = Φ =Φ Φ =Φ

A W P E B

w e

|2

P E E Pe e

PE

d

dx xδΓ +Γ Φ −ΦΦΓ = = |

2P W P W

w wWP

d

dx xδΓ +Γ Φ −ΦΦΓ = =

Diffusive flux

Page 4: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM diffusion problem 1DCFD7

( ) 0A CV

n dA S dVΦΓ∇Φ + =∫ ∫�

i

( ) ( ) 0

0

( ) ( ) ( )

e w

P WE Pe e w w U P P

PE WP

e e w w w w e eP P W E U

PE WP WP PE

d dA A S V

dx dx

A A S Sx x

A A A AS S

x x x x

δ δ

δ δ δ δ

Φ ΦΓ − Γ + ∆ =

Φ −ΦΦ −ΦΓ −Γ + + Φ =

Γ Γ Γ Γ+ − Φ = Φ + Φ +

aPaW

aE

Check properties

�aP = aW+aE for S=0 (without sources)

�All coefficients are positive

Overall flux fromthe west side

Linearization of source term

Page 5: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Tutorial – sphere dryingCFD7

W P E

0P WE Pe e w w

PE WP

T TT Tr k r k

x xδ δ−− − =

e eA r∼

202

202

1( ) 0 | 0 | ( ( ))

1( ) 0 | 0 | ( ( ))

wr r R o

w w wr r R e w

dd dT dT dTr k k T T R hD

r dr dr dr dr drd d dd

r D k Rr dr dr dr dr

ωα

ω ω ω β ω ω

= =

= =

= = = − +∆

= = = −

Heat transfer from air at temperature To

Enthalpy of evaporation

Diffusion coefficientMass transfer

coefficient

∆x ∆x/2

W P R

Internal control volumes

( ) 0P Wo R w w

WP

T TR T T r k

δ−− − − =

TR temperature at surface of sphere must be extrapolated (using TW and TP)

Page 6: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM diffusion problem 2DCFD7

, ,....

P P W W E E N N S S U

w w e eW E

WP PE

P W E N S P

a a a a a S

A Aa a

x x

a a a a a S

δ δ

Φ = Φ + Φ + Φ + Φ +Γ Γ= =

= + + + −

( ) ( ) 0Sx x y y

∂ ∂Φ ∂ ∂ΦΓ + Γ + =∂ ∂ ∂ ∂

W P E

N

S

A

Boundary conditions

( )

|

| ( ( ) )

A

A A

A e

A

qx

k Ax

α

Φ = Φ∂Φ =∂

∂Φ = Φ − Φ∂

�First kind (Dirichlet BC)

�Second kind (Neumann BC)

�Third kind (Newton’s BC)

Example: insulation q=0

Example: Finite thermal resistance (heat transfer

coefficient α)

Page 7: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM unstructural mesh generationCFD7

i

j

Voronoi control volume associated with node i. Set of points x,yhaving distance to I less than the distance to any other node j.

Voronoi polygons

Delaunay triangulation

Circumcenterremains inside

Delaunay triangle

Finite Volume Method

Finite Element Method

Page 8: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM structural mesh generationCFD7

0

1

0

1

0

1

0

1

0X∇ ∇ =i

0Y∇ ∇ =i

Laplace equation solvers

Page 9: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM convection diffusion 1DCFD7

CV - control volume

A – surface of CV

( ) [ ( ) ]

( ) ( )

CV CV

A A CV

u dV S dV

n u dA n dA S dV

ρ

ρ

Φ

Φ

∇ Φ = ∇ Γ∇Φ +

Φ = Γ∇Φ +

∫ ∫

∫ ∫ ∫

i i

� � �

i i

Gauss theorem

1D case ( ) ( )d d d

u Sdx dx dx

ρ ΦΦ = Γ +

A W P E B

w e

( ) ee e e

PE

F u Dx

ρδ

Γ= =( ) ww w w

WP

F u Dx

ρδΓ= =

( ) ( )e w e E Pe w w P W U P PF F D D S S− = Φ −Φ − Φ −Φ + +Φ ΦΦ

Page 10: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM convection diffusion 1DCFD7

Relative importance of convective transport is characterised by Pecletnumber of cell (of control volume, because Pe depends upon size of cell)

w ew e

WP PE

D Dx xδ δΓ Γ= =

( ) ( ) w w e eF u F uρ ρ= =F-mass flux (through faces A)

D-diffusion conductanceContinuity equation (mass flowrateconservation) Fe=Fw

2

3

Re [ . ]

RePr [ ]/

Re [ ]

p p

m ABAB

u x F kgPe Pa s

D m s

u x k W kg K kgPe

k c c m K J m s

u x kg m kgPe Sc D

D m s m s

ρ δ µµ

ρ δ

ρ δ ρρ

= = = Γ = =⋅

⋅= = Γ = =⋅ ⋅

= = Γ = =⋅

Prandtl

SchmidtBinary diffusion coef

Thermal conductivity

FPe

D=

Page 11: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM convection diffusion 1DCFD7

Methods differ in the way how the unknown transported values at the control

volume faces (ΦΦΦΦw , ΦΦΦΦe) are calculated (different interpolation techniques)

Result can be always expressed in the form

Properties of resulting schemes should be evaluated

�Conservativeness

�Boundedness (positivity of coefficients)

�Transportivity (schemes should depend upon the Peclet number of cell)

P P nb nbneighbours

a aΦ = Φ∑

Page 12: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM central scheme 1DCFD7

�Conservativeness (yes)

�Boundedness (positivity of coefficients)

�Transportivness (no)

2 2

P P W W E E

w eW w E e

a a a

F Fa D a D

Φ = Φ + Φ

= + = −

1 1( ) ( )

2 2e P E w P WΦ = Φ +Φ Φ = Φ +Φ

| |2e

ee

FPe

D= <

Very fine mesh is necessary

Page 13: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM upwind 1 st order 1DCFD7

�Conservativeness (yes)

�Boundedness (positivity of coefficients) YES for any Pe

�Transportivness (YES)

( ) ( )max ,0 max ,0P P W W E E

W w w E e e

a a a

a D F a D F

Φ = Φ + Φ= + = + −

for flow direction to right 0 else

for 0 else e P e e E

w P w w W

F

F

Φ = Φ > Φ = ΦΦ = Φ < Φ = Φ

But at a prize of decreased order of accuracy (only 1st

order!!)

Page 14: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM hybrid upwind Spalding 1972 1DCFD7

�Conservativeness (yes)

�Boundedness (positivity of coefficients) YES for any Pe

�Transportivness (YES)

max , ,0 max , ,02 2

P P W W E E

w eW w w E e e

a a a

F Fa F D a F D

Φ = Φ + Φ

= + = − −

But at a prize of decreased order of accuracy at high

Pe

�Central scheme for Pe<2

�Upwind with diffusion supressed for Pe>2

Page 15: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM power law Patankar 1980 1DCFD7

�Conservativeness (yes)

�Boundedness (positivity of coefficients) YES for any Pe

�Transportivness (YES)

5

5

max (1 ) ,0 max( ,0) 10

max (1 ) ,0 max( ,0)10

P P W W E E

wW w w

eE e e

a a a

Pea D F

Pea D F

Φ = Φ + Φ

= − +

= − + −

�Polynomial flow for Pe<10

�Upwind with zero diffusion for Pe>10

5(1 ) 110 2

Pe Pe− ≅ −

Page 16: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM QUICK Leonard 1979 1DCFD7

�Third order of accuracy very low numerical diffusion comparing with other s chemes

�Scheme is not bounded (stability problems are frequently encountered)

3 3+ ( +1) (1 )- (2- )

8 8 8 8

(1 ) 8 8

P P W W E E WW WW EE EE

e w w wW e w w E w e e

w eWW w EE e

a a a a a

F F F Fa D a D

F Fa a

α α α α

α α

Φ = Φ + Φ + Φ + Φ

= + = − − +

= − = −

Quadratic Upwind Interpolation – more nodal points necessary

WW W P E EE

w e

αe=1 for Fe>0 else αe=0. αw=1 for Fw>0 else αw=0.

Page 17: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM exponential Patankar 1980 1DCFD7

�Conservativeness (yes)

�Boundedness (positivity of coefficients) YES for any Pe

�Transportivness (YES)

/2 /2

/2 /2 /2 /2

P P W W E E

Pe Pe

W EPe Pe Pe Pe

a a a

e ea a

e e e e

− −

Φ = Φ + Φ

= =+ +

�Exact solution for constant velocity and diffusion coefficient Γ

FPe

D=

Page 18: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM exponential proofCFD7

1 1 2 1( )x

PexF x

c c c e cx x x F x Pe x

δδ∂Φ ∂ ∂Φ Γ ∂Φ ∂Φ= Γ → Φ = + → Φ = + → Φ = +∂ ∂ ∂ ∂ ∂

2 1

2 1

PeE

PeW

c e c

c e c−

Φ = +

Φ = +

�Exact solution for constant velocity and diffusion coefficient Γ

Assume constant mass flux F and constant Pe=F/D.

1

2

Pe PeE W

Pe Pe

E WPe Pe

e ec

e e

ce e

Φ − Φ=−

Φ − Φ=−

(1 ) (1 )Pe Pe Pe PeE W E W E W

P Pe Pe Pe Pe Pe Pe

e e e e

e e e e e e

− −

− − −

Φ − Φ Φ − Φ Φ − + Φ −Φ = + =− − −

/2 /2 /2 /2

/2 /2 /2 /2 /2 /2

/2

/2 /2

1 ( )

( )( )

Pe Pe Pe Pe Pe

E Pe Pe Pe Pe Pe Pe Pe Pe

Pe

W Pe Pe

e e e e ea

e e e e e e e e

ea

e e

− − − −

− − − −

− −= = =− − + +

=+

Analytical solution

Boundary conditions

Identified constants

Exact solution at central point

Page 19: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM central scheme with modified viscosityCFD7

Almost any scheme (with the exception of QUICK) can be converted to central scheme introducing modified transport coefficient Γ

Modified diffusion conductances are

and

.

* * 2 2w e

P P W W E E

w eW E

a a a

F Fa D a D

Φ = Φ + Φ

= + = −

*** * e

w e

w

WP PE

D Dx xδ δ

ΓΓ= =

*

*

*

1

| |1

2/2

tanh /2

Pe

Pe

Pe

Γ =ΓΓ = +ΓΓ =Γ

Central scheme

Upwind scheme

Exponential scheme

Page 20: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

There are two basic errors caused by approximation of convective terms

�False diffusion (or numerical diffusion) – artificial smearing of jumps, discontinuities. Neglected terms in the Taylor series expansion of first derivatives (convective terms) represent in fact the terms with second derivatives (diffusion terms). So when using low order formula for convection terms (for example upwind of the first order), their inaccuracy is manifested by the artificial increase of diffusive terms (e.g. by increase of viscosity). The false diffusion effect is important first of all in the case when the flow direction is not aligned with mesh, see example

�Dispersion (or aliasing) – causing overshoots, artificial oscillations. Dispersion means that different components of Fourier expansion (of numerical solution) move with different velocities, for example shorter wavelengths move slower than the velocity of flow.

FVM dispersion / diffusionCFD7

0 - boundary condition, all values are zero in the right triangle (without diffusion)

1Numerical diffusion

Numerical dispersion

Page 21: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM Navier Stokes equationsCFD7

2

2

( ) ( )

( ) ( )

0

u

v

u uv p u uS

x y x x x y y

uv v p v vS

x y y x x y y

u v

x y

ρ ρ µ µ

ρ ρ µ µ

ρ ρ

∂ ∂ ∂ ∂ ∂ ∂ ∂+ = − + + +∂ ∂ ∂ ∂ ∂ ∂ ∂

∂ ∂ ∂ ∂ ∂ ∂ ∂+ = − + + +∂ ∂ ∂ ∂ ∂ ∂ ∂

∂ ∂+ =∂ ∂

Example: Steady state and 2D (velocities u,v and pressure p are unknown functions)

This is equation

for u

This is equation

for v

This is equation

for p? But pressure p is not in the continuity equation!Solution of this problem is in SIMPLE methods, described later

Page 22: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM checkerboard patternCFD7

10

10

10

10

10

10

10

10 10

1000

0

0

0

0

0

00 0

0

Other problem is called checkerboard pattern

This nonuniform distribution of pressure has no effect upon NS equations

The problem appears as soon as the u,v,p values are concentrated in the same control volume

W P E

2

( ) ( ) u

vS

x y x x x

u u up

y

u

y

ρ ρ µ µ∂ ∂ ∂ ∂ ∂ ∂ ∂+ = − + + +∂ ∂ ∂ ∂ ∂ ∂ ∂

10 10| 0

2 2E W

P

p pp

x x xδ δ−∂ −≅ = =

Page 23: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM staggered gridCFD7

10

10

10

10

10

10

10

10 10

1000

0

0

0

0

0

00 0

0

Different control volumes for different equations

Control volume for momentum balance in

y-direction

Control volume for momentum balance in

x-direction

Control volume for continuity equation,

temperature, concentrations

2

0 10

( ) ( ) u

p

u u u

x x

vS

x y x x x

p u

y y

δ

ρ ρ µ µ

∂ −≅∂

∂ ∂ ∂ ∂ ∂ ∂ ∂+ = − + + +∂ ∂ ∂ ∂ ∂ ∂ ∂

Page 24: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM staggered gridCFD7

Location of velocities and pressure in staggered grid

I-2 I-1 I I+1 I+2i-1 i i+1 i+2

J+1

J

J-1

J-2

j+2

j+1

j

j-1

pu

v

Pressure I,J

U i,J

V I,j

Control volume for continuity equation,

temperature, concentrations

Control volume for momentum balance in

x-direction

Control volume for momentum balance

in y-direction

Page 25: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM continuity equationCFD7

I-2 I-1 I I+1 I+2i-1 i i+1 i+2

J+1

J

J-1

J-2

j+2

j+1

j

j-1

pu

v

Pressure I,J

U i,J

V I,j

Control volume for continuity equation,

temperature, concentrations

, 1 ,1, , 0I j I ji J i J v vu u

x yδ δ++ −−

+ =

δx

0u v

x y

∂ ∂+ =∂ ∂

Page 26: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM momentum xCFD7

I-2 I-1 I I+1 I+2i-1 i i+1 i+2

J+1

J

J-1

J-2

j+2

j+1

j

j-1

pu

Pressure I,J

U i,J

V I,jp

Control volume for momentum balance in

x-direction

, , , 1, ,( )i J i J nb nb i J I J I J iJneighbours

a u a u A p p b−= + − +∑

2

( ) ( ) u

vS

x y x x x

u u up

y

u

y

ρ ρ µ µ∂ ∂ ∂ ∂ ∂ ∂ ∂+ = − + + +∂ ∂ ∂ ∂ ∂ ∂ ∂

Page 27: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM momentum yCFD7

I-2 I-1 I I+1 I+2i-1 i i+1 i+2

J+1

J

J-1

J-2

j+2

j+1

j

j-1

p

v

Pressure I,J

U i,J

V I,j

Control volume for momentum balance

in y-direction

p

( ) ( ) v

uS

x y y x

v vv v

x y y

vpρ ρ µ µ∂ ∂ ∂ ∂ ∂ ∂ ∂+ = − + + +∂ ∂ ∂ ∂ ∂ ∂ ∂

, , , , 1 , ,( )I j I j nb nb I j I J I J I jneighbours

a v a v A p p b−= + − +∑

Page 28: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM SIMPLE step 1 (velocities)CFD7

, , 1 ,

* * * *, , ,( )

I j nb I J I JI j nb I j I jneighbours

a v va A p p b−

= + − +∑

Input: Approximation of pressure p*

, 1, ,

* * * *, , ( )

i J nb I J I Ji J nb i J iJneighbours

a u Au a p p b−

= + − +∑

Page 29: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM SIMPLE step 2 (pressure correction)CFD7

* * *' ' 'p p p u u u v v v= + = + = +

' ' 'IJ IJ nb nb IJneighbours

a p a p b= +∑

, 1, ,

* * * *, , ( )

i J nb I J I Ji J nb i J iJneighbours

a u Au a p p b−

= + − +∑

, , , 1, ,( )i J i J nb nb i J I J I J iJneighbours

a u a u A p p b−= + − +∑

“true”solution

, 1, ,

' ' ' ', , ( )

i J nb I J I Ji J nb i Jneighbours

a au u A p p−

= + −∑

subtract Neglect!!!

, 1, , , 1 ,

' ' ' ' ' ', , ,( ) ( )

i J I J I J I J I Ji J I j I jd p p d p pu v− −

= − = −Substitute u*+u’ and v*+v’ into continuity equation

Solve equations for pressure corrections

Page 30: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM SIMPLE step 3 (update p,u,v)CFD7

*, , ,

*, , , 1, ,

*, , , , 1 ,

'

( ' ' )

( ' ' )

I J I J I J

i J i J i J I J I J

I j I j I j I J I J

p p p

u u d p p

v v d p p

← +

← + −

← + −

Continue with the improved pressures to the step 1

Only these new pressures are necessary for next iteration

Page 31: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM SIMPLEC (SIMPLE corrected)CFD7

, 1, ,

, , , 1, ,

, 1, ,

' ' ' ', ,

' ' ' ' ' ', ,

,' ' '

,

( )

( )

( )

i J nb I J I J

i J i J nb i J I J I J

i J I J I J

i J nb i Jneighbours

i J nb nb nb i Jneighbours neighbours neighbours

i J

i J nbneighbours

a a A p p

a a a a A p p

Ap p

a a

u u

u u u u

u

= + −

− = − + −

= −−

∑ ∑ ∑

∑Improved diJ

Neglect!!! Good estimate as soon as neighbours are not

far from center

Page 32: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM SIMPLER (SIMPLE Revised)CFD7

Idea: calculate pressure distribution directly from the Poisson’s equation

2

2

2

( )

( )

( , )

uu p u

uu p u

p f u v

ρ µρ µ

∇ = −∇ + ∇∇ ∇ = −∇ ∇ + ∇ ∇∇ =

�� �

i

�� �

i i i i

Page 33: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

we have at each cell discretised equation in this form,

For continuity we have

where

This interpolation of variables H and based on coefficients al forpressure velocity couplingis called Rhie-Chow interpolation . See also

FVM Rhie Chow (Fluent)CFD7

Rhie C.M., Chow W.L.: Numerical study of the turbulent flow past an airfoil with trailing edge separation. AIAA Journal, Vol.21, No.11, 1983

The way how to avoid staggering (difficult implementation in unstructured meshes) was suggested in the paper

Page 34: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM solversCFD7

�TDMA – Gauss elimination tridiagonal matrix(obvious choice for 1D problems, but suitable for 2D and 3D problems too, iteratively along the x,y,z grid lines – method of alternating directions ADI)

�PDMA – pentadiagonal matrix (suitable for QUICK), Fortran version

�CGM – Conjugated Gradient Method (iterative method: eachiteration calculates increment of vector Φ in the direction of gradient of minimised function – square ofresidual vector)

�Multigrid method (Fluent)

Solution of linear algebraic equation system Ax=b

Page 35: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Solver TDMA tridiagonal system MATLABCFD7

function x = TDMAsolver(a,b,c,d)%a, b, c, and d are the column vectors for the comp ressed tridiagonal matrixn = length(b); % n is the number of rows

% Modify the first-row coefficientsc(1) = c(1) / b(1); % Division by zero risk.d(1) = d(1) / b(1); % Division by zero would imply a singular matrix.

for i = 2:nid = 1 / (b(i) - c(i-1) * a(i)); % Division by zero risk. c(i) = c(i)* id; % Last value calcul ated is redundant.d(i) = (d(i) - d(i-1) * a(i)) * id;

end

% Now back substitute.x(n) = d(n);for i = n-1:-1:1

x(i) = d(i) - c(i) * x(i + 1);endend

Forward step (eliminationentries bellow diagonal)

1 1 1,2,...,i i i i i i ia x b x c x d i n− ++ + = =

Page 36: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Solver TDMA applied to 2D problems (ADI)CFD7

x

y

Y-implicit step (repeated application ofTDMA for 10 equations, proceeds from

left to right) X-implicit step (proceedsbottom up)

Page 37: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Solver PDMA pentagonal system MATLABCFD7

function x=pentsolve(A,b)

% Solve a pentadiagonal system Ax=b where A is a strongly nonsingular matrix% Reference: G. Engeln-Muellges, F. Uhlig, "Numerical Algorithms with C"% Chapter 4. Springer-Verlag Berlin (1996)%% Written by Greg von Winckel 3/15/04% Contact: [email protected]%[M,N]=size(A);x=zeros(N,1);% Check for symmetryif A==A' % Symmetric Matrix Scheme

% Extract bandsd=diag(A);f=diag(A,1);e=diag(A,2); alpha=zeros(N,1);gamma=zeros(N-1,1);delta=zeros(N-2,1);c=zeros(N,1);z=zeros(N,1); % Factor A=LDL'alpha(1)=d(1);gamma(1)=f(1)/alpha(1);delta(1)=e(1)/alpha(1); alpha(2)=d(2)-f(1)*gamma(1);gamma(2)=(f(2)-e(1)*gamma(1))/alpha(2);delta(2)=e(2)/alpha(2); for k=3:N-2

alpha(k)=d(k)-e(k-2)*delta(k-2)-alpha(k-1)*gamma(k-1)^2;gamma(k)=(f(k)-e(k-1)*gamma(k-1))/alpha(k);delta(k)=e(k)/alpha(k);

end alpha(N-1)=d(N-1)-e(N-3)*delta(N-3)-alpha(N-2)*gamma(N-2)^2;gamma(N-1)=(f(N-1)-e(N-2)*gamma(N-2))/alpha(N-1);alpha(N)=d(N)-e(N-2)*delta(N-2)-alpha(N-1)*gamma(N-1)^2; % Update Lx=b, Dc=z z(1)=b(1);z(2)=b(2)-gamma(1)*z(1); for k=3:N

z(k)=b(k)-gamma(k-1)*z(k-1)-delta(k-2)*z(k-2);end c=z./alpha;

% Backsubstitution L'x=cx(N)=c(N);x(N-1)=c(N-1)-gamma(N-1)*x(N); for k=N-2:-1:1

x(k)=c(k)-gamma(k)*x(k+1)-delta(k)*x(k+2);end

else % Non-symmetric Matrix Schemed=diag(A);e=diag(A,1);f=diag(A,2);h=[0;diag(A,-1)];g=[0;0;diag(A,-2)]; alpha=zeros(N,1);gam=zeros(N-1,1);delta=zeros(N-2,1);bet=zeros(N,1); c=zeros(N,1);z=zeros(N,1); alpha(1)=d(1);gam(1)=e(1)/alpha(1);delta(1)=f(1)/alpha(1);bet(2)=h(2);alpha(2)=d(2)-bet(2)*gam(1);gam(2)=( e(2)-bet(2)*delta(1) )/alpha(2);delta(2)=f(2)/alpha(2); for k=3:N-2

bet(k)=h(k)-g(k)*gam(k-2);alpha(k)=d(k)-g(k)*delta(k-2)-bet(k)*gam(k-1);gam(k)=( e(k)-bet(k)*delta(k-1) )/alpha(k);delta(k)=f(k)/alpha(k);

endbet(N-1)=h(N-1)-g(N-1)*gam(N-3);alpha(N-1)=d(N-1)-g(N-1)*delta(N-3)-bet(N-1)*gam(N-2);gam(N-1)=( e(N-1)-bet(N-1)*delta(N-2) )/alpha(N-1);bet(N)=h(N)-g(N)*gam(N-2);alpha(N)=d(N)-g(N)*delta(N-2)-bet(N)*gam(N-1);% Update b=Lcc(1)=b(1)/alpha(1);c(2)=(b(2)-bet(2)*c(1))/alpha(2);

for k=3:Nc(k)=( b(k)-g(k)*c(k-2)-bet(k)*c(k-1) )/alpha(k);

end

% Back substitution Rx=cx(N)=c(N);x(N-1)=c(N-1)-gam(N-1)*x(N);for k=N-2:-1:1

x(k)=c(k)-gam(k)*x(k+1)-delta(k)*x(k+2); end

end

Page 38: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Solver CGM conjugated gradient GNUCFD7

function [x] = conjgrad(A,b,x)r=b-A*x;p=r;rsold=r'*r;

for i=1:size(A)(1)Ap=A*p;alpha=rsold/(p'*Ap);x=x+alpha*p;r=r-alpha*Ap;rsnew=r'*r;if sqrt(rsnew)<1e-10

break;endp=r+rsnew/rsold*p;rsold=rsnew;

endend

Solution of linear algebraic equation system Ax=b

Minimisation of quadratic function

Residual vector in k-thiteration

Vector of increment conjugated with previous increments

Page 39: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Solver MULTIGRIDCFD7

Rough grid (small wave numbers) Fine grid (large wave numbers details)

Interpolation fromrough to fine grid

Averaging from fineto rough grid

Solution on a rough grid takes into account very quickly long waves (distantboundaries etc), that is refined on a finer grid.

Page 40: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

Unsteady flowsCFD7

Discretisation like in the finite difference methods discussed previously

n

n+1

∆x

∆tnPTn

WT nET

1nPT +

n-1

n

n+1

∆x

∆tnPT

1nWT + 1n

ET +1nPT +

n-1

n

n+1

∆x

∆tnPTn

WT nET

1nPT +

n-1

1nWT + 1n

ET +

Example: Temperature field

EXPLICIT scheme IMPLICIT scheme CRANK NICHOLSON scheme

2

2

xt

a

∆∆ <

2

2

T Ta

t x

∂ ∂=∂ ∂

First order accuracy in time First order accuracy in time Second order accuracy in time

Stable only if Unconditionally stable and bounded Unconditionally stable, but bounded2x

ta

∆∆ <only if

Page 41: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM Boundary conditionsCFD7

Boundary conditions are specified at faces of cells (not at grid points)

�INLET specified u,v,w,T,k,ε (but not pressure!)

�OUTLET nothing is specified (p is calculated from continuity eq.)

�PRESSURE only pressure is specified (not velocities)

�WALL zero velocities, kP, εP calculated from the law of wall

PyP

Recommended combinations for several outlets

INLET

PRESSURE

PRESSURE

INLET

OUTLET

OUTLET

PRESSURE

PRESSURE

PRESSURE

Forbidden combinations for several outlets

PRESSURE

PRESSURE

OUTLET

there is no unique solutionbecause no flowrate is specified

Page 42: Solvers, schemes SIMPLEx, upwind,… - cvut.czusers.fs.cvut.cz/~zitnyrud/CFD7.pdf · CFD7 FVM convection diffusion 1D Methods differ in the way how the unknown transported values

FVM Boundary conditionsCFD7

�SYMMETRY

�PERIODICAL

Copied from Kozubkova: Fluent-textbook