Você está na página 1de 19

Finite volume method

The finite volume method is based on (I)


Integral conservation law (I)
rather than (D). The integral conservation Z Z Z
law is enforced for small control volumes ∂
u dV + f · n dS = q dV
∂t V
defined by the computational mesh: S V
S n
f = vu − d∇u
N
[ V

V̄ = V̄i , Vi ∩ Vj = ∅, ∀i 6= j
dS f
flux function
i=1 Z Z Z
∂u
1
Z
dV + ∇ · f dV = q dV
ui = u dV mean value V ∂t V V
|Vi | Vi
Partial differential equation (D)
To be specified ∂u
+∇ · f = q in V
• concrete choice of control volumes ∂t
∂u
• type of approximation inside them In steady state ∂t
= 0 so that

• numerical methods for evaluation ∇ · (uv) = ∇ · (d∇u) + q


of integrals and fluxes
Definition of control volumes

Vertex-centered FVM Cell-centered FVM

1D ui 1D ui
ui+1 ui+1
ui 1 ui 1

Vi Vi

xi 1 xi xi+1 xi 1 x i 1=2 xi
x i 1=2 xi+1=2
2D 2D

Vi

Vi Vi
Vi

Different grids / control volumes can be used for different variables (v, p, . . .)
Discretization of local subproblems

Integral equation for a single finite volume

1 X 1 1
Z Z Z
∂ui
+ f · nk dS = qi , ui = u dV, qi = q dV
∂t |Vi | Sk |V i | Vi |Vi | Vi
k

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

Numerical integration pn (x)


Z n
X
f (x) dV ≈ wi f (xi )
V i=0

where wi ≥ 0 are the weights and xi are


the nodes of the quadrature rule x0 xi xn

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


Newton-Cotes quadrature rules for intervals

x1 +x2
1D x12 = 2 , V = (x1 , x2 ), |V | = x2 − x1
x1 x12 x2
Z
Midpoint rule f (x) dV ≈ |V |f12 exact for f ∈ P1 (V )
V

f1 + f2
Z
Trapezoidal rule f (x) dV ≈ |V | exact for f ∈ P1 (V )
V 2
f1 + 4f12 + f2
Z
Simpson’s rule f (x) dV ≈ |V | exact for f ∈ P3 (V )
V 6

Numerical integration for quadrilaterals/hexahedra


y 

1 use a mapping onto a unit square


V
V^ and apply 1D quadrature rules in
each coordinate direction
x 0 1 
Newton-Cotes quadrature rules for triangles
2D x3
Midpoints
x1 + x2 x1 + x3 x2 + x3
x13 x123 x23 x12 =
2
, x13 =
2
, x23 =
2
x1 + x2 + x3
Center of gravity x123 =
3
x1 x12 x2
Z
f (x) dV ≈ |V |f123 exact for f ∈ P1 (V )
V

f1 + f2 + f3
Z
f (x) dV ≈ |V | exact for f ∈ P1 (V )
V 3
f12 + f23 + f13
Z
f (x) dV ≈ |V | exact for f ∈ P2 (V )
V 3
3(f1 + f2 + f3 ) + 8(f12 + f23 + f13 ) + 27f123
Z
f (x) dV ≈ |V |
V 60
exact for f ∈ P3 (V )
Newton-Cotes quadrature rules for tetrahedra
3D x4

Center of gravity
x1234
x3 x1234 =
x1 + x2 + x3 + x4
4
x1
x2
Z
f (x) dV ≈ |V |f1234 exact for f ∈ P1 (V )
V

f1 + f2 + f3 + f4
Z
f (x) dV ≈ |V | exact for f ∈ P1 (V )
V 4
f1 + f2 + f3 + f4 + 16f1234
Z
f (x) dV ≈ |V | exact for f ∈ P2 (V )
V 20
Interpolation techniques

Problem: the solution is available only at computational nodes (CV centers)


Interpolation is needed to obtain the function values at quadrature points

1
R
Volume integrals ui = |Vi | Vi
u dV ≈ u(x̄i ) midpoint rule

1
P R
Surface integrals f = vu − d∇u ⇒ |Vi | f · nk dS = Ic + Id
k Sk

1 X 1 X
Z Z
Ic = (v · nk )u dS, Id = d(nk · ∇u) dS
|Vi | Sk |Vi | Sk
k k

Approximation of convective fluxes vertex-centered FVM


ui
1
1D: |Vi | ≡ ∆x = N, xi = i∆x ui 1
ui+1

ui+1/2 − ui−1/2 Vi
Ic = v , v = const
∆x
xi 1 xi xi+1
How to define the interface values ui±1/2 ? x i 1=2 xi+1=2
Upwind difference approximation (UDS)

Piecewise-constant solution Upwind-biased interface values

ui 1=2 ui+1=2
v>0 ui−1/2 ≈ ui−1 , ui+1/2 ≈ ui
ui+1
ui ui − ui−1
Ic ≈ v backward difference
ui 1 ∆x

x v<0 ui−1/2 ≈ ui , ui+1/2 ≈ ui+1


xi 1 xi xi+1
ui+1 − ui
xi 1=2 xi+1=2 Ic ≈ v forward difference
∆x
Taylor series expansion
(∆x)2 ∂2u
   
v∆x ∂u
vui+1/2 = vui − −v + ...
2 ∂x i+1/2 8 ∂x2 i+1/2

a first-order accurate flux approximation, the leading truncation error resembles


a diffusive flux d ∂u v∆x
∂x with d = 2 being the numerical diffusion coefficient
Central difference approximation (CDS)

Piecewise-linear solution Interpolation polynomial


ui 1=2 ui+1=2 xR − x x − xL
p1 (x) = uL + uR
ui+1 xR − xL xR − xL
ui
Averaged interface values
ui 1
ui−1 + ui ui + ui+1
ui−1/2 ≈ , ui+1/2 ≈
x 2 2

xi 1 xi xi+1
ui+1 − ui−1
Ic ≈ v central difference
xi 1=2 xi+1=2
2∆x

Taylor series expansions


 
∆x ∂u
 (∆x)2 ∂2 u
ui+1 = ui+1/2 + 2 ∂x i+1/2 + 8 ∂x2 + ...
i+1/2
 
∆x ∂u
 (∆x)2 ∂2 u
ui = ui+1/2 − 2 ∂x i+1/2 + 8 ∂x2 − ...
i+1/2

ui + ui+1 (∆x)2 ∂2u


 
Hence, ui+1/2 = − + ... (second-order accuracy)
2 8 ∂x2 i+1/2
Linear upwind difference scheme (LUDS)

Piecewise-linear solution Upwind-biased extrapolation


ui 1=2 ui+1=2 3ui−1 −ui−2
ui−1/2 ≈ 2
v ui+1
v>0 3ui −ui−1
ui ui+1/2 ≈ 2

ui 1 3ui − 4ui−1 + ui−2


ui 2 Ic ≈ v
2∆x
x
3ui −ui+1
xi 2 xi 1 xi xi+1 ui−1/2 ≈ 2
v<0 3ui+1 −ui+2
xi 1=2 xi+1=2 ui+1/2 ≈ 2

LUDS is second-order accurate, equivalent 3ui − 4ui+1 + ui+2


Ic ≈ −v
to the one-sided 3-point finite difference 2∆x

The matrix is no longer tridiagonal (shifted, upper/lower triangular if Id = 0)


(m+1) (m+1) (m) (m)
Defect correction: ILU DS = IU DS + [ILU DS − IU DS ], m = 0, 1, 2, . . .
Quadratic upwind difference scheme (QUICK)

Quadratic Upwind Interpolation for Convective Kinematics


p2 (x) = uL xx−xM
L −xM
xR −x
xR −xL + uM xx−x
M
L
−x x
xR −x
L R −xM
+ uR x
x−xL x−xM
R −xL xR −xM

ui 1=2 ui+1=2
Upwind-biased interface values
v ui+1
ui 3ui +6ui−1 −ui−2
ui−1/2 ≈ 8
ui 1 v>0
ui 2 ui+1/2 ≈ 3ui+1 +6ui −ui−1
8
x
3ui+1 + 3ui − 7ui−1 + ui−2
xi 2 xi 1 xi xi+1
Ic ≈ v
8∆x
xi 1=2 xi+1=2
3ui−1 +6ui −ui+1
ui−1/2 ≈ 8
• third-order flux approximation v<0 3ui +6ui+1 −ui+2
ui+1/2 ≈ 8
• second-order overall accuracy
3ui−1 + 3ui − 7ui+1 + ui+2
(because of the midpoint rule) Ic ≈ −v
8∆x
• marginally better than LUDS
Evaluation of surface integrals
Approximation of convective fluxes
• any second-order finite volume scheme is a linear combination of CDS and
LU DS approximations (e.g. IQU ICK = 43 ICDS + 41 ILU DS )
• high-order schemes can be readily derived by polynomial fitting based on
pm (x), m > 2 but pay off 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 sufficiently fine meshes

Approximation of diffusive fluxes


slopes of the
 
ui − ui−1
 
∂u ∂u ui+1 − ui
≈ , ≈
∂x i−1/2 ∆x ∂x i+1/2 ∆x straight lines

Second-order accurate central difference


∂u ∂u
 
d ∂x i+1/2 − d ∂x i−1/2 ui+1 − 2ui + ui−1
Id = − ≈ −d
∆x (∆x)2
Discretization of transport problems

∂ ∂ ∂
Convective transport → first derivatives ∂x , ∂y , ∂z

∂ρ
+∇ · (ρv) = 0 continuity equation (hyperbolic)
∂t

∂2 ∂2 ∂2
Diffusive transport → second derivatives ∂x2 , ∂y 2 , ∂z 2 , . . .

∂T
−∇ · (κ∇T ) = 0 heat conduction (parabolic/elliptic)
∂t

Dimensionless numbers: ratio of convection and diffusion


v0 L0 v0 L0
Pe = d Peclet number Re = ν Reynolds number

Convection-dominated transport equations (such that P e ≫ 1 or Re ≫ 1)


are essentially hyperbolic, which may give rise to numerical difficulties.
Example: 1D convection-diffusion equation
Boundary value problem Exact solution

 v ∂u ∂2 u ePe x − 1 v
∂x − d ∂x2 = 0 in (0, 1) u = Pe , Pe =
e −1 d
u(0) = 0, u(1) = 1

where Pe is the Peclet number
Vertex-centered finite volume method
∂u ∂u
 
ui+1/2 − ui−1/2 ∂x i+1/2 − ∂x i−1/2
Pe − =0
∆x ∆x
1
Solution behavior for v > 0 xi = i∆x, ∆x = N, i = 0, 1, . . . N
u u u
1
v 1
v 1
v

P e = 40 smearing wiggles

∆x = 0.1

0 1 x 0 1 x 0 1 x

exact solution upwind difference central difference


Discretized convection-diffusion equation
Upwind difference scheme
ui − ui−1 ui−1 − 2ui + ui+1
Pe − = 0, i = 1, . . . , N − 1
∆x (∆x)2

Central difference scheme


ui+1 − ui−1 ui−1 − 2ui + ui+1
Pe − = 0, i = 1, . . . , N − 1
2∆x (∆x)2

Boundary conditions u0 = 0, uN = 1

Linear system Au = F A ∈ RN −1×N −1 u, F ∈ RN −1

b c u1 0
     
a b c u2 0
1      
A=

a b c ,

u=

u3 ,

F =
 0 
(∆x)2 
 
...   ·   · 
c
a b uN −1 − (∆x) 2

where A is a tridiagonal, nonsymmetric matrix with constant coefficients


Exact solution of the difference scheme

Linear equation for an interior node

aui−1 + bui + cui+1 = 0 a < 0, b > 0, a+b+c=0

a b c
upwind difference −1 − Pe ∆x 2 + Pe ∆x −1
central difference −1 − 0.5 Pe ∆x 2 −1 + 0.5 Pe ∆x

Trial solution ui = α + βri , u0 = 0, uN = 1 (boundary conditions)

ari−1 + br i + cri+1 = 0, b = −(a + c) ⇒ cr2 − (a + c)r + a = 0


p
(a + c) ± (a + c)2 − 4ac (a + c) ± (a − c) a
r1,2 = = , r1 = , r2 = 1
2c 2c c
a
A constant solution does not satisfy the BC ⇒ r= c is the root we need.
Numerical behavior of the difference scheme

a i

Trial solution ui = α + β c subject to the boundary conditions
 a N 1
u0 = α + β = 0, uN = α + β =1 ⇒ α = −β =
c a N

1− c
i
1−( a
c) P
Hence, ui = N = Q is the exact solution of the difference scheme.
1−( a
c )

a
a

c >1 ⇒ P < 0, Q<0 ⇒ ui > 0
c<0 a < 0, c >0
a
 0<
c <1 ⇒ P > 0, Q>0 ⇒ ui > 0
positivity-preserving

a a
c>0 a < 0, c < 0; a + c = −b < 0 ⇒ c < −a ⇒ c < −1
P changes its sign so that sign(ui ) = −sign(ui±1 ) ⇒ nonphysical oscillations

c=0 ui = − ab ui−1 = 0, i = 1, . . . , N − 1 u0 = 0, uN = 1
no spurious oscillations but the accuracy leaves a lot to be desired
Evaluation of the central difference scheme

Criterion: the difference scheme produces no oscillations if c ≤ 0


Under this condition the matrix A is diagonally dominant

|b| = |a| + |c| for c ≤ 0


a < 0, b = −(a + c) ⇒
|b| < |a| + |c| for c > 0

Moreover, A is an M-matrix so that all the entries of its inverse are nonnegative

Central difference scheme u


v
1
Pe ∆x
c = −1 + ≤0 ⇒ Pe ∆x ≤ 2
2 wiggles

• this condition is very restrictive for large Pe


• wiggles occur just in the vicinity of steep gradients
• local mesh refinement is useful for moderate Pe 0 1 x
Evaluation of the upwind difference scheme

Upwind difference scheme c = −1 is negative unconditionally

(∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
     
∂u
Taylor series ui±1 = ui ± ∆x + ± +...
∂x i 2 ∂x2 i 6 ∂x3 i
   2 
ui − ui−1 ui−1 − 2ui + ui+1 Pe ∆x ∂ 2 u
 
∂u ∂ u
Pe − 2
= Pe − 2
− 2
+ O(∆x)2
∆x (∆x) ∂x i ∂x i 2 ∂x i
u
The truncation error is O(∆x) for the original equation v
1
but O(∆x)2 for the so-called modified equation
smearing
v∆x ∂ 2 u
 
∂u
v − d+ =0
∂x 2 ∂x2
v∆x
where 2 is the numerical (artificial) diffusion coefficient 0 1 x

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

Você também pode gostar