Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both...

19
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 The Finite Volume Mesh Chapter 06

Transcript of Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both...

Page 1: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

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

The Finite Volume MeshChapter 06

Page 2: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

The Process

2

Set of Governing Equations Defined on a Computational

Domain

System of Algebraic Equations

Numerical Solutions

Finite DifferenceFinite VolumeFinite Element

Boundary Element

Combinations ofMultigrid MethodsIterative Solvers

Coupled-Uncoupled

Structured GridsCartesian, Non-Orthogonal)

Block Structured gridsUnstructured Grids

Chimera Grids

Physical Phenomena

Physical Domain

Physical ModelingDomain Modeling

Equation DiscretizationDomain Discretization

Solution Method

Page 3: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

3

Patch#3

Patch#2 Patch#1

∂ ρφ( )∂t

transientterm

+∇⋅ ρvφ( )

convectionterm

= ∇⋅ Γ∇φ( )

diffusionterm

+ Qsourceterm

• •

• ...

• •

..

• • •

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

•••...•••...•••

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

=

•••...•••...•••

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

Domain Modeling Physical Modeling

Domain Discretization Equations Discretization

Solution Method

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

Tmicroprocessormicroprocessor

heat spreader baseheat sink Tsink insulated

heat sink

heat spreader base

microprocessor

−∇⋅ k∇T( ) = !q

Page 4: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

4

microprocessor

heat sink heat spreader base

Domain Modeling

Patch#3

Patch#2 Patch#1

Domain Discretization

∂ ρφ( )∂t

transientterm

+∇⋅ ρvφ( )

convectionterm

= ∇⋅ Γ∇φ( )

diffusionterm

+ Qsourceterm

aCφC + aNBφNBNB C( )∑ = bP

Equations Discretization

• •

• ...

• •

..

• • •

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

•••...•••...•••

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

=

•••...•••...•••

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

Solution Method

−∇⋅ k∇T( ) =Q

Tmicroprocessor

Tsink Insulated

Physical Modeling

Qsimk

Qsource

Page 5: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Domain Discretization

5

Insulated

Tmicroprocessor

Tsink node element

face

node element

face

Figure 6.1 (a) Domain of interest, (b) domain discretized using a uniform grid system, and (c) domain discretized using an unstructured grid system with triangular elements.

(a) (b) (c)

Page 6: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Gradient Computation

6

∇φCVC = ∇φ dVVC∫

∇φCVC = φ dS∂VC!∫

∇φCVC = φ dS∫∂VC∑

∇φC = 1VC

φ f S ff =nb C( )∑

∇φC

Given a field defined over a mesh, we want to compute the field gradient

φCgiven compute

f

Sf1

Page 7: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

F1

F2

F3F4

F5

C

Sf

Gradient Computation

7

∇φi, j =1V i, j

φ fS ff =nb i, j( )∑ φ f = f φC ,φF( )

Sf1f

φ f = gFφF + gCφC

Page 8: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Structured Grid

8

1 i −1 i +1i Ni

1

Nj

j −1

j

j +1

Figure 6.3 local indices and topology.

Page 9: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Indices

9

aC 1( ) ! !

! aC 2( ) ! !

! aC 3( ) ! !

! • !! ! • !

! ! • !! ! aC n−1( ) !

aF n−Ni( ) aF n−1( ) aC n( ) aF n+1( ) aF n+Ni( )

! ! aC n+1( ) ! !

! ! • ! !! ! • ! !

! ! • !! ! • !

! ! • !! ! aC NiNj( )

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

φ1φ2

φn−Ni

φn−1φnφn+1

φn+Ni

φNiNj

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

=

b 1( )

b 2( )

b n−Ni( )

b n−1( )

b n( )

b n+1( )

b n+Ni( )

b NiNj( )

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

global index

local indices

1 i −1 i +1i Ni

1

Nj

j −1jj +1

n = i + j −1( )Ni

Figure 6.4 Local versus global indices.

Page 10: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Structured Mesh

10

Si−1/2, j Element i, j( )S1 i, j( )

S2 i, j( )

Si, j−1/2

Figure 6.5 Geometric Information.

φi−1, j φi+1, j

φi, j+1

φi, j−1

φi−1, j+1

φi+1, j−1φi−1, j−1

φi+1, j+1

φij

φn-1-Ni φn-Ni

φn

φn+1-Ni

φn-1+Ni φn+Ni φn+1+Ni

φn-1 φn+1

φSW φS

φC

φSE

φ NW φN φNE

φW φE

(a) local indexing

b) global indexing

(c) discretization indexing Figure 6.6 Local versus discretization versus global

indices.

Page 11: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Unstructured Mesh indexing

11

9

26

21 20 19

2227

23

1817

1511

2425

7

814

10

16

1312

43215

6

28

Sf1Sf2

Sf3

Sf4Sf5

Sf6

F4

F5

F3

F2F1

F6C

11

8

10

21

6 916

2223

15

1110

ElementConnectivity

Neighbours

Faces

Nodes

[10 11 8 6 1 2]1 2 3 5 6

[16 22 23 15 11 10]1 2 3 4 5 6

local indexglobal index

local indexglobal index

[21 22 21 14 13 12]1 2 3 4 5 6 local index

global index

Figure 6.8 Element connectivity and face orientation using (a) local indices and (b) global indices.

(a) (b)

Page 12: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Owners and Neighbours

12

owner

neighbour

face

S f

owner

neighbour

face

S f

(a) (b)

Fig. 6.9 Owners, neighbors, and faces for (a) 2D and (b) 3D elements.

Page 13: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Connectivities

13

96

FaceConnectivity

Elements [9 11]1 2 local index

global index

9

8

9

11

9 10

9

2

9

1

FaceConnectivity

Elements [8 9]1 2 local index

global index

FaceConnectivity

Elements [1 9]1 2 local index

global index

FaceConnectivity

Elements [9 10]1 2 local index

global index

FaceConnectivity

Elements [2 9]1 2 local index

global index

FaceConnectivity

Elements [6 9]1 2 local index

global index

118

10

21

6 916

2223

15

1110

22

15

23

11

16

10

Figure 6.10 An example of face, element, and node connectivities for unstructured grids.

Page 14: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Unstructured Mesh

14

9

26

21 20 19

2227

23

1817

1511

2425

7

814

10

16

1312

43215

6

28

Figure 6.11 An unstructured mesh system.

Page 15: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Non-Orthogonality

15

Sf1f

C

Figure 6.12 Angle between surface vector and vector joining the centroids of the owner and neighbor elements.

Page 16: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Elements

16

Hexahedron PrismTetrahedron Polyhedron

Figure 6.13 Three-dimensional element types.

TriangleQuadrilateral Pentagon

Figure 6.14 Three-dimensional face types or two-dimensional element types.

Page 17: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Element INformation

17

centroid

sub-triangle centroid

polygon center

Figure 6.15 The geometric centre and centroid of a polygon.

xG = 1k

xii=1

k

Sf = Stt~Sub−triangles C( )

xCE( ) f =xCE( )t *St

t~Sub−triangles C( )∑

Sf

S = 12r2 − r1( )× r3 − r1( ) = 1

2

i j kx2 − x1 y2 − y1 z2 − z1x3 − x1 y3 − y1 z3 − z1

= Sxi + Sy j+ Szk

Page 18: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

18

f

G

dGf

S f

d Cf

G

S f

Figure 6.17 A sub-element pyramid.

xG = 1k

xii=1

k

∑xCE( )pyramid = 0.75 xCE( ) f + 0.25 xG( )pyramidVpyramid =

dGf ⋅S f

3VC = Vpyramid

~Sub−pyramids(C )∑

xCE( )C = xC =xCE( )pyramid Vpyramid

~Sub−pyramids C( )∑

VC

Page 19: Chapter 06 The Finite Volume Mesh - American University of ...€¦ · This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications

Face Weights

19

φ f = gfφF + 1− gf( )φC f

φC

φFφ f

C F

Figure 6.18 One dimensional mesh system.

gf =dCf

dCf + d fF

f

C

Fgf =VC

VC +VF

Figure 6.19 Axisymmetric grid system.

f

′f

C

Ff

′f

′′f

S fe fdCf

d fF

C

F

Figure 6.20 Two dimensional control volume

gf =dCf ⋅e f

dCf ⋅e f + d fF ⋅e f e f =S f

S f