Finite Volume Method An Introduction Praveen. C CTFD Division - - PowerPoint PPT Presentation

finite volume method
SMART_READER_LITE
LIVE PREVIEW

Finite Volume Method An Introduction Praveen. C CTFD Division - - PowerPoint PPT Presentation

Finite Volume Method An Introduction Praveen. C CTFD Division National Aerospace Laboratories Bangalore 560 037 email: praveen@cfdlab.net April 7, 2006 Praveen. C (CTFD, NAL) FVM CMMACS 1 / 65 Outline Divergence theorem 1 Conservation


slide-1
SLIDE 1

Finite Volume Method

An Introduction

  • Praveen. C

CTFD Division National Aerospace Laboratories Bangalore 560 037 email: praveen@cfdlab.net

April 7, 2006

  • Praveen. C (CTFD, NAL)

FVM CMMACS 1 / 65

slide-2
SLIDE 2

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 2 / 65

slide-3
SLIDE 3

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 3 / 65

slide-4
SLIDE 4

Divergence theorem

In Cartesian coordinates, q = (u, v, w) ∇ · q = ∂u ∂x + ∂v ∂y + ∂w ∂z Divergence theorem

V dV n

  • V

∇ · q dV =

  • ∂V
  • q · ˆ

n dS

  • Praveen. C (CTFD, NAL)

FVM CMMACS 4 / 65

slide-5
SLIDE 5

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 5 / 65

slide-6
SLIDE 6

Conservation laws

Basic laws of physics are conservation laws: mass, momentum, energy, charge

Control volume Streamlines n

Rate of change of φ in V = -(net flux across ∂V) ∂ ∂t

  • V

φ dV = −

  • ∂V
  • F · ˆ

n dS

  • Praveen. C (CTFD, NAL)

FVM CMMACS 6 / 65

slide-7
SLIDE 7

Conservation laws

If F is differentiable, use divergence theorem ∂ ∂t

  • V

φ dV = −

  • V

∇ · F dV

  • r
  • V

∂φ ∂t + ∇ · F

  • dV = 0,

for every control volume V ∂φ ∂t + ∇ · F = 0 In Cartesian coordinates, F = (f, g, h) ∂φ ∂t + ∂f ∂x + ∂g ∂y + ∂h ∂z = 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 7 / 65

slide-8
SLIDE 8

Differential and integral form

Differential form ∂φ ∂t + ∇ · F = 0 ∂ ∂t (conserved quantity) + divergence(flux) = 0 Integral form ∂ ∂t

  • V

φ dV = −

  • ∂V
  • F · ˆ

n dS

  • Praveen. C (CTFD, NAL)

FVM CMMACS 8 / 65

slide-9
SLIDE 9

Mass conservation equation

φ = ρ, F = ρ q

  • F · ˆ

n dS = amount of mass flowing across dS per unit time ∂ ∂t

  • V

ρ dV +

  • ∂V

ρ q · ˆ n dS = 0 Using divergence theorem ∂ ∂t

  • V

ρ dV +

  • V

∇ · (ρ q) dS = 0

  • r
  • V

∂ρ ∂t + ∇ · (ρ q)

  • dV = 0
  • Praveen. C (CTFD, NAL)

FVM CMMACS 9 / 65

slide-10
SLIDE 10

Mass conservation equation

Differential form ∂ρ ∂t + ∇ · (ρ q) = 0 In Cartesian coordinates, q = (u, v, w) ∂ρ ∂t + ∂ ∂x (ρu) + ∂ ∂y (ρv) + ∂ ∂z (ρw) = 0 Non-conservative form ∂ρ ∂t + u ∂ρ ∂x + v ∂ρ ∂y + w ∂ρ ∂z + ρ ∂u ∂x + ∂v ∂y + ∂w ∂z

  • = 0
  • r in vector notation

∂ρ ∂t + q · ∇ρ + ρ∇ · q = 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 10 / 65

slide-11
SLIDE 11

Navier-Stokes equations

Mass:

∂ρ ∂t + ∇ · (ρ

q) = 0 Momentum:

∂ ∂t (ρ

q) + ∇ · (ρ q q) + ∇p = ∇ · τ Energy:

∂E ∂t + ∇ · (E + p)

q = ∇ · ( q · τ) + ∇ · Q

  • Praveen. C (CTFD, NAL)

FVM CMMACS 11 / 65

slide-12
SLIDE 12

Convection and diffusion

Mass:

∂ρ ∂t + ∇ · (ρ

q) = 0 Momentum:

∂ ∂t (ρ

q) + ∇ · (ρ q q) + ∇p = ∇ · τ Energy:

∂E ∂t + ∇ · (E + p)

q = ∇ · ( q · τ) + ∇ · Q

  • Praveen. C (CTFD, NAL)

FVM CMMACS 12 / 65

slide-13
SLIDE 13

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 13 / 65

slide-14
SLIDE 14

Convection-diffusion equation

Convection-diffusion equation ∂u ∂t + a∂u ∂x = µ∂2u ∂x2 a, µ are constants, µ > 0 Conservation law form ∂u ∂t + ∂f ∂x = f = f c + f d f c = au f d = −µ∂u ∂x

  • Praveen. C (CTFD, NAL)

FVM CMMACS 14 / 65

slide-15
SLIDE 15

Convection equation

Scalar convection equation ∂u ∂t + a∂u ∂x = 0 Exact solution u(x, t + ∆t) = u(x − a∆t, t) Wave-like solution: convected at speed a Wave moves in a particular direction Solution can be discontinuous Hyperbolic equation

  • Praveen. C (CTFD, NAL)

FVM CMMACS 15 / 65

slide-16
SLIDE 16

Scalar convection equation

t a > 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 16 / 65

slide-17
SLIDE 17

Scalar convection equation

∆ t t a ∆ t t+ a > 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 17 / 65

slide-18
SLIDE 18

Convection equation

Scalar convection equation ∂u ∂t + a∂u ∂x = 0 Exact solution u(x, t + ∆t) = u(x − a∆t, t) Wave-like solution: convected at speed a Wave moves in a particular direction Solution can be discontinuous Hyperbolic equation

  • Praveen. C (CTFD, NAL)

FVM CMMACS 18 / 65

slide-19
SLIDE 19

Diffusion equation

Scalar diffusion equation ∂u ∂t = µ∂2u ∂x2 Solution u(x, t) ∼ e−µk2tf(x; k) Solution is smooth and decays with time Elliptic equation

  • Praveen. C (CTFD, NAL)

FVM CMMACS 19 / 65

slide-20
SLIDE 20

Diffusion equation: Initial condition

t

  • Praveen. C (CTFD, NAL)

FVM CMMACS 20 / 65

slide-21
SLIDE 21

Diffusion equation

∆ t t+ t

  • Praveen. C (CTFD, NAL)

FVM CMMACS 21 / 65

slide-22
SLIDE 22

Diffusion equation

Scalar diffusion equation ∂u ∂t = µ∂2u ∂x2 Solution u(x, t) ∼ e−µk2tf(x; k) Solution is smooth and decays with time Elliptic equation

  • Praveen. C (CTFD, NAL)

FVM CMMACS 22 / 65

slide-23
SLIDE 23

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 23 / 65

slide-24
SLIDE 24

FVM in 1-D: Conservation law

1-D conservation law ∂u ∂t + ∂ ∂x f(u) = 0, a < x < b, t > 0 Initial condition u(x, 0) = g(x) Boundary conditions at x = a and/or x = b

  • Praveen. C (CTFD, NAL)

FVM CMMACS 24 / 65

slide-25
SLIDE 25

FVM in 1-D: Grid

Divide computational domain into N cells a = x1/2, x1+1/2, x2+1/2, . . . , xN−1/2, xN+1/2 = b

hi i+1/2 i−1/2 i x=a x=b i=1 i=N

Cell number i Ci = [xi−1/2, xi+1/2] Cell size (width) hi = xi+1/2 − xi−1/2

  • Praveen. C (CTFD, NAL)

FVM CMMACS 25 / 65

slide-26
SLIDE 26

FVM in 1-D

Conservation law applied to cell Ci xi+1/2

xi−1/2

∂u ∂t + ∂f ∂x

  • dx = 0

Ci h i−3/2 i−1/2 i+1/2 i+3/2 i

Cell-average value ui(t) = 1 hi xi+1/2

xi−1/2

u(x, t) dx Integral form hi dui dt + f(xi+1/2, t) − f(xi−1/2, t) = 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 26 / 65

slide-27
SLIDE 27

FVM in 1-D

i+1/2 i−1/2 i x=a x=b i=1 i=N i−1 i+1

Cell-average value is dicontinuous at the interface What is the flux ? Numerical flux function f(xi+1/2, t) ≈ Fi+1/2 = F(ui, ui+1)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 27 / 65

slide-28
SLIDE 28

FVM in 1-D

Finite volume update equation (ODE) hi dui dt + Fi+1/2 − Fi−1/2 = 0, i = 1, . . . , N Telescopic collapse of fluxes

N

  • i=1
  • hi

dui dt + Fi+1/2 − Fi−1/2

  • = 0

d dt

N

  • i=1

hiui + FN+1/2 − F1/2 = 0 Rate of change of total u = -(Net flux across the domain)

hi i+1/2 i−1/2 i x=a x=b i=1 i=N

  • Praveen. C (CTFD, NAL)

FVM CMMACS 28 / 65

slide-29
SLIDE 29

Time integration

At time t = 0 set the initial condition uo

i := ui(0) = 1

hi xi+1/2

xi−1/2

g(x) dx Choose a time step ∆t (stability and accuracy) or M Break time (0, T) into M intervals ∆t = T M , tn = n∆t, n = 0, 1, 2, . . . , M For n = 0, 1, 2, . . . , M, compute un

i = ui(tn) ≈ u(xi, tn)

un+1

i

= un

i − ∆t

hi (F n

i+1/2 − F n i−1/2)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 29 / 65

slide-30
SLIDE 30

Numerical Flux Function

Take average of the left and right cells

U U i+1/2

i i+1

Fi+1/2 = 1 2[f(ui) + f(ui+1)] Central difference scheme dui dt + fi+1 − fi−1 hi = 0 Suitable for elliptic equations (diffusion phenomena) Unstable for hyperbolic equations (convection phenomena)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 30 / 65

slide-31
SLIDE 31

Convection equation: Centered flux

Convection equation, a = constant ∂u ∂t + a∂u ∂x = 0, f(u) = au Centered flux, Fi+1/2 = (aui + aui+1)/2 dui dt + aui+1 − ui−1 hi = 0

U U i+1/2

i i+1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 31 / 65

slide-32
SLIDE 32

Convection equation: Upwind flux

Upwind flux

U U i+1/2

i i+1

Fi+1/2 =

  • aui,

if a > 0 aui+1, if a < 0

  • r

Fi+1/2 = a + |a| 2 ui + a − |a| 2 ui+1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 32 / 65

slide-33
SLIDE 33

Convection equation: Upwind flux

Upwind scheme dui dt + aui − ui−1 hi = 0, if a > 0 dui dt + aui+1 − ui hi = 0, if a < 0

  • r

dui dt + a + |a| 2 ui − ui−1 hi + a − |a| 2 ui+1 − ui hi = 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 33 / 65

slide-34
SLIDE 34

Diffusion equation

Diffusion equation ∂u ∂t + ∂f ∂x = 0, f = −µ∂u ∂x No directional dependence; use centered formula Fi+1/2 = −µui+1 − ui xi+1 − xi On uniform grid dui dt = µui+1 − 2ui + ui−1 h2

  • Praveen. C (CTFD, NAL)

FVM CMMACS 34 / 65

slide-35
SLIDE 35

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 35 / 65

slide-36
SLIDE 36

Choice of numerical parameters

What scheme to use ? What should be the grid size h ? What should be the time step ∆t ?

  • Praveen. C (CTFD, NAL)

FVM CMMACS 36 / 65

slide-37
SLIDE 37

Stability: Convection equation

Take a > 0 CFL number λ = a∆t h Centered flux un+1

i

= un

i − λ

2un

i+1 + λ

2un

i−1

Upwind flux un+1

i

= (1 − λ)un

i + λun i−1

Solution at t = 1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 37 / 65

slide-38
SLIDE 38

Convection equation: Initial condition

0.2 0.4 0.6 0.8 1 0.2 0.4 0.6 0.8 1 Initial condition

  • Praveen. C (CTFD, NAL)

FVM CMMACS 38 / 65

slide-39
SLIDE 39

Convection equation: Centered scheme, λ = 0.8

  • 8e+10
  • 6e+10
  • 4e+10
  • 2e+10

2e+10 4e+10 6e+10 8e+10 0.2 0.4 0.6 0.8 1 Exact solution At t=1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 39 / 65

slide-40
SLIDE 40

Convection equation: Upwind scheme, λ = 0.8

0.2 0.4 0.6 0.8 1 0.2 0.4 0.6 0.8 1 Exact solution At t=1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 40 / 65

slide-41
SLIDE 41

Convection equation: Upwind scheme, λ = 1.1

  • 40000
  • 30000
  • 20000
  • 10000

10000 20000 30000 40000 0.2 0.4 0.6 0.8 1 Exact solution At t=1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 41 / 65

slide-42
SLIDE 42

Stability: Convection equation

Centered flux: Unstable Upwind flux: conditionally stable λ ≤ 1

  • r

∆t ≤ h |a|

  • Praveen. C (CTFD, NAL)

FVM CMMACS 42 / 65

slide-43
SLIDE 43

Stability: Diffusion equation

Central scheme un+1

i

− un

i

∆t = µun

i+1 − 2un i + un i−1

h2 Stability parameter ν = µ∆t h2 Update equation un+1

i

= νun

i+1 + (1 − 2ν)un i + νun i−1

Stability condition ν ≤ 1 2

  • r

∆t ≤ h2 2µ

  • Praveen. C (CTFD, NAL)

FVM CMMACS 43 / 65

slide-44
SLIDE 44

Stability: Convection-diffusion equation

Convection-diffusion equation ∂u ∂t + ∂f ∂x = 0, f = au − µ∂u ∂x Upwind scheme for convective term; central scheme for diffusive term Fi+1/2 = a + |a| 2 ui + a − |a| 2 ui+1 − µui+1 − ui xi+1 − xi Update equation un+1

i

= a+∆t h + µ∆t h2

  • un

i−1

+

  • 1 − |a|∆t

h − µ∆t h2

  • un

i

+

  • −a−∆t

h + µ∆t h2

  • un

i+1

  • Praveen. C (CTFD, NAL)

FVM CMMACS 44 / 65

slide-45
SLIDE 45

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 45 / 65

slide-46
SLIDE 46

Non-linear conservation law

Inviscid Burgers equation ∂u ∂t + u ∂u ∂x = 0 Finite difference scheme dui dt + ui + |ui| 2 ui − ui−1 h + ui − |ui| 2 ui+1 − ui h = 0 Gives wrong results Not conservative; cannot be put in FV form h dui dt + Fi+1/2 − Fi−1/2 = 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 46 / 65

slide-47
SLIDE 47

Non-linear conservation law

Conservation law ∂u ∂t + ∂ ∂x u2 2

  • = 0
  • r

∂u ∂t + ∂f ∂x = 0, f(u) = u2 2 Upwind finite volume scheme h dui dt + Fi+1/2 − Fi−1/2 = 0 with Fi+1/2 =

  • 1

2u2 i

if ui+1/2 ≥ 0

1 2u2 i+1

if ui+1/2 < 0 Approximate interface value, for example ui+1/2 = 1 2(ui + ui+1)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 47 / 65

slide-48
SLIDE 48

Transonic flow over NACA0012

5

  • Praveen. C (CTFD, NAL)

FVM CMMACS 48 / 65

slide-49
SLIDE 49

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 49 / 65

slide-50
SLIDE 50

Computational domain

(Josy)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 50 / 65

slide-51
SLIDE 51

Grids and finite volumes

  • Praveen. C (CTFD, NAL)

FVM CMMACS 51 / 65

slide-52
SLIDE 52

Structured grid

  • Praveen. C (CTFD, NAL)

FVM CMMACS 52 / 65

slide-53
SLIDE 53

Unstructured grid

  • Praveen. C (CTFD, NAL)

FVM CMMACS 53 / 65

slide-54
SLIDE 54

Unstructured hybrid grid

  • Praveen. C (CTFD, NAL)

FVM CMMACS 54 / 65

slide-55
SLIDE 55

Unstructured hybrid grid

  • Praveen. C (CTFD, NAL)

FVM CMMACS 55 / 65

slide-56
SLIDE 56

Cartesian grid

Saras (Josy)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 56 / 65

slide-57
SLIDE 57

Block-structured grid

Fighter aircraft (Nair)

  • Praveen. C (CTFD, NAL)

FVM CMMACS 57 / 65

slide-58
SLIDE 58

Cell-centered and vertex-centered

  • Praveen. C (CTFD, NAL)

FVM CMMACS 58 / 65

slide-59
SLIDE 59

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 59 / 65

slide-60
SLIDE 60

FVM in 2-D

Conservation law ∂u ∂t + ∂f ∂x + ∂g ∂y = 0 Integral form Ai dui dt +

  • ∂Ci

(fnx + gny) dS = 0

Ci Ci

  • Praveen. C (CTFD, NAL)

FVM CMMACS 60 / 65

slide-61
SLIDE 61

FVM in 2-D

Approximate flux across the cell face

C n C

i j ij

Fij∆Sij ≈

  • (fnx + gny) dS

Finite volume approximation Ai dui dt +

  • j∈N(i)

Fij∆Sij = 0

  • Praveen. C (CTFD, NAL)

FVM CMMACS 61 / 65

slide-62
SLIDE 62

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 62 / 65

slide-63
SLIDE 63

Summary

Integral form of conservation law Satisfies conservation of mass, momentum, energy, etc. Can capture discontinuities like shocks Can be applied on any type of grid Useful for complex geometry

  • Praveen. C (CTFD, NAL)

FVM CMMACS 63 / 65

slide-64
SLIDE 64

Outline

1

Divergence theorem

2

Conservation laws

3

Convection-diffusion equation

4

FVM in 1-D

5

Stability of numerical scheme

6

Non-linear conservation law

7

Grids and finite volumes

8

FVM in 2-D

9

Summary

10 Further reading

  • Praveen. C (CTFD, NAL)

FVM CMMACS 64 / 65

slide-65
SLIDE 65

For further reading I

Blazek J., Computational Fluid Dynamics: Principles and Applications, Elsevier, 2004. Hirsch Ch., Numerical Computation of Internal and External Flows,

  • Vol. 1 and 2, Wiley.

LeVeque R. J., Finite Volume Methods for Hyperbolic Equations, Cambridge University Press, 2002. Wesseling P ., Principles of Computational Fluid Dynamics, Springer, 2001. Ferziger J. H. and Peric M., Computational methods for fluid dynamics, 3’rd edition, Springer, 2003.

http://www.cfd-online.com/Wiki

  • Praveen. C (CTFD, NAL)

FVM CMMACS 65 / 65