Вы находитесь на странице: 1из 17

1

Queensland University of Technology


CRICOS No. 00213J
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
MODULE 2 - Introduction to Finite
Volume Methods (FVM)
Basic concepts and rules of the finite volume method
Application to the Generalised one-dimensional Diffusion
Equation
Cell-centred and vertex-centred schemes
Treatment of diffusion coefficients at control volume faces
and source/sink terms
Incorporating boundary condition information into the
model
Invited Lecture Series presented at the APAC / ICE-EM / AMSI Summer School held at the
Australian National University, Canberra, January 2004. Copyright 2004 by Ian Turner
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Overview of Module
Introduction
The Generalised Diffusion Equation
One-Dimensional Finite Volume Scheme
Summary of FVEs
Monotonicity Constraints
Case Studies
2
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
2.1 Introduction
The finite volume method (FVM) finds application in a large number
of fields of Science and Technology, where it is used to solve a
variety of partial differential equations (PDEs) that model given
physical phenomena.
Most notably the method has been used with great success in the
fields of computational fluid dynamics (CFD), Numerical Heat
Transfer and Transport in Porous Media (drying, groundwater
flow, petroleum reservoir modelling, dispersion of contaminants).
The method has a thirty year history and is still evolving - it was
introduced into the field of CFD independently by McDonald (1971)
and MacCormack and Paullay (1972) to resolve two-dimensional,
time-dependent Euler equations. It was extended to three-
dimensions by Rizzi (1973).
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
The FVM is a conservative discretisation method - the
integral formulation of the underlying conservation laws are
discretised directly in physical space.
The FVM can be implemented on a completely arbitrary
mesh and a large number of options are available for defining
the control volumes (CVs) over which the conservation laws are
expressed.
The ability to have flexibility in CV shape and location within a
mesh, together with the varying rules and accuracy for
evaluating fluxes at the CV surfaces makes the FVM a popular
choice for solving linear and non-linear PDEs numerically.
3
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Some more facts about the FVM...
It has the very important property of ensuring that basic quantities
such as mass, momentum and energy are conserved at a
discrete level. Conservation is satisfied over one CV, over a group
of CVs and over the entire solution domain.
The union of all CV volumes should cover the entire solution
domain and fluxes through a cell surface between two adjacent
CVs must be computed using formulae independent of the cell
in which they are being considered. This requirement ensures the
conservative property is satisfied.
In the absence of source terms, the finite volume equations
express a discrete analogue of the conservation laws - the
variation of the cell average value of a given physical quantity over a
time interval is equal to the sum of the fluxes exchanged between
neighbouring cells.
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
The FVM allows a natural introduction of boundary conditions
into the formulation.
Structured meshes (classical finite-difference type meshes) or
Unstructured meshes (triangular and quadrilateral cells in two-
dimensions or tetrahedral or hexahedral cells in three-dimensions)
can be used - which offers greater flexibility when treating
complicated geometries.
When variables are associated with a cell we call the method a
cell-centred FVM. When variables are associated with nodes in
the mesh we call the method a vertex-centred FVM.
A good reference is the excellent pioneering book Numerical Heat
Transfer written by S.V.Patankar (1980)
4
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
To introduce the FVM we will focus on the one-dimensional constant
parameter case of the generalised diffusion equation, stated as follows:
( )
( )
( )
( )



| |
|
|
\ .

= >

= >

=
= < < >
=
=
< <

0
, 0 (2 )
, 0 (2 )
:
,0 ,
, 0 , 0 (1)
:
0
0 (2 )
xx u
xx
xx
D
t x x
D k t a
x
D k t b
x
and initially
x x
S x L t
Subject to
at x
at x L
x L c
J
is assumed constant
xx
D
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
2.2 The One-Dimensional Finite Volume Scheme
1. The Discretisation Process
First generate a mesh by either:
defining the position of the nodes and then constructing the faces of the
control volumes midway between the nodes (vertex centred)
or
defining the control volume faces and then position the nodes at the
centres of the control volumes (cell centred)
Boundary CV Boundary CV
Node
Interior Control Volume (CV)
5
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Different Mesh Types can be employed for Different
Physical Phenomena
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
50
100
150
distance (m)
T
e
m
p
e
r
a
t
u
r
e

(
C
)
Mesh refined around exchange surfaces -
typically use a geometric progression
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
distance from injection point (m)
c
o
n
t
a
m
i
n
a
n
t

c
o
n
c
e
n
t
r
a
t
i
o
n

(
m
g
/
l
)
Mesh refined around steep front - typically Mesh
evolves with the transport phenomenon
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
The following diagram introduces the terminology used throughout
this module:
where the point of interest P is surrounded by its neighbours W(est)
and E(ast). The dashed lines, denoted by w and e represent control
volume (CV) faces.
At this stage the exact location of the CV faces is unimportant - more
will be said about this throughout this lecture.
P
x
p

E W
x
e
x
w

Control Volume
w e
6
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
The Finite Volume discretisation process proceeds by integrating
equation (1) across the CV:
We stress that (4) is exact - No approximations have been made to
this point of the derivation.
( )




+ =


+ = =


= =

1 1
1
0, (3)
Define cell averages
and
then (3) becomes
(4)
where and represent the transport fluxes
evaluated at the east and west faces respectiv
x
e
u xx
x
w
x x
e e
u
x x p p
w w
e w
p
e w
x x
d
J J
dt x
J
S dx J D
t x x
dx S S dx
S
J J
CV ely
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Next we must consider the accuracy of the cell average when it is
replaced by and derive approximations for the fluxes at the CV
faces. The way in which these terms are treated is of utmost
importance to the accuracy of the computational scheme.
However, before we continue we need to introduce some more
notation to assist with our analysis.
P
x
p

E W
x
e
x
w

Control Volume
x
w

+
x
e

+
x
w


x
e

p
7
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
( ) ( )






+ +
+
= =
= = + =
= =
+
= = + =
,
then
, 1 and 1
1 1
, giving
2 2
, and
2 2 2
Define the following geometric quantites:
and note that for the
w e
w e
w e
w p w w e p e e p e e w w
w e
w e e w
w p e p p
x x
x x
x x x x x
x x x x
x x x x x
x x x x
vertex centred case


= = +
while for the
,
2 2
2
E W
p p
w p e p
x x
x x
x x x x
cell centred case
x
p

x
e
x
w

x
w

+
x
e

+
x
w


x
e


x
e w
x p
x
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
2. Accuracy of the cell average
x
p

x
e
x
w

x
w

+
x
e


x
e w
x p
x
( )
( )
+

= +

2 1
1
2
x
e
e w p
x p
w
x
x
dx O
Recall that
Now expand Taylor series about to obtain:
p
x
( ) ( )
( ) ( )



+
+
+
+ +
| |
+ = + + < <
|
\ .
| |
= + < <
|
\ .
2
2
2
2
2
2
1
, (5 )
2
1
, (5 )
2
e p e e p e p e
p
w p w w w p p w
p
d d
x x x x x x a
dx dx
d d
x x x x x x b
dx dx
8
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Then (5a) + (5b) gives
( )
( ) ( )


+ | |
+ = + +
|
\ .
2 1 1
2 2
e w p e w p
p
d
x x O x
dx
from which we see that the approximation retains second
order accuracy if . Clearly this condition is satisfied for the
cell-centred case. If the vertex centred scheme is used, second
order accuracy can be restored if the leading error term
can in someway be estimated.

+
=
e w
x x

p
( )



+
=
| |

|
\ .
1
2
e w
p
d
x x
dx
( )
+

= +

2 1
x
e
p p
x p
w
x
x
dx O
We write:
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
3. Approximation of Diffusion/Dispersion term
( ) ( )


| |
|
|
\ .
| | | |

| |

\ . \ .
| |
=
|

\ .

2
2
2
(6)
1
2 1
2
where the error term is defined as
+
E P
xx xx xx e
e
e e e
e e e e
e
D D D
x x x
x x
x
O
East Face
Note that if (vertex centred case) this approximation is
second order.
=
1
2
e
9
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
To see this we use Taylor Series expansions as follows:
( )
( )
( )





+
+ + +
+
+ + +


| | | |
| |
+ = + + + +
| | |
\ .
\ . \ .
| |
+ < <
|
\ .
| | | |
| |
= + +
| | |
\ .
\ . \ .
2 3
2 3
2 3
4 5
4 5
4 5
2 3
2 3
2 3
1 1
2 6
1 1
, (7 )
24 120
1 1
2 6
e e e e e e E
e
e e
e e e e e E
e
e e e e e e P
e
e e
d d d
x x x x x
dx dx dx
d d
x x x x a
dx dx
d d d
x x x x x
dx dx dx
( )


| |
< <
|
\ .
4 5
4 5
4 5
1 1
, (7 )
24 120
e e p e e e
e
d d
x x x x b
dx dx
x
e

x
e

+
x
e

and consider (7a)-(7b).


x
e
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005

| |
|
|
\ .
| | | |

| |

\ . \ .


(8)
where the error term is defined similarly to the east face.
P W
xx xx xx w
w
w w w
w
D D D
x x x
West Face
Note again that if (vertex centred case) this approximation also
is second order.
=
1
2
w
10
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
4. Treatment of Boundary Conditions
x
e

x
e
Consider the following Figure which shows a typical boundary
control volume BCV
Boundary face at x = 0 Boundary Control Volume
We must account for the three types of boundary conditions:
1. Dirichlet ( )
2. No flux (symmetry planes/adiabatic surfaces)
3. Flux specified (exchange surface of material)

p
specified
b
x
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
( )
( )

+ =

=

+ =


1
and this expression is substituted
directly into the above equation to give:
0
so that
where represents the flux evaluated at the boundary.
In our case (see 2a)
x
e
u
x
b
e b
b
b
b b
d
J J
dt x
k
d
d
J
S dx
t x
S
J
J
( )
( )

+ =

1
( ) 9
e b
b
J k
t x
S
We proceed as for an internal CV and integrate from to
e
b
x x
The three types of boundary conditions are treated via the parameter k as follows:
1. Dirichlet - can set k very large in (9)
2. No flux - set k = 0
3. Flux specified - k given as required
11
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
( )
( )
( )( ) ( )


+
+
+ + (
+
(

+


(
+ = +

=
+
1
1
1 1
1
1
1 1
0
(10)
n
n
t
e w
t p
n n
n n n n
n n
e w e w
p
d
J J
dt x
t
J J J J t
x
S dt
S S
5. Integration in time - the Temporal Scheme
Consider the following diagram, which depicts an extension of the
control volume concept in time:
P E W
t
n
t
1 n
t
+
t
( ) 1 t
Integrating (4) in time from gives
+1
to
n
n
t t

= 0 ( )
1
left hand rule Fully Explicit
= - right hand rule (Fully Implicit)
1
= - Trapezoidal rule
2
The temporal order of the scheme is first order if the Fully Implicit
method is used and is second order for . =1 =
1
2
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
2.3 Summary of the One-Dimensional
Finite Volume Equations (FVEs)
Substitution of all approximations into (10), and using the vertex
centred scheme, yields the following finite volume equation for an
interior CV:
( )
( )( ) ( )





+
+ + (
+
(

(
+ +


| | | |
= =
| |
\ . \ .
+
1
1 1
1
1 1 0 (11 )
where
n n
n n n n
n n
p p e w e w
p
E P P W
e xx w xx
e w
t
J J J J t
x
D D
x x
S S a
J J
Interior FVE
12
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
( )
( )( ) ( )
( )


+
+ + (
+
(

(
+ +

| |
= =

|
\ .
+
1
1 1
1
1 1 0 (11 )
where
n n
n n n n
n n
p p e w e w
p
E P
wb w e xx w P
e
t
J J J J t
x
k D
x
S S b
J J
West boundary FVE
( )
( )( ) ( )
( )


+
+ + (
+
(

(
+ +

| |
= =
|
\ .
+
1
1 1
1
1 1 0 (11 )
where
n n
n n n n
n n
p p e w e w
p
P W
e e w xx P eb
w
t
J J J J t
x
k D
x
S S c
J J
East boundary FVE
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Suppose that the node points in the mesh are numbered from i = 1,,N
with i = 1 and i = N denoting the boundary points. The finite volume
equations (FVEs) can be rearranged into the form:
We can see from (12) that the are related to their neighbours in an
implicit manner. It then follows that the above equations generate a
tri-diagonal matrix system of the form:
which must be solved at each time level in order to advance the solution
in time. This matrix system is solved efficiently using the tridiagonal
matrix algorithm (TDMA).
Generating the Linear System

+ + +
+
+ + = = = =
1 1 1
1 1 1
1 1 1
, 1, , with 0 (12)
, ,
,
Note that due to the boundary condition implementation, and
, have different forms to interior points.
n n n
i i i i i i i N
N N N
l d u b i N l u
u b
b
d
l d

i
( )
= =
1 2
, , , ,
T
N
Tu b u
13
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
Monotonicity Constraints
In order for the approximated solution to behave in a physical manner
(oscillation free), the underlying linear system should satisfy so called
monotonicity criteria, namely:
1. The coefficient matrix T of the linear system should be an M-matrix
2. The right hand side vector b should have positive entries
T is an M-matrix if it is a real, nonsingular matrix such that


1 1
0 0 ( . ., )
ij
t i j and i e each entry of is non negative T T
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
We summarise in the proceeding slides the monotonicity constraints for
the vertex centred scheme discussed above. For simplicity, we tabulate the
constraints only for interior points and note that similar constraints can be
derived depending on the type of boundary conditions specified for a given
problem.
Some Important facts
Fact1: Diagonally dominant matrices are nonsingular and Triangular decomposition can be
performed on the matrix without the need for pivoting with the computations remaining
stable with respect to the growth

> >
1
0 . . 0
n x n
st T u Tu
of roundoff errors.
Fact 2: All Matrices with nonpositive off - diagonal; entries whose principal minors are
positiveare M- matrices
Fact 3: if is an M- matrix
14
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
1. Fully Implicit = 1
Equation (11a) shows that there are no monotonicity constraints
because all criteria are satisfied.
2. Crank Nicolson =
1
2

| |
> +
|

\ .
1 1 2
xx
w e p
D
x x t x
In this case equation (11a) shows that it possible for the term
involving in to be negative. Consequently, there is a
monotonicity constraint for this combination of spatial and
temporal weighting that must be satisfied to ensure that the
solution in free of unwanted spurious oscillations:

n
i
i
b
In the absence of the source term
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
distance (m)

Bechmark Problem 2 - Diffusion in a slab


t
1
t
2
t
3
t
4
t
5
t
6
t
7
Fully Implicit Scheme - 20 CVs dt = .01 sec
t
final
= 0.4 sec
Problem 1
15
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
distance (m)

Bechmark Problem 2 - Diffusion in a slab


t
1
t
2
t
3
t
4
t
5
t
6
t
7
Crank Nicolson Scheme - 20 CVs dt = 0.01 sec
t
final
= 0.4 sec
Monotonicity constraint
breeched - oscillations
appear in solution
profiles - non-physical
behaviour
Problem 1
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
distance (m)

Bechmark Problem 2 - Diffusion in a slab


t
1
t
2
t
3
t
4
t
5
t
6
t
7
Crank Nicolson Scheme - 20 CVs dt = 0.005 sec
t
final
= 0.4 sec
Monotonicity constraint
is now met by reducing
the time step and the
numerical solution is
close to perfect!
Problem 1
16
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
50
100
150
distance (m)
T
e
m
p
e
r
a
t
u
r
e

(
C
)
Bechmark Problem 1 - Heat Conduction in wood
t
1
t
2
t
3
t
4
t
5
t
6
t
7
Fully Implicit Scheme - 20 CVs dt = 100 sec
t
final
= 5000 sec
Problem 2
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
50
100
150
distance (m)
T
e
m
p
e
r
a
t
u
r
e

(
C
)
Bechmark Problem 1 - Heat Conduction in wood
t
1
t
2
t
3
t
4
t
5
t
6
t
7
Crank Nicolson Scheme - 20 CVs dt = 100 sec
t
final
= 5000 sec
Problem 2
17
CRICOS No. 00213J
a university for the
world real
R
APAC / ICE-EM / AMSI SUMMER SCHOOL 2005
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
50
100
150
distance (m)
T
e
m
p
e
r
a
t
u
r
e

(
C
)
Bechmark Problem 1 - Heat Conduction in wood
t
1
t
2
t
3
t
4
t
5
t
6
t
7
Crank Nicolson Scheme - 20 CVs dt = 500 sec
t
final
= 5000 sec
Monotonicity constraint
breeched - oscillations
appear in solution
profiles - non-physical
behaviour
Problem 2

Вам также может понравиться