15
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 Transient, Source Terms and Relaxation Chapter 13

Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

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

Transient, Source Terms and Relaxation

Chapter 13

Page 2: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Transient Term Discretization

Page 3: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Transient coordinate

C

C

C

trans

ient o

pera

tor

∂ ρφ( )∂t

t

L φ t( )spatial operator

t

t+∆t

t-∆t

Page 4: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Transient Problems

integrate over spatial control volume

integrate over temporal control volume

transient term spatial terms

time

t

t-1

t-2

t+1

L(φ(t))

φ(t+1/2)

φ(t-1/2)

∂ ρφ( )∂t

= L φ( )

∂ ρφ( )∂t

dVΩ∫ = L φ( )dV

Ω∫ ⇒

∂ ρφ( )∂t

V = L φ( )V

∂ ρφ( )∂t

V⎛⎝⎜

⎞⎠⎟ dt

t− 12 ∆ t

t+ 12 ∆ t

∫ = L φ( )V( )dtt− 12 ∆ t

t+ 12 ∆ t

ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t⎡⎣ ⎤⎦V = L φ( )V⎡⎣ ⎤⎦∆ t ⇒ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t

∆ tV = L φ( )V

Page 5: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t∆ t

V = L φ( )V

Order of Discretization

time

t

t-1

t-2

t+1

L(φ(t))

φ(t+1/2)

φ(t-1/2)L φ( )V t− 12 ∆ t→t+ 12 ∆ t = L φ( )V

ρφ( )t+ 12 ∆ t = f ρφ t+1,ρφ t ,ρφ t−1,ρφ t−2 ,...( )

Page 6: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Implicit vs Explicit

C

C

backward Euler

C

C

Forward Euler

Page 7: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

φ t+Δt

φ t

φ t−Δt /2

φ t+Δt /2

L φ t( )

φ t−Δt

∂ ρφ( )∂t

= L φ( )V⎡⎣ ⎤⎦t +∆ t2

∂2 ρφ( )∂t 2

+ ...

neglected terms! "## $##

⇒ρφ( )t − ρφ( )t−∆ t

∆ tV = L φ( )V⎡⎣ ⎤⎦

t

Backward Euler

Implicit Scheme

Solve system of equations

Iterate

first order accuracy Numerical diffusion

ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t∆ t

V = L φ( )V

ρφ( )t+ 12 ∆ t ← ρφ( )t

ρφ( )t− 12 ∆ t ← ρφ( )t−∆ t

ρφ( )t−∆ t = ρφ( )t − ∂ ρφ( )∂t

∆ t +∂2 ρφ( )∂t 2

∆ t 2

2−∂3 ρφ( )∂t 4

∆ t 3

6+ ....

Accuracy

⇒ρφ( )t − ρφ( )t−∆ t

∆ t=∂ ρφ( )∂t

−∂2 ρφ( )∂t 2

∆ t2

+∂3 ρφ( )∂t 4

∆ t 2

6+ ....

Stable for all ∆t

Page 8: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

⇒ρφ( )t+∆ t − ρφ( )t

∆ tV = L φ( )V⎡⎣ ⎤⎦

t

Explicit Scheme

Point EvaluationNo Iterations

ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t∆ t

V = L φ( )V

ρφ( )t+ 12 ∆ t ← ρφ( )t+∆ t

ρφ( )t− 12 ∆ t ← ρφ( )t

Forward Euler

Unstable for Courant>1

ρφ( )t+∆ t = ρφ( )t + ∂ ρφ( )∂t

∆ t +∂2 ρφ( )∂t 2

∆ t 2

2+∂3 ρφ( )∂t 4

∆ t 3

6+ ....

Accuracy

⇒ρφ( )t+∆ t − ρφ( )t

∆ t=∂ ρφ( )∂t

+∂2 ρφ( )∂t 2

∆ t2

+∂3 ρφ( )∂t 4

∆ t 2

6+ ....

∂ ρφ( )∂t

= L φ( )V⎡⎣ ⎤⎦t −∆ t2

∂2 ρφ( )∂t 2

+ ...

neglected terms! "## $##

first order accuracy

Numerical anti-diffusion

ρφ( )t+∆ t = ρφ( )t + L φ( )∆ t

φ t+Δt

φ t

φ t+Δt /2

L φ t( )φ t−Δt /2

φ t−Δt

Page 9: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

φ t

φ t+Δt /2

φ t−Δt /2

L φ t( )

φ t−Δt

φ t−2Δt

⇒3 ρφ( )t − 4 ρφ( )t−∆ t + 2 ρφ( )t−2∆ t

2∆ tV = L φ( )V⎡⎣ ⎤⎦

t

Adam-Bashforth

2 old time-steps needed

Second Order Accuracy

Implicit Scheme

ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t∆ t

V = L φ( )V

ρφ( )t+ 12 ∆ t ← 32

ρφ( )t − 12

ρφ( )t−∆ t

ρφ( )t− 12 ∆ t ← 32

ρφ( )t−∆ t − 12

ρφ( )t−2∆ t

Page 10: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Crank-Nicholson

L(φ(t))

φ(t+1/2)

φ(t-1/2)

Crank-Nicholson

⇒ρφ( )t+∆ t + 2 ρφ( )t−∆ t

2∆ tV = L φ( )V⎡⎣ ⎤⎦

t

ρφ( )t+ 12 ∆ t − ρφ( )t− 12 ∆ t∆ t

V = L φ( )V

ρφ( )t+ 12 ∆ t ← 12

ρφ( )t+∆ t + 12

ρφ( )t

ρφ( )t− 12 ∆ t ← 12

ρφ( )t + 12

ρφ( )t−∆ t

2 old time-steps needed

Second Order Accuracy

Explicit Scheme

Unstable for Courant>2

Page 11: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Crank-Nicholson

C

C

C

Page 12: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

φ t+Δt

φ t

φ t+Δt /2

φ t−Δt /2

φ t−Δt

L φ t( )

⇒ρφ( )t − ρφ( )t−∆ t

∆ tV = L φ( )V⎡⎣ ⎤⎦

t

⇒ρφ( )t+∆ t − ρφ( )t

∆ tV = L φ( )V⎡⎣ ⎤⎦

t

Backward Euler

Forward Euler

Crank-Nicholson-Implementation

L(φ(t+1/2))

φ(t+1)

φ(t)

L(φ (t-1/2))

φ(t-1)

Crank-Nicholsonρφ( )t+∆ t − ρφ( )t−∆ t

∆ tV = 2 L φ( )V⎡⎣ ⎤⎦

t

ρφ( )t − ρφ( )t−∆ t∆ t

V = L φ( )V⎡⎣ ⎤⎦t1

2

ρφ( )t+∆ t − ρφ( )t∆ t

V = L φ( )V⎡⎣ ⎤⎦t =

ρφ( )t − ρφ( )t−∆ t∆ t

V

ρφ( )t+∆ t = 2 ρφ( )t − ρφ( )t−∆ t

Note that

Thus step 2 can be written as

Page 13: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Stability of the Explicit Scheme

2D : ρΔxΔyΔt

≥ ΓeΔyδxe

+ ΓwΔyδxw

+ ΓnΔxδyn

+ ΓsΔxδys

⎝ ⎜

⎠ ⎟ ⇒Δt ≤

ρ Δx( )24Γ�

1D : ρΔxΔt

≥ ΓeΔyδxe

+ ΓwΔyδxw

⎝ ⎜

⎠ ⎟ ⇒Δt ≤

ρ Δx( )22Γ

Von Neumann Stability Criterion

∂ ρφ( )∂t

= ∇ ⋅Γ∇φ +Q

aPt φP

t = aNt−∆ tφN

t−∆ t

NB∑ + aP

t−∆ t − aNt−∆ t

NB∑( )φPt−∆ t + bP

⇒ρφ( )t − ρφ( )t−∆ t

∆ tV = Γ∇φ( ) f ⋅Sf

nb∑ +QV

aPt =

ρt

∆ tV aP

t−∆ t =ρt−∆ t

∆ tV

bP = QV

aEt−∆ t =

Γet−∆ t ∆ yδx

aWt−∆ t =

Γwt−∆ t ∆ yδx

aNt−∆ t =

Γnt−∆ t ∆ xδy

aSt−∆ t =

Γ st−∆ t ∆ xδy

if aPt−∆ t − aNB

t−∆ t

NB∑( ) < 0⇒Unphysical feedback

Page 14: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Initial Condition

Δt

tinitial

Δt / 2

Δt

tinitial

Δt

Δt / 2

Page 15: Transient, Source Terms and Relaxation · Transient, Source Terms and Relaxation Chapter 13. Transient Term Discretization. Transient coordinate C C C or ∂(ρφ) ∂t t L(φt) spatial

Conclusion