Finite Volume Method

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Finite volume method

The nite volume method is based on (I) rather than (D). The integral conservation law is enforced for small control volumes dened by the computational mesh:
N

Integral conservation law (I) Z Z Z f n dS = q dV u dV + t V S V


S n

f = vu du
f

V =
i=1

Vi , 1 |Vi |

Vi Vj = , u dV
Vi

i = j
Z

dS

ux function f dV = Z q dV
V

ui =

mean value

u dV + t

Partial dierential equation (D)

To be specied concrete choice of control volumes type of approximation inside them numerical methods for evaluation of integrals and uxes

u + f = q t In steady state
u t

in V

= 0 so that

(uv) = (du) + q

Denition of control volumes


Vertex-centered FVM 1D

Cell-centered FVM 1D

2D

2D

Dierent grids / control volumes can be used for dierent variables (v, p, . . .)

Discretization of local subproblems


Integral equation for a single nite volume ui 1 + t |Vi | f nk dS = qi ,
k Sk

ui =

1 |Vi |

u dV,
Vi

qi =

1 |Vi |

q dV
Vi

the integral conservation law is satised for each CV and for the entire domain to obtain a linear system, integrals must be expressed in terms of mean values

Numerical integration
n

f (x) dV
V i=0

wi f (xi )

where wi 0 are the weights and xi are the nodes of the quadrature rule

Such formulae can be derived by exact integration of an interpolation polynomial

Newton-Cotes quadrature rules for intervals


1D

x12 =

x1 +x2 , 2

V = (x1 , x2 ),

|V | = x2 x1

Midpoint rule
V

f (x) dV |V |f12 f (x) dV |V |


V

exact for f P1 (V ) exact for f P1 (V ) exact for f P3 (V )

Trapezoidal rule Simpsons rule


V

f1 + f2 2 f1 + 4f12 + f2 6

f (x) dV |V |

Numerical integration for quadrilaterals/hexahedra


use a mapping onto a unit square and apply 1D quadrature rules in each coordinate direction

Newton-Cotes quadrature rules for triangles


2D

Midpoints x1 + x2 x12 = , 2 Center of gravity

x13 = x123

x1 + x3 x2 + x3 , x23 = 2 2 x1 + x2 + x3 = 3 exact for f P1 (V ) exact for f P1 (V ) exact for f P2 (V )

f (x) dV |V |f123 f (x) dV |V |


V

f1 + f2 + f3 3 f12 + f23 + f13 3

f (x) dV |V |
V

f (x) dV |V |
V

3(f1 + f2 + f3 ) + 8(f12 + f23 + f13 ) + 27f123 60 exact for f P3 (V )

Newton-Cotes quadrature rules for tetrahedra


3D


Center of gravity

x1234 =


f (x) dV |V |f1234
V

x1 + x2 + x3 + x4 4

exact for f P1 (V ) exact for f P1 (V ) exact for f P2 (V )

f (x) dV |V |
V

f1 + f2 + f3 + f4 4 f1 + f2 + f3 + f4 + 16f1234 20

f (x) dV |V |
V

Interpolation techniques
Problem: the solution is available only at computational nodes (CV centers) Interpolation is needed to obtain the function values at quadrature points Volume integrals Surface integrals Ic = 1 |Vi | ui =
1 |Vi | Vi

u dV u( i ) midpoint rule x
1 |Vi | k Sk

f = vu du (v nk )u dS,
k Sk

f nk dS = Ic + Id d(nk u) dS

Id =

1 |Vi |

Sk

Approximation of convective uxes 1D: |Vi | x =


1 N,

vertex-centered FVM

xi = ix v = const

ui+1/2 ui1/2 , Ic = v x

How to dene the interface values ui1/2 ?

Upwind dierence approximation (UDS)


Piecewise-constant solution

Upwind-biased interface values v>0 Ic v v<0 ui1/2 ui1 , ui ui1 x ui+1/2 ui

backward dierence ui+1/2 ui+1

ui1/2 ui , ui+1 ui x

Ic v

forward dierence

Taylor series expansion vui+1/2 vx = vui 2 u x


i+1/2

(x)2 v 8

2u x2

+ ...
i+1/2

a rst-order accurate ux approximation, the leading truncation error resembles a diusive ux d u with d = vx being the numerical diusion coecient x 2

Central dierence approximation (CDS)


Piecewise-linear solution

Interpolation polynomial x xL xR x + uR p1 (x) = uL xR xL xR xL Averaged interface values ui1/2 ui1 + ui , 2 ui+1/2 ui + ui+1 2

Ic v

ui+1 ui1 2x

central dierence

Taylor series expansions ui+1 = ui+1/2 + ui = ui+1/2 Hence, ui+1/2


x 2 x 2 u x i+1/2 u x i+1/2

+ +

(x)2 8 (x)2 8

2 u x2 2 u x2

i+1/2 i+1/2

+ ... ... (second-order accuracy)

ui + ui+1 (x)2 = 2 8

2u x2

+ ...
i+1/2

Linear upwind dierence scheme (LUDS)


Piecewise-linear solution

Upwind-biased extrapolation v>0 ui1/2 ui+1/2


3ui1 ui2 2 3ui ui1 2

Ic v

3ui 4ui1 + ui2 2x ui1/2 ui+1/2


3ui ui+1 2 3ui+1 ui+2 2

v<0 Ic v

LUDS is second-order accurate, equivalent to the one-sided 3-point nite dierence

3ui 4ui+1 + ui+2 2x

The matrix is no longer tridiagonal (shifted, upper/lower triangular if Id = 0) Defect correction: ILU DS = IU DS + [ILU DS IU DS ],
(m+1) (m+1) (m) (m)

m = 0, 1, 2, . . .

Quadratic upwind dierence scheme (QUICK)


Quadratic Upwind Interpolation for Convective Kinematics p2 (x) = uL xxxM L xM

xR x xR xL

+ uM xxxLL xxR x + uR xxxLL xxxM M x R xM R x R xM Upwind-biased interface values v>0 ui1/2 ui+1/2
3ui +6ui1 ui2 8 3ui+1 +6ui ui1 8

Ic v

3ui+1 + 3ui 7ui1 + ui2 8x ui1/2 ui+1/2


3ui1 +6ui ui+1 8 3ui +6ui+1 ui+2 8

third-order ux approximation second-order overall accuracy (because of the midpoint rule) marginally better than LUDS

v<0

Ic v

3ui1 + 3ui 7ui+1 + ui+2 8x

Evaluation of surface integrals


Approximation of convective uxes any second-order nite volume scheme is a linear combination of CDS and 3 1 LU DS approximations (e.g. IQU ICK = 4 ICDS + 4 ILU DS ) high-order schemes can be readily derived by polynomial tting based on pm (x), m > 2 but pay o only if the quadrature rule matches their accuracy a high-order scheme is guaranteed to produce better results than a low-order one only asymptotically i.e. for suciently ne meshes Approximation of diusive uxes u x
i1/2

ui ui1 , x

u x

i+1/2

ui+1 ui x

slopes of the straight lines

Second-order accurate central dierence Id = d


u x i+1/2

u x i1/2

ui+1 2ui + ui1 (x)2

Discretization of transport problems


Convective transport + (v) = 0 t Diusive transport rst derivatives
x , y , z

continuity equation (hyperbolic) second derivatives


2 2 2 2 , y 2 , z 2 , . . . x

T (T ) = 0 t Dimensionless numbers: Pe =
v0 L0 d

heat conduction (parabolic/elliptic) ratio of convection and diusion Re =


v0 L0

Peclet number

Reynolds number

Convection-dominated transport equations (such that P e 1 or Re 1) are essentially hyperbolic, which may give rise to numerical diculties.

Example: 1D convection-diusion equation


Boundary value problem 2 v u d u = 0 in (0, 1) x x2 Vertex-centered nite volume method ui+1/2 ui1/2 Pe x Solution behavior for v > 0

Exact solution ePe x 1 u = Pe , e 1 Pe = v d

u(0) = 0,

u(1) = 1

where Pe is the Peclet number


u x i+1/2

u x i1/2

x x =

=0

xi = ix,

1 N,

i = 0, 1, . . . N

P e = 40 x = 0.1

exact solution

upwind dierence

central dierence

Discretized convection-diusion equation


Upwind dierence scheme Pe ui ui1 ui1 2ui + ui+1 = 0, x (x)2 i = 1, . . . , N 1

Central dierence scheme ui1 2ui + ui+1 ui+1 ui1 = 0, Pe 2x (x)2 Boundary conditions Linear system u0 = 0, uN = 1 A RN 1N 1 u1 u2 u3 uN 1

i = 1, . . . , N 1

Au = F

u, F RN 1 0 0 0

b c 1 a b c A= , a b c (x)2 ... a b

u=

F =

c (x)2

where A is a tridiagonal, nonsymmetric matrix with constant coecients

Exact solution of the dierence scheme


Linear equation for an interior node aui1 + bui + cui+1 = 0 a upwind dierence central dierence Trial solution 1 Pe x 1 0.5 Pe x u0 = 0, b = (a + c) a < 0, b > 0, b 2 + Pe x 2 uN = 1 a+b+c=0 c 1 1 + 0.5 Pe x (boundary conditions) cr2 (a + c)r + a = 0 r1 = a , c r2 = 1

ui = + ri ,

ari1 + br i + cri+1 = 0, r1,2 = (a + c)

(a + c)2 4ac (a + c) (a c) = , 2c 2c r=
a c

A constant solution does not satisfy the BC

is the root we need.

Numerical behavior of the dierence scheme


Trial solution ui = +
a i c

subject to the boundary conditions a c


N

u0 = + = 0, Hence, ui =
1( a ) c 1(
a c i

uN = + =
P Q

=1

= =

1 1
a N c

is the exact solution of the dierence scheme.


a c

c<0

a < 0,

a c

>0

positivity-preserving c>0 a < 0,


a c

>1
a c

P < 0, P > 0,

Q<0 Q>0


a c

ui > 0 ui > 0 < 1

0<

<1

< 0;

a + c = b < 0

c < a

P changes its sign so that sign(ui ) = sign(ui1 ) c=0 ui = a ui1 = 0, b i = 1, . . . , N 1

nonphysical oscillations uN = 1

u0 = 0,

no spurious oscillations but the accuracy leaves a lot to be desired

Evaluation of the central dierence scheme


Criterion: the dierence scheme produces no oscillations if c 0 Under this condition the matrix A is diagonally dominant a < 0, b = (a + c) |b| = |a| + |c| for c 0 |b| < |a| + |c| for c > 0

Moreover, A is an M-matrix so that all the entries of its inverse are nonnegative Central dierence scheme c = 1 + Pe x 0 2 Pe x 2

this condition is very restrictive for large Pe wiggles occur just in the vicinity of steep gradients local mesh renement is useful for moderate Pe

Evaluation of the upwind dierence scheme


Upwind dierence scheme Taylor series c = 1 u x is negative unconditionally (x)2 + 2 i u x 2u x2 (x)3 6 i Pe x 2

ui1 = ui x

3u x3 2u x2

+...
i

ui ui1 ui1 2ui + ui+1 Pe = Pe x (x)2

2u x2 i

+ O(x)2
i

The truncation error is O(x) for the original equation but O(x)2 for the so-called modied equation vx u d+ v x 2 where
vx 2

2u =0 x2

is the numerical (articial) diusion coecient

UDS is nonoscillatory but not to be recommended because of its low accuracy.

You might also like