discretization of the convection term...introductory course on the fvm, in an advanced course on cfd...

26
FMIA ISBN 978-3-319-16873-9 Fluid Mechanics and Its Applications Fluid Mechanics and Its Applications Series Editor: A. Thess F. Moukalled L. Mangani M. Darwish The Finite Volume Method in Computational Fluid Dynamics An Advanced Introduction with OpenFOAM® and Matlab® The Finite Volume Method in Computational Fluid Dynamics Moukalled · Mangani · Darwish 113 F. Moukalled · L. Mangani · M. Darwish The Finite Volume Method in Computational Fluid Dynamics An Advanced Introduction with OpenFOAM® and Matlab® This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications in Computational Fluid Dynamics (CFD). Readers will discover a thorough explanation of the FVM numerics and algorithms used in the simulation of incompressible and compressible fluid flows, along with a detailed examination of the components needed for the development of a collocated unstructured pressure-based CFD solver. Two particular CFD codes are explored. The first is uFVM, a three-dimensional unstructured pressure-based finite volume academic CFD code, implemented within Matlab®. The second is OpenFOAM®, an open source framework used in the development of a range of CFD programs for the simulation of industrial scale flow problems. With over 220 figures, numerous examples and more than one hundred exercises on FVM numerics, programming, and applications, this textbook is suitable for use in an introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. Engineering 9 783319 168739 Discretization of the Convection Term Chapter 12

Upload: others

Post on 10-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

FMIA

ISBN 978-3-319-16873-9

Fluid Mechanics and Its ApplicationsFluid Mechanics and Its ApplicationsSeries Editor: A. Thess

F. MoukalledL. ManganiM. Darwish

The Finite Volume Method in Computational Fluid DynamicsAn Advanced Introduction with OpenFOAM® and Matlab®

The Finite Volume Method in Computational Fluid Dynamics

Moukalled · Mangani · Darwish

113

F. Moukalled · L. Mangani · M. Darwish The Finite Volume Method in Computational Fluid Dynamics An Advanced Introduction with OpenFOAM® and Matlab ®

This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications in Computational Fluid Dynamics (CFD). Readers will discover a thorough explanation of the FVM numerics and algorithms used in the simulation of incompressible and compressible fluid flows, along with a detailed examination of the components needed for the development of a collocated unstructured pressure-based CFD solver. Two particular CFD codes are explored. The first is uFVM, a three-dimensional unstructured pressure-based finite volume academic CFD code, implemented within Matlab®. The second is OpenFOAM®, an open source framework used in the development of a range of CFD programs for the simulation of industrial scale flow problems.

With over 220 figures, numerous examples and more than one hundred exercises on FVM numerics, programming, and applications, this textbook is suitable for use in an introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers.

Engineering

9 783319 168739

Discretization of the Convection Term

Chapter 12

Page 2: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Convection Term∂ ρφ( )∂t

+∇⋅ ρvφ( ) = ∇⋅ Γ∇φ( ) +Q∂ ρv( )∂t

+∇⋅ ρvv( ) = ∇⋅τ +B

∂ ρα( )∂t

+∇⋅ ρvα( ) = 0

ΩCρ

Δt′ P P( ) + CρU f

* ′ P ( )f

f∑ − ρ f

* D f ∇ ′ P ( ) f ⋅S f( )f∑ = −

ΩΔt

ρP* − ρP

o( ) + ρ f*U f

*( )f∑

⎣ ⎢ ⎢

⎦ ⎥ ⎥ − ′ ρ f ′ v f ⋅S f( )

f∑ − ρ f

* H ′ v [ ] f ⋅S f( )f∑

Transient-like Term

Advection-like Termaccount for compressibility effects

Figure 7. (a) Pressure contours and (b) Mach number distributions along the upper and lower walls for supersonic flow over a bump (Minlet¼ 1.4). Convergencehistory plots of the various algorithms using the (c) single-grid, (d ) prolongation grid, and (e) multigrid methodologies for supersonic flow over a bump (Minlet¼ 1.4).

20

Figure 6. (a) Pressure contours and (b) Mach number distributions along the upper and lower walls for transonic flow over a bump (Minlet¼ 0.675). Convergencehistory plots of the various algorithms using the (c) single-grid, (d ) prolongation grid, and (e) multigrid methodologies for transonic flow over a bump (Minlet¼ 0.675).

18

∂ ρE( )∂t

+∇⋅ ρvE( ) = −∇⋅ vP( ) +∇⋅ v ⋅τ( ) +Q

∂ ραC( )∂t

+∇⋅ ρvαC( ) = 0Fluid 1

Fluid 2

Fluid 3

Fluid 4

The simplicity of the convection term does not extend to its discretization (3 decades of research

and continuing)

Pressure Correction Equation

Page 3: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

High Order Schemes

Page 4: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

NotationP E

e

WEE

WW

P E

e

WEE

WW

P E

e

W EEWW

vf

vf

C D

f

U DDUU

D C

f

DD U UU

Page 5: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Convection Schemes

ϕC

vf

C DU DDUU

f

ϕf

vf

C DU DDUU

f

ϕCϕf

ϕD

vf

C DU DDUU

f

ϕCϕf

ϕU

vf

C DU DDUU

f

ϕDϕf

ϕU

ϕC

vf

C DU DDUU

f

ϕfϕU

ϕD

UPWIND

CENTRAL

SOU

DOWNWIND

QUICK

Page 6: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

φ f = φC

φ f =φC + φD2

φ f =3

2φC −

1

2φU

φ f =3

4φC +

3

8φU −

1

8φD

φ f = φD

Convection Scheme Formula

UPWIND

CENTRAL

SOU(Second Order Upwind)

QUICK(Quadratic Upwind Interpolation

for Convective Kinematics)DOWNWIND

Convection Schemes

Page 7: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Convection Discretization

∇ ⋅ ρvφ( ) = 0

ρvφ( ) f ⋅Sff = nb(P )∑ = 0

Sw

P EW

N

S SE

NE

SW

NW

Se

Sn

Ss

(∆x)P

(δx)w (δx)e

(∆y)P

(δy)n

(δy)s

1m

v(2,1)

1m

Φ=1

Φ=1

Φ=1

ρeve ⋅Se( )φe + ρwvw ⋅Sw( )φw + ρnvn ⋅Sn( )φn + ρsvs ⋅Ss( )φs = 0

Page 8: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Sw Se

Sn

Ss

EW

N

S

C

NW NE

SW SE

Δy( )C

δ x( )w δ x( )e

δ y( )n

δ y( )s

Δx( )C

ew

n

s

x

y

Second -Order Upwind

ρeve ⋅Se( )φe = ρeve ⋅Se( ) 32φP −

12φW

⎛ ⎝ ⎜

⎞ ⎠ ⎟

φ f ,SOU = 32φC −

12φU

⎛ ⎝ ⎜

⎞ ⎠ ⎟

ρwvw ⋅Sw( )φw = ρwvw ⋅Sw( ) 32φW − 1

2φWW

⎛ ⎝ ⎜

⎞ ⎠ ⎟

ρeve ⋅Se( ) 32φP −

12φW

⎛ ⎝ ⎜

⎞ ⎠ ⎟ + ρwvw ⋅Sw( ) 3

2φW − 1

2φWW

⎛ ⎝ ⎜

⎞ ⎠ ⎟ +

ρnvn ⋅Sn( ) 32φP −

12φS

⎛ ⎝ ⎜

⎞ ⎠ ⎟ + ρsvs ⋅Ss( ) 3

2φS −

12φSS

⎛ ⎝ ⎜

⎞ ⎠ ⎟ = 0

aPφP + aNφNN=E ,W ,N ,S,WW ,SS,NN ,SS

∑ = 0

aE = aN = aEE = aNN = 0�

aW = 32

ρwvw ⋅Sw( ) − 12

ρeve ⋅Se( )

aS = 32

ρsvs ⋅Ss( ) − 12

ρnvn ⋅Sn( )

aWW = − 12

ρwvw ⋅Sw( )

aSS = − 12

ρsvs ⋅Ss( )

aP = − aNN=E ,W ,N ,S,EE ,WW ,NN ,SS

Page 9: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Sw Se

Sn

Ss

EW

N

S

C

NW NE

SW SE

Δy( )C

δ x( )w δ x( )e

δ y( )n

δ y( )s

Δx( )C

ew

n

s

x

y

Deferred Correction

ρ f vf ⋅Sf( ) φ f ,SOU + φ f ,UPWIND −φ f ,UPWIND( )f = nb(P )∑ = 0

ρ f vf ⋅Sf( )φ f ,UPWINDf = nb(P )∑ = − ρ f vf ⋅Sf( ) φ f ,SOU −φ f ,UPWIND( )

f = nb(P )∑

aPφP + aNφNN=NB(P )∑ = bP

dc

ρvφSOU( ) f ⋅S ff∑ = 0

Page 10: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Unstructured Grids

P

N1

N2

SfN2

fN2

N3fN3

P

dPN1

fN1

D

C

Vf U

D

C

Vf

U

φD −φU = ∇φC ⋅ 2rCD

Page 11: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Unstructured Grid

φ f = φC +∇φ f ⋅ rCf

φ f = φC + 2∇φC −∇φ f( ) ⋅ rCf

φ f = φC +1

2∇φ f +∇φC( ) ⋅ rCf

Convection Scheme Formula

UPWIND no change

CENTRAL

SOU(Second Order Upwind)

QUICK(Quadratic Upwind Interpolation

for Convective Kinematics)DOWNWIND no change

Page 12: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

SUDS

Numerical DispersionNumerical Diffusion Numerical Dispersion

NVF-SUDS

STOIC

φC

~

φf

~

0

11/2

3/4

1

UPWIND

DOWNWIND

SOU

SMART

FROMM

1/2

1/4CENTRAL

UPWIND

Page 13: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Computing the Gradient

∇φ dVV∫ = φ dS

∂V∫

∇φ V = ∇φ dVV∫

∇φP = 1VP

φ fS f∂VP

∇φP = 1VP

φ fS ff = nb(P )∑

PN1

N4

N3

N2

f1

Sf

f2

f3f4

Page 14: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Gradient at the Cell Face

P

F1

F4

F3

F2

P

F1

F4

F3

F2

∇φ f = ∇φ f − ∇φ f ⋅ edc( )edc + φD −φCdCD

edc

Page 15: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Gradient Formulation of HO schemes

φ f = φC + φD2

− φD − 2φC + φU8

= φC + φD −φC2

− φD −φC + φU −φC8

= φC + φD −φC2

− φD −φC + φU −φD + φD −φC8

= φC + φD −φC4

− φD −φU8

= φC + 12∇φ f + ∇φC( ) ⋅ rCf

φ f = 32φC −

12φU

= φC + φC −φU2

= φC + φD −φU2

− φD −φC2

= φC + 2∇φC −∇φ f( ) ⋅ rCf

φ f = φC + φD2

= φC + φD −φC2

= φC + ∇φ f ⋅ rCf

QUICK SOU CENTRAL

Page 16: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Gradient Form of Schemes

φ f = φC +∇φ f ⋅ rCf

φ f = φC + 2∇φC −∇φ f( ) ⋅ rCf

φ f = φC +1

2∇φ f +∇φC( ) ⋅ rCf

Convection Scheme Formula

UPWIND no change

CENTRAL

SOU(Second Order Upwind)

QUICK(Quadratic Upwind Interpolation

for Convective Kinematics)DOWNWIND no change

Page 17: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

High Resolution Schemes

Page 18: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

φC >1~

φU=0~

φD=1~φf

~

1-Normalization Procedure

φC φDφU

φf

φC φDφU

φf

φC φDφU

φf

φC φDφU

φf

φC=1~

φU=0~

φD=1~

φf~

φC φDφU

φf

φC φDφU

φf

φC =0~

φU=0~

φD=1~

φf~

!φ = φ −φU

φD −φU

vf

vf

C DU DDUU

D CDD U UU

φC φDφU

φf

φC φDφU

φf

φC <0~

φU=0~

φD=1~

φf~

Page 19: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Normalized HO Schemes

!φ f =

φ f −φUφD −φU

!φU = 0

!φD = 1

!φC = φC −φU

φD −φU

FROMMQUICK

φC~

φf~

011/2

3/4

1

SOU

1/2CD 3/8

1/4

DW

UPWIND

φ f = φC φ f = φC

φ f =φC + φD2

φ f =12φC +

12

φ f =3

2φC −

1

2φU

φ f =

32φC

φ f =34φC +

18φD −

38φD

φ f =

34φC +

18

φ f = φD φ f = 1

Scheme Formula Normalized

UPWIND

CENTRAL

SOU(Second Order Upwind)

QUICK(Quadratic Upwind

Interpolation for

DOWNWIND

Page 20: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

2-CBC Criteria

!φ f =

f !φC( ) continuous

f !φC( )=1 if !φC =1

!φC < f !φC( )<1 0< !φC <1

f !φC( )= 0 if !φC = 0

f !φC( )= !φC if !φC < 0 or !φC >1

⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪

⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪

φin+1 = H φi−k

n ,φi−k+1n ,…,φi+k

n( )

∂H∂φ j

n ≥ 0 ∀j ∈ i− k,i+ k[ ]

min φNB ,φC( )≤φ f ≤max φNB ,φC( )

PositivenessFlux Limiter (TVD)Boundedness Criteria

φf~

φu~

φC~n

vf0

1

φC~

φf~

0

11/2

3/4

1 DW

UPWIND

Page 21: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

φC~

φf~

011/2

3/4

1

UPWIND

DOWNWIND

SOU

SMART

FROMM

1/2

1/4CENTRA

L

!φ f

=12!φ C

+12

!φ f=3

2!φ C

!φ f=!φ C

!φ f = 1

!φ f=34!φ C+38

!φ f=!φ C+13

The Normalized Variable Diagram

φC~

φf~

011/2

3/4

1/2

1/4

MINMOD

φC~

φf~

011/2

3/4

1/2

1/4

OSHER

φC~

φf~

011/2

3/4

1/2

1/4

MUSCL

φC~

φf~

011/2

3/4

1/2

1/4

1 BOUNDED CD

φC~

φf~

011/2

3/4

1/2

1/4

SMART

φC~

φf~

011/2

3/4

1/2

1/4

STOIC

Page 22: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Bounded HR Schemes

φC~

φf~

011/2

3/4

1/2

1/4

OSHER

φC~

φf~

011/2

3/4

1/2

1/4

SMART

φC~

φf~

011/2

3/4

1/2

1/4

MUSCL

φC~

φf~

011/2

3/4

1/2

1/4

MINMOD

φC~

φf~

011/2

3/4

1/2

1/4

STOIC

φC~

φf~

011/2

3/4

1/2

1/4

1 BOUNDED CD

Page 23: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Implementation

P

N1

N2

SfN2

fN2

N3fN3

P

dPN1

fN1

φP ,φN1 ,φN2 ,φN31

φC ←φPφD ←φN1φU ←φD −∇φP ⋅2rPN1

2

!φC = φC −φU

φD −φU

3

φ f ← f !φC( ) φD −φU( ) +φU5

φC~

φf~

011/2

3/4

1/2

1/4

SMART

!φ f = f !φC( )

4

Page 24: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

Deferred Correction

!mfφ fSMART

f =nb P( )∑ = !mfφ f

UPWIND

implicit" #$ %$f =nb P( )

∑ + !mf φ fSMART −φ f

UPWIND( )deferred

" #$$$ %$$$f =nb P( )∑

aPφPUPWIND + aFφF

UPWIND

F=NB P( )∑ = bP − !mf φ f

SMART −φ fUPWIND( )

deferred" #$$$ %$$$f =nb P( )

aPφPUPWIND + aFφF

UPWIND

F=NB P( )∑ = bP + bP

dc−SMART

ρ fv fφ f( ) ⋅S f

f =nb P( )∑ = !mfφ f

f =nb P( )∑ = 0

ρ fv fφ fSMART ⋅S f = ρ fv f ⋅S f( )φ f

SMART

= !mfφ fSMART

= !mfφ fUPWIND

treat implicitly" #$ %$

+ !mf φ fSMART −φ f

UPWIND( )treat explicitly

" #$$$ %$$$

Page 25: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

SUDS

Numerical DispersionNumerical Diffusion Numerical Dispersion

NVF-SUDS

STOIC

X

φ

0.5 1

0

0.5

1

UPWIND

MINMOD

OSHER

TVD-MUSCL

SUPERBEE

BJ-MUSCL

EXACT

φC

~

φf

~

0

11/2

3/4

1

UPWIND

DOWNWIND

SOU

SMART

FROMM

1/2

1/4CENTRAL

UPWIND

Page 26: Discretization of the Convection Term...introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers. E n g i n e

HR Schemes

4.2. Advection of a sinusoidal profile

This problem is similar to the previous one in geo-metry except that a sinusoidal profile is used. The sinu-soidal profile involves steep and smooth regions, as wellas an extremum point, making its simulation much moredemanding than the simple step profile. The profile isgiven as

/ ¼ sin p2max 1" absðy"0:1707Þ

0:1707 ; 0! "! "

06 y6 0:3414

0 otherwise

(

ð28Þ

The problem is depicted in Fig. 5(a), the same meshes asthe step-profile problem were used. Results are shown inFig. 5(b) and (c) for the coarse and fine meshes respec-

tively. As expected all the schemes suffer from a sub-stantial decrease in the numerical extremum, with itsvalue decreasing down to 0.48 for the UPWIND scheme.The SUPERBEE preserves on the coarse mesh more ofthe extremum value (0.83), and experience no loss inextremum on the fine mesh. The BJ-MUSCL, TVD-MUSCL and OSHER schemes results are much betterthan those of the UPWIND scheme and the MINMODscheme, while still experiencing on the coarse and finemeshes a decrease in the extrema down to 0.68 and 0.92respectively.

4.3. Advection of a double-step profile

A double-step profile is imposed at inlet to the squaredomain depicted in Fig. 6(a). The profile is given as

Fig. 5. Convection of a sinusoidal profile: (a) physical domain, (b) / profile at y ¼ 0:8 using coarse grid, (c) / profile at y ¼ 0:8 usingdense grid.

606 M.S. Darwish, F. Moukalled / International Journal of Heat and Mass Transfer 46 (2003) 599–611

4.2. Advection of a sinusoidal profile

This problem is similar to the previous one in geo-metry except that a sinusoidal profile is used. The sinu-soidal profile involves steep and smooth regions, as wellas an extremum point, making its simulation much moredemanding than the simple step profile. The profile isgiven as

/ ¼ sin p2max 1" absðy"0:1707Þ

0:1707 ; 0! "! "

06 y6 0:3414

0 otherwise

(

ð28Þ

The problem is depicted in Fig. 5(a), the same meshes asthe step-profile problem were used. Results are shown inFig. 5(b) and (c) for the coarse and fine meshes respec-

tively. As expected all the schemes suffer from a sub-stantial decrease in the numerical extremum, with itsvalue decreasing down to 0.48 for the UPWIND scheme.The SUPERBEE preserves on the coarse mesh more ofthe extremum value (0.83), and experience no loss inextremum on the fine mesh. The BJ-MUSCL, TVD-MUSCL and OSHER schemes results are much betterthan those of the UPWIND scheme and the MINMODscheme, while still experiencing on the coarse and finemeshes a decrease in the extrema down to 0.68 and 0.92respectively.

4.3. Advection of a double-step profile

A double-step profile is imposed at inlet to the squaredomain depicted in Fig. 6(a). The profile is given as

Fig. 5. Convection of a sinusoidal profile: (a) physical domain, (b) / profile at y ¼ 0:8 using coarse grid, (c) / profile at y ¼ 0:8 usingdense grid.

606 M.S. Darwish, F. Moukalled / International Journal of Heat and Mass Transfer 46 (2003) 599–611