Numerical Simulation of Transport Processes in Porous Media
Finite-Volume Methods
Olaf Ippisch
Interdisziplin¨ ares Zentrum f¨ ur Wissenschaftliches Rechnen Universit¨ at Heidelberg
Im Neuenheimer Feld 368 D-69120 Heidelberg Telefon: 06221/54-8252
E-Mail: olaf.ippisch@iwr.uni-heidelberg.de
November 3, 2009
Cell-Centred Finite-Volume Method
We want to discretise the steady-state ground-water equation
∇ · ~ J w (~ x) + r w (~ x) = 0 with
J w = −K s (~ x )∇p w
with the Cell-Centred Finite-Volume method.
Divide Domain into Grid Cells
First we divide grid into rectangular grid cells g ij
x0,0 x4,0
x4,0.5
N=5
x1,0 x2,0 x3,0 x0,1
x0,2 x0,3 x0,4
x3.5,1 x4.5,1
x4,1.5
Transformation of Volume Integral into Boundary Integral
We demand that the integral of the partial differential equation over each grid cell is fulfilled:
Z
g
ij∇ · ~ J w dx dy = Z
g
ijr(~ x) dx dy
and use the Satz of Gauss to transform the volume integral over the divergence of the flux into a boundary integral over the flux normal to the boundary:
⇔
|{z}
Satz of Gauss
Z
∂g
ij~ J w · ~ n ds = Z
g
ijr (~ x) dx dy
Inner Grid Cell
(
−10)
(
01) (
10)
(
−10)
(i,j−1) (i,j)
(i−1,j) (i−0.5,j) (i+0.5,j) (i+1,j)
(i,j+0.5)
(i,j−0.5)
i+0.5,j
F (i,j+1)
Finite Volume Discretisation: Split into Sum over Faces
For our rectangular cell, we can split the integral over the boundary of the cell into integrals over each face
Z
∂g
ij~ J w · ~ n ds = X
k=i±0.5
Z
F
kj~ J w · ~ n ds + X
l=j±0.5
Z
F
il~ J w · ~ n ds
and approximate the integral over each face with the Midpoint rule
≈
|{z}
Midpointrule
X
k =i±0.5
~ J w (~ x k,j ) · ~ n · h
|{z}
Face Area
+ X
l=j±0.5
~ J w (~ x i,l ) · ~ n · h
|{z}
Face Area
If the permeability is a diagonal matrix the flux over a face depends only on the
gradient in the normal direction
Finite Volume Discretisation: Insert Flux law
The multiplication with the (normalised) normal vector only influences the sign of the flux integral
X
k=i±0.5
~ J w (~ x k,j ) · ~ n · h + X
l=j±0.5
~ J w (~ x i,l ) · ~ n · h =
−K xx (~ x i−0.5,j ) · ∂p
∂x (~ x i−0.5,j ) · (−1)
| {z }
from n
x·h
−K xx (~ x i+0.5,j ) · ∂p
∂x (~ x i+0.5,j ) · (1)
|{z}
from n
x·h
−K yy (~ x i,j−0.5 ) · ∂p
∂x (~ x i,j−0.5 ) · (−1)
| {z }
from n
y·h
−K yy (~ x i,j+0.5 ) · ∂p
∂x (~ x i,j+0.5 ) · (1)
|{z}
from n
y·h
Finite Volume Discretisation: Approximate Derivatives
The gradient at the face midpoint is approximated by a central difference quotient
≈
|{z}
approx.Derivative
+K xx (~ x i−0.5,j ) · p(~ x i,j ) − p(~ x i−1,j )
h · h
−K xx (~ x i+0.5,j ) · p(~ x i+1,j ) − p(~ x i,j )
h · h
+K yy (~ x i,j−0.5 ) · p(~ x i,j ) − p(~ x i,j−1 )
h · h
−K yy (~ x i,j+0.5 ) · p(~ x i,j+1 ) − p(~ x i,j )
h · h
Finite Volume Discretisation: Approximate Derivatives
The integration of the source/sink term is also done with the midpoint rule:
Z
g
ijr (~ x)dx dy ≈ h 2 r (~ x i,j )
Matrix Contribution of each Grid Cell
We get one line of a linear equation system for each grid cell:
−K
xx(~ x
i−0.5,j) · p
i−1,j− K
xx(~ x
i+0.5,j) · p
i+1,j−K
yy(~ x
i,j−0.5) · p
i,j−1− K
yy(~ x
i,j+0.5) · p
i,j+1+ [K
xx(~ x
i−0.5,j) + K
xx(~ x
i+0.5,j) + K
yy(~ x
i,j−0.5) + K
yy(~ x
i,j+0.5)] · p
i,j= h
2r(~ x
i,j)
Dirichlet Boundary Conditions
Let us assume that at x = 0 there is a Dirichlet boundary:
h/2 x0,j
h
The derivative between the face midpoint and the element midpoint can be approximated by a difference quotient (only first order):
∂p
∂x (~ x −0.5,j ) ≈ p(~ x 0,j ) − p d (0, y j )
h/2
Matrix Contribution at Dirichlet Boundary x = 0
The constant term −K xx (~ x i−0.5,j ) · p d (0, y j ) is brought to the right-hand side of the equation:
−K
xx(~ x
i+0.5,j) · p
i+1,j−K
yy(~ x
i,j−0.5) · p
i,j−1− K
yy(~ x
i,j+0.5) · p
i,j+1+ [2K
xx(~ x
i−0.5,j) + K
xx(~ x
i+0.5,j)
+K
yy(~ x
i,j−0.5) + K
yy(~ x
i,j+0.5)] · p
i,j= h
2r(~ x
i,j) + 2K
xx(~ x
i−0.5,j) · p
d(0, y
j)
Neumann Boundary Conditions
To integrate Neumann boundary conditions we go back to the point before the integration of the face fluxes with the midpoint rule. For each face we had to determine
Z
F
~ J w · ~ n ds
At a Neumann boundary ~ J w · ~ n is given directly by the boundary condition φ n (~ x ), we can therefore use
Z
F
kl~ J w · ~ n ds ≈
|{z}
Midpointrule
h · φ ~ N (~ x ) · ~ n
at each Neumann boundary.
Matrix Contribution at Neumann Boundary x = 0
We transfer the constant term h · φ N (~ x −0.5,j ) to the right hand side:
−K
xx(~ x
i+0.5,j) · p
i+1,j−K
yy(~ x
i,j−0.5) · p
i,j−1− K
yy(~ x
i,j+0.5) · p
i,j+1+ [K
xx(~ x
i+0.5,j) + K
yy(~ x
i,j−0.5) + K
yy(~ x
i,j+0.5)] · p
i,j= h
2r(~ x
i,j) − h · φ
N(~ x
−0.5,j)
Different Grid Spacing in x and y direction
If the grid spacing in x and y direction is different, the h factors do not clear:
− h
yh
x(K
xx(~ x
i−0.5,j) · p
i−1,j− K
xx(~ x
i+0.5,j) · p
i+1,j)
− h
xh
y(K
yy(~ x
i,j−0.5) · p
i,j−1− K
yy(~ x
i,j+0.5) · p
i,j+1) +
» h
yh
x(K
xx(~ x
i−0.5,j) + K
xx(~ x
i+0.5,j)) + h
xh
y(K
yy(~ x
i,j−0.5) + K
yy(~ x
i,j+0.5)) –
· p
i,j= h
xh
yr(~ x
i,j)
Example: 3 × 3 Grid
Let us perform a Finite-Volume discretisation of the stead-state groundwater equation on a 3 × 3 grid with a homogeneous permeability field and Dirichlet boundary condition on the north and south side and no-flux boundary conditions at the left and right:
3 5
6 7 8
noflux 4 noflux
dirichlet north
K (~ x ) =
K 0
0 K
Example: 3 × 3 Grid
0 1 2
3 5
6 7 8
noflux
4
nofluxdirichlet north
dirichlet south
The resulting linear equation system is:
0 B B B B B B B B B B
@
4K −K 0 −K 0 0 0 0 0
−K 5K −K 0 −K 0 0 0 0
0 −K 4K 0 0 −K 0 0 0
−K 0 0 3K −K 0 −K 0 0
0 −K 0 −K 4K −K 0 −K 0
0 0 −K 0 −K 3K 0 0 −K
0 0 0 −K 0 0 4K −K 0
0 0 0 0 −K 0 −K 5K −K
0 0 0 0 0 −K 0 −K 4K
1 C C C C C C C C C C A
0 B B B B B B B B B B
@ p
0p
1p
2p
3p
4p
5p
6p
7p
81 C C C C C C C C C C A
= 0 B B B B B B B B B B B
@
2Kp
dsouth2Kp
dsouth2Kp
dsouth0 0 0 2Kp
dnorth2Kp
dnorth2Kp
dnorth
1
C
C
C
C
C
C
C
C
C
C
C
A
Effective Permeability
We assume that the permeability is a diagonal Tensor, which is depending on the position, but constant on each grid cell g ij .
We need to evaluate K at the cell boundaries x i±0.5,j±0.5 .
What is the correct value of K if it is not homogeneous but element-wise constant?
1D-Example
The steady-state groundwater flow equation is:
dJ w
dx = 0 in Ω = (0, `
|{z}
length
)
J w = −K (x) dp dx
p
0K(x)
p
lwith the Dirichlet boundary conditions p(0) = p 0
p(`) = p `
because of dJ dx
w= 0 in Ω ⇔ J w (x) = J 0 ∈ R this means
J 0 = −K (x) dp dx ⇔ dp
dx = − J 0
K (x)
1D-Example
By integration of both sides over the domain dp
dx = − J 0 K (x)
⇔
`
Z
0
dp
dx dx = [p(x)] ` 0 = p ` − p 0 = −J 0
`
Z
0
1 K (x) dx
we get the flux depending on the boundary conditions and the permeability distribution:
⇔ J 0 = − `
`
R 1 dx
· p ` − p 0
`
| {z }
1D-Example, cell-wise constant Permeability
If we divide the domain into two halves with constant permeability if K (x) =
K l x ≤ 2 ` K r x > ` 2
K r
0 l
K l
we can perform the integration and get the effective permeability
K eff = `
`
R
0 1 K(x ) dx
= `
` 2
1 K
l+ ` 2 K 1
r
= 2
1 K
l+ K 1
r
We therefore choose for cell-wise constant permeabilities the harmonic mean K (~ x i±0.5,j ) = 2
1
K(~ x
i,j) + K(~ x 1
i±1,j
)
Finite-Volume Method for tensor-product Grids
− 2h
yjK
xx(~ x
i−0.5,j) h
xi−1+ h
xi· p
i−1,j− 2h
yjK
xx(~ x
i+0.5,j) h
xi+ h
xi+1· p
i+1,j− 2h
xiK
yy(~ x
i,j−0.5) h
yj−1+ h
yj· p
i,j−1− 2h
xiK
yy(~ x
i,j+0.5) h
yj+ h
yj+1· p
i,j+1+
» 2h
yjK
xx(~ x
i−0.5,j)
+ 2h
yjK
xx(~ x
i+0.5,j)
Complexer Grids with Cell-Centred Finite Volumes
With the Cell-Centred Finite Volume Method it is also possible to use some kind of unstructured grids:
Nested Grids
I M J K A B
γ
x
Voronoi Grids
A B
C
D
E F G
x i
x k
C i
Summary Cell-Centred Finite-Volume Method
• Only the integral of the partial differential equation over each grid cell must fullfill the equation.
• Implementation of Dirichlet Boundary and Neumann Boundary conditions straight forward
• Structured and unstructured grids possible
• Dirichlet boundary conditions can easily be integrated by rearranging the equation systems and bringing them to the right side of the equation.
• Neumann boundary conditions can easily be integrated in the flux integrals
• Convergence order can differ dependent on the concrete method.
Properties of the Cell-Centred Finite-Volume Method
• Advantages:
• well suited for structured grids
• locally mass conservative
• good approximation of average permeability
• limited variety of unstructured grids possible
• limited local adaptivity possible
• cheap for simple problems
• Problems:
• Only linear convergence rate on non-equidistant grids
• grid generation can be complicated (must fulfil rather strong conditions)
The Vertex-Centred Finite-Volume Method
vi
vj bi
bj
• The unknowns are located at the edges of the elements (vertices)
• Base functions are used on each element, which are parameterised with the values at the vertices
• A secondary mesh is constructed connecting the face centres and the
barycenter of the element
The Vertex-Centred Finite-Volume Method (2)
vj vi
bik xikf γikf
nikf
xijk nijk γijk
element ek
vi vj
bki bjk
element ek xijk
nijk γijk
γjkf xjkf
njkf