chapter 08 the diffusion term · 2018. 6. 26. · th e fi n i tev o l u m e m e t h o d i n co m p...

24
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 Diffusion Term Chapter 08

Upload: others

Post on 20-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

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 Diffusion Term

Chapter 08

Page 2: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Diffusion Equation

2

−∇ ⋅ Γ∇φ( ) = Q

−Γφ∇φ( ) f ⋅S ff ∼nb C( )∑ =QC

φVC

−Γφ∇φ( )e ⋅Se + −Γφ∇φ( )w ⋅Sw+ −Γφ∇φ( )n ⋅Sn + −Γφ∇φ( )s ⋅Ss =QC

φVC

Se = + Δy( )e i= Se i = SeiSw = − Δy( )w i = − Sw i = −Swi

Sn = + Δx( )n j= Sn j= Sn jSs = − Δx( )s j = − Ss j= −Ss j

Sw Se

Sn

Ss

EW

N

S

C

NW NE

SW SE

Δy( )C

δ x( )w δ x( )e

δ y( )n

δ y( )s

Δx( )C

Jeφ ,D = − Γφ∇φ( )e ⋅Se

= −ΓeφSe

∂φ∂xi + ∂φ

∂yj⎛

⎝⎜⎞⎠⎟ e⋅ i

= −Γeφ Δy( )e

∂φ∂x

⎛⎝⎜

⎞⎠⎟ e

Jeφ ,D = FluxTe = FluxCeφC + FluxFeφF + FluxVe

Page 3: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

FluxTw = − Γφ∇φ( )w ⋅Sw= −Γw

φ Sw∂φ∂xi + ∂φ

∂yj⎛

⎝⎜⎞⎠⎟ w

⋅ −i( )

= Γwφ Sw

∂φ∂x

⎛⎝⎜

⎞⎠⎟ w

= Γwφ Sw

φC −φW( )δ x( )w

= FluxCwφC + FluxFwφW + FluxVw

2D Cartesian

3

∂φ∂x

⎛⎝⎜

⎞⎠⎟ e

= φE −φCδ x( )e

See

∂φ∂x

⎛⎝⎜

⎞⎠⎟ = slope

C E

φC φE

δ xe

Figure 8.2 Interpolation profile at face e and slope of

gradient.

FluxTe = −Γeφ Δy( )e

φE −φC( )δxe

=Γeφ Δy( )eδxe

φC −φE( )

= FluxCeφC +FluxFeφE +FluxVe

gDiffe =Δy( )eδ xe

=SedCE

= SedCE

FluxCe =ΓeφgDiffe

FluxFe = −ΓeφgDiffe

FluxVe = 0

FluxCw =Γwφ gDiffw

FluxFw = −Γwφ gDiffw

FluxVw = 0

Page 4: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Algebraic form

4

aPφP + aEφE + aWφW + aNφN + aSφS = bP

aE = FluxFe = −ΓeφgDiffe

aW = FluxFw = −Γwφ gDiffw

aN = FluxFn = −ΓnφgDiffn

aS = FluxFs = −Γ sφgDiffs

aC = FluxCe + FluxCw + FluxCn + FluxCs

= − aE + aW + aN + aS( )bC =QC

φVC − FluxVe + FluxVw + FluxVn + FluxVs( )

aCφC + aFφFF~NB C( )∑ = bC

aF = FluxFf = −Γ fφgDiff f

aC = FluxC ff ∼nb C( )∑

bC =QCφVC − FluxVf

f ∼nb C( )∑

Page 5: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Properties of the Discretized Equation

5

With a zero source term

aCφC + aFφFF~NB C( )∑ = 0

aC φC + constant( )+ aF φF + constant( )F~NB C( )∑ = 0

⎬⎪

⎭⎪⇒ aC + aF

F~NB C( )∑ = 0

−∇⋅ Γφ∇φ( ) = 0φ + constantφ is a solution then should also be a solutions to the equation if

aFaCF~NB C( )

∑ = −1

The Zero Sum Rule

The Opposite Signs Rule

Page 6: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

b Sb

Sn

Sw

Ss

φb = φspecified

SW S

C

N

W

NW

δ x( )b

BC: Dirichlet

6

Figure 8.3 Value specified boundary condition.

φb = φspecified

FluxTb = −Γbφ ∇φ( )b ⋅Sb

= −Γbφ SbdCb

φb −φC( )

= FluxCbφC +FluxVb

FluxCb = ΓbφgDiffb = ab

FluxVb = −ΓbφgDiffbφb = −abφb

gDiffb =SbdCB

aCφC + aWφW + aNφN + aSφS = bCaE =0aW = FluxFw = −Γw

φ gDiffwaN = FluxFn = −Γn

φgDiffnaS = FluxFs = −Γ s

φgDiffsaC = FluxCb + FluxC f =

f ∼nb C( )∑ FluxCb + FluxCw + FluxCn + FluxCs( )

bC =QCφVC − FluxVb + FluxVf

f ∼nb C( )∑

⎝⎜⎞

⎠⎟

Page 7: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

BC: Von Newmann

7

b Sb

Sn

Sw

Ss

SW S

C

N

W

NW

δ x( )b

−∇φb ⋅nb = qspecified

Figure 8.4 flux specified boundary condition.

Jbφ ,D ⋅Sb = − Γφ∇φ( )b ⋅ Sb i = qb Sb

= FluxCbφC +FluxVb

FluxCb = 0FluxVb = qbSb

= qb ∆ y( )C

− Γφ∇φ( )b ⋅ i = qb

aCφC + aWφW + aNφN + aSφS = bC

aE = 0aW = FluxFw = −Γw

φ gDiffwaN = FluxFn = −Γn

φgDiffnaS = FluxFs = −Γ s

φgDiffsaC = FluxC f

f ∼nb C( )∑ = − aW + aN + aS( )

bC =QCφVC − FluxVb + FluxVf

f ∼nb C( )∑

⎝⎜⎞

⎠⎟

Page 8: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

b Sb

Sn

Sw

Ss

SW S

C

N

W

NW

δ x( )b

φb φ∞h∞

BC: Mixed

8

Figure 8.5 Mixed type boundary condition.

Jbφ ,D ⋅Sb = − Γφ∇φ( )b ⋅ iSb = −h∞ φ∞ −φb( ) Δy( )C

−ΓbφSb

φb −φCδ xb

⎛⎝⎜

⎞⎠⎟= −h∞ φ∞ −φb( )Sb

φb =h∞φ∞ + Γb

φ /δ xb( )φCh∞ + Γb

φ /δ xb( )

Jbφ ,D ⋅Sb = −

h∞ Γbφ δ xb( )

h∞ + Γbφ δ xb( ) Sb

⎣⎢⎢

⎦⎥⎥

Req! "### $###

φ∞ −φC( )

= FluxCbφC + FluxVb

FluxCb = ReqFluxVb = −Reqφ∞

aE = 0aW = FluxFw = −Γw

φ gDiffwaN = FluxFn = −Γn

φgDiffnaS = FluxFs = −Γ s

φgDiffsaC = FluxCb + FluxC f =

f ∼nb C( )∑ FluxCb + FluxCw + FluxCn + FluxCs( )

bC =QCφVC − FluxVb + FluxVf

f =nb C( )∑

⎝⎜⎞

⎠⎟

aCφC + aWφW + aNφN + aSφS = bC

Page 9: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Orthogonal Non-Cartesian Grids

9

∇ ⋅ JD = Q

− Γ∇φ( ) f ⋅S f~ f = nb(P )∑ = QPVP

JeD ⋅Se = −Γe ∇φ.n( )e Se = −Γe

∂φ∂n

⎛ ⎝ ⎜

⎞ ⎠ ⎟ e

Se

∂φ∂n

⎛ ⎝ ⎜

⎞ ⎠ ⎟ e

= φE −φPδx'PE

∇φ.n( )e = ∂φ∂n

⎛ ⎝ ⎜

⎞ ⎠ ⎟ e

C

E

W

Se

nt

Se = ∆ y( )CSw

Sw

= ∆ y( )CSw = −Se

Se = Se n

dCE = δx( )e ndCE = δx( )e

E

W

C

Δy( )C δ x( )w

δ x( )e

Δx( )C

xy

SeSn

SwSs

E

W

N

S

C

NW

NE

SW

SE

′x

′y

xy

Page 10: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

∇φ( ) f ⋅S f = ∇φ( ) f ⋅E f

E f e!

orthogonal−likecontribution

! "# $#+ ∇φ( ) f ⋅T

non−orthogonal likecontribution

! "# $#

= Ef∂φ∂e

⎛⎝⎜

⎞⎠⎟ f

+ ∇φ( ) f ⋅Tf

= EfφF −φCdCF

+ ∇φ( ) f ⋅Tf

∇φ ⋅e( ) f =∂φ∂e

⎛⎝⎜

⎞⎠⎟ f

= φF −φCrF − rC

= φF −φCdCF

Non-Orthogonal Grids

10

S f

n

e dCF

t

θ

C

F

f

S f

E f

Tf

ne

C

F

f

∇φ ⋅n( ) f =∂φ∂n

⎛⎝⎜

⎞⎠⎟ f

≠ φF −φCrF − rC

= φF −φCdCF

S fFigure 8.9 Decomposing via the minimum correction approach.

Page 11: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

E Computation

11

S f

E f

Tf

ne

C

F

f

S f

E f

Tf

ne

C

F

f

S f

E f

Tf

ne

C

F

f

∇φ( ) f ⋅Tf = ∇φ( ) f ⋅ S f −E f( )

=

∇φ( ) f ⋅ n− cosθe( )Sf minimum correction

∇φ( ) f ⋅ n− e( )Sf normal correction

∇φ( ) f ⋅ n−1

cosθe⎛

⎝⎜⎞⎠⎟ Sf over − relaxed

⎪⎪⎪⎪

⎪⎪⎪⎪

E f =Sfcosθ

⎛⎝⎜

⎞⎠⎟e =

Sf2

Sf cosθ⎛

⎝⎜⎞

⎠⎟e =S f ⋅S f

e ⋅S f

e E f = Sf e E f = e ⋅S f( )e = Sf cosθ( )e

Page 12: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

J fφ ,D ⋅S f( )

f ~nb C( )∑ = − Γφ∇φ( ) f ⋅ E f +Tf( )( )

f ~nb C( )∑

= − Γφ∇φ( ) f ⋅E f( )f ~nb C( )∑

OrthogonalLinearizeablePart

! "### $###+ − Γφ∇φ( ) f ⋅Tf( )

f ~nb C( )∑

Non−OrthogonalNon−LinearizeablePart

! "### $###

= −Γ fφEf

φF −φC( )dCF

⎛⎝⎜

⎞⎠⎟f ~nb C( )

∑ + − Γφ∇φ( ) f ⋅Tf( )f ~nb C( )∑

= Γ fφgDiff f φC −φF( )

f ~nb C( )∑ + − Γφ∇φ( ) f ⋅Tf( )

f ~nb C( )∑

= FluxC ff ~nb C( )∑

⎝⎜⎞

⎠⎟φC + FluxFfφF( )

f ~nb C( )∑ + FluxVf( )

f ~nb C( )∑

Treatment of Non-Orthogonal Term

12

gDiff f =Ef

dCF

Page 13: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Discretized Equation

13

aCφC + aFφFF∼NB C( )∑ = bC

aF = FluxFf = −Γ fφgDiff f

aC = FluxC ff ∼nb C( )∑ = − FluxFf

f ∼nb C( )∑ = Γ f

φgDiff ff ∼nb C( )∑

bC =QCφVC − FluxVf( )

f ~nb C( )∑ = SC

φVC + Γφ∇φ( ) f ⋅Tf( )f ~nb C( )∑

Page 14: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Boundary Conditions

Page 15: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

S f

nedCb

b

C

BC: Temperature Specified

15

Jbφ ,D ⋅Sb = −Γb

φ ∇φ( )b ⋅Sb = −Γbφ ∇φ( )b ⋅ Eb +Tb( )

= −Γbφ φb −φC

dPb

%

&'

(

)*Eb −Γb

φ ∇φ( )b ⋅Tb

= FluxCbφC +FluxVb

FluxCb =ΓbφgDiffb

FluxVb = −ΓbφgDiffbφb −Γb

φ ∇φ( )b ⋅Tb

gDiffb =Eb

dPb

aF = FluxFf aC = FluxC ff ~nb(C )∑ + FluxCb

bC =QCφVC − FluxVb − FluxVf

f ~nb(C )∑

Wall

Page 16: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

S f

nedCb

b

C

BC: Flux Specified

16

−Γ∇φ( )b ⋅nbSpecified Flux! " # # $ # #

= qb,specified Wall

FluxCb = 0FluxVf = qb,specified

Jbφ ,D ⋅S = FluxCbφC + FluxVb

Page 17: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Under-Relaxation

Page 18: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Under-Relaxation

18

aP ←aPλ

bP ← bP +1− λ( )aP

λφP*

aPφP + aNBφNBNB(P )∑ = bP

φP =− aNBφNBNB(P )∑ + bP

aP

φP = φP* +

− aNBφNBNB(P )∑ + bP

aP−φP

*

⎜ ⎜ ⎜

⎟ ⎟ ⎟

φP = φP* + λ

− aNBφNBNB(P )∑ + bP

aP−φP

*

⎜ ⎜ ⎜

⎟ ⎟ ⎟

aPλφP + aNBφNB

NB(P )∑ = bP +

1− λ( )aPλ

φP*

Page 19: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

Exercises

Page 20: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

20

2 3 4 51

δ x / 2 δ x

φ0 = 100

J6D = − Γ dφ

dx⎛⎝⎜

⎞⎠⎟ 6

= 10

∆ x

Page 21: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

21

FinTa

h T −Ta( )

1 2 3 4 5

− ddx

k dTdx

⎛⎝⎜

⎞⎠⎟

x

A

P

L

Page 22: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

22

1

2

3

4

5

6

3 m1 m T = 50˚C

T = 100˚C

T = 200˚C

T = 225˚C

T = 250˚C−∇T ⋅n = 0

−∇T ⋅n = 0

Page 23: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

23

1 2

43

3

4

T = 20˚C

T=30˚C

−∇T ⋅n = 0

−∇T ⋅n = 0

L

L

Page 24: Chapter 08 The Diffusion Term · 2018. 6. 26. · Th e Fi n i teV o l u m e M e t h o d i n Co m p u t at i o n a l Fl u i d D y n a m i c s A n Ad va n ce d I nt ro d u c t i o n

24

2

1

3

4∇φb ⋅n = 0

φa = 40

h = 10

φb = 50