Sie sind auf Seite 1von 6

School of Mechanical Aerospace and Civil Engineering

Finite-Volume Methods
Most modern general purpose CFD codes use finite volume methods to obtain the
discretized set of equations.
One important feature of finite volume schemes is their conservation properties. Since they
are based on applying conservation principles over each small control volume, global
conservation is also ensured.

Finite Volume Schemes


T. J. Craft
George Begg Building, C41

Although here we will consider in some detail how they are applied on rectangular Cartesian
grids they can, fairly readily, be adapted to non-orthogonal and even unstructured grids.
Some examples of how this is done will be presented in later lectures.

Contents:

The method starts by dividing the flow domain


into a number of small control volumes.

Introduction to CFD
Numerical solution of equations
Finite difference methods
Finite volume methods
Pressure-velocity coupling
Solving sets of linear equations
Unsteady problems
Turbulence and other physical modelling
Body-fitted coordinate systems

Reading:
J. Ferziger, M. Peric, Computational Methods for Fluid
Dynamics
H.K. Versteeg, W. Malalasekara, An Introduction to Computational Fluid Dynamics: The Finite Volume Method
S.V. Patankar, Numerical Heat Transfer and Fluid Flow
Notes: http://cfd.mace.manchester.ac.uk/tmcfd
- People - T. Craft - Online Teaching Material

The grid points at which variables are stored


are then typically defined as being at the
centre of each control volume.
Extra boundary nodes are often added, as
shown in the figure.
The transport equation to be discretized is then integrated over each control volume.
- p. 3

Introduction

If we considered a general (steady) transport


equation for some quantity :

(Uj )

+ S
xj
xj
xj

In earlier lectures we examined finite difference methods, and saw how they could be used
to approximate a differential equation by a set of discretized algebraic ones.
Employing Taylor series analysis allowed us to determine the truncation error of
approximations, and to develop schemes with different orders of accuracy.
Such methods can be applied quite
successfully when the flow geometry allows a
simple Cartesian set of grid points to be
adopted.

or

(i+1,j)

or
However, in complex geometries more work is
needed.

(2)

Integrating this over the control volume gives:

Z
Z
Z
(Uj )

dV =
S dV

dV +
xj
xj

xj

(i,j+1)
(i1,j) (i,j)

.(U ) = .() + S

(1)

(i,j1)

In such cases it may not be possible, for example, to arrange horizontal grid lines as shown,
meaning we could not approximate /x purely in terms of values along a constant j line.

.(U ) dV =

.() dV +

S dV

(4)

The convection and diffusion terms can be combined:


Z
Z
.(U ) dV =
S dV

(3)

(5)

The divergence theorem can then be used to convert the volume integral on the left hand
side to an integral around the boundary, , of the control volume:
Z
Z
(U ).ndS =
S dV
(6)

Another drawback of finite difference schemes, particularly when applied to engineering


fluids problems, is that care has to be taken in approximations in order to ensure
conservation properties.

- p. 2

- p. 4

Finite-Volume Method on a 2-D Rectangular Grid

U .ndS is the convective flux of across the small part of the boundary edge dS , and
.ndS is the diffusive flux across the same boundary element.

The left hand side of equation (6) is thus simply the total net convective and diffusive flux of
into the control volume.
Equation (6) is thus essentially a statement of conservation for the control volume. In the
case of the momentum equation, where = U for example, it is simply the force-momentum
principle applied over the control volume.
Provided the same expressions are used for fluxes across faces in neighbouring cells, this
approach thus ensures that the same conservation properties will also be satisfied globally
over the flow domain.
Since the boundary of a control volume is made up of a number of straight edges, the
surface integral is generally approximated in a discretized form by
Z
X
(U ).ndS
(U )k .(nS)k

To complete the discretization, one needs to consider how to approximate the convective
and diffusive fluxes at the cell faces and, if necessary, the source terms at the cell centre.
To see how the method works in practice, consider the
steady U momentum equation in 2 dimensions and a
uniform rectangular grid.
The velocity U is stored at the nodes P , N , S , E , W ,
which are located at the centre of the control volumes,
and the cell faces are denoted by lower case n, s, e, w.
The finite-volume method starts by integrating the
momentum equation over the P control volume:
ZZ

(U 2 ) +
(U V )dxdy =
x
y

(7)

where the summation is taken over the edges of the control volume, (U )k is
evaluated at the centre of edge k, (S)k is the area of the edge and nk is the unit vector
normal to the edge.

ZZ

N
n
W

s
S
x

P
dxdy
x

ZZ
U

dxdy
+
x
y
y
V x

This leads to
Z
n Z
e
Z
Z
e
n Z Z
U
U
P
U 2 dy
U V dx

+
=
+
dy
dx
dxdy
x
y
V x
w
s
w
s
- p. 5

The above approximation of the surface integral can be shown to be of second order
accuracy, since for some function f a Taylor series expansion gives:
Z

f (s) ds =

f () + (s )f () +

(s )2
f () +
2!

ds

(10)

(11)
- p. 7

Evaluating Source Terms

(8)

for any point lying somewhere on the line being integrated along.
The integration of terms on the right hand side of equation (8) can then be carried out, using
a suitable change of variable, to give
Z
Z
Z
f (s) ds = f ()
ds + f () (s ) ds +

As indicated above when outlining the general finite volume scheme, the source terms can
be approximated by evaluating them at the cell centre and multiplying by the volume of the
cell:

ZZ
P
P
dxdy

xy
(12)
x P
V x
In the example considered, the pressure gradient at the cell centre, (P/x)P , is evaluated
by interpolating pressure values from surrounding nodes, if necessary. This will be
addressed in more detail in later lectures.

= f ()s + O((s)2 )

Other source terms can be evaluated similarly, interpolating where necessary to estimate
cell centre values.

In fact, when is taken as the mid-point of the face then the above approximation has
leading order term of O((s)3 ).
The source terms in the volume integral of equation (6) are generally approximated as
Z
S dV S V ol (S )P V ol

(9)

where S is the average value of S over the control volume and (S )P is simply its value
at the cell centre node P .
This approximation can also be shown to be generally of second order accuracy.
- p. 6

- p. 8

First Order Upwind Scheme

Evaluating Diffusive Fluxes

The diffusive fluxes can then be approximated by


Z

Z
e
n
e
n
U
U
U
U

+

+
dy
dx
y
x
x
y
x
y
w
s
w
s

A very simple scheme for approximating cell face values for the convective terms is the
first-order upwind convection scheme:
(13)

Ue =

The gradients U/x and U/y at the east, west, north and south faces can be evaluated
using a central difference, so that the diffusion terms become
(y)e

UE UP
UP UW
UN UP
UP US
(y)w
+ (x)n
(x)s
x
x
y
y

(14)

UP
UE

for Cxe > 0


for Cxe 0

(17)

This gives a convection contribution to the discretized transport equation of


ace UE acw UW acn UN acs US + acp Up

(18)

This is, again, a second order approximation.


where
The discretized diffusion terms in the transport equation can thus be written as
ade UE + adw UW + adn UN + ads US adp UP

(15)

ace = max(Cxe , 0)

acw = max(Cxw , 0)

acn = max(Cyn , 0)

acs = max(Cys , 0)

(19)

and acp = ace + acw + acn + acs + (Cxe Cxw + Cyn Cys )

where
ade
adn

= (y/x)e

adw

= (y/x)w

= (x/y)n

ads

= (x/y)s

(16)

and adp = ade + adw + adn + ads .

Note that the coefficients ace , etc are all positive, as is acp . Moreover, the final set of terms in
acp represents the total net mass flux into the cell, which should be zero, so that in practice
acp can simply be taken as the sum ace + acw + acn + acs .

- p. 9

- p. 11

Combining the convection and diffusion terms results in a discretized equation of the form

Evaluating Convective Fluxes

ap UP = ae UE + aw UW + an UN + as US + su

The convection terms can be approximated as


Z
n
e
Z

e
U 2 dy
U V dx
+
U 2 y w + [U V x]n
s
w

(20)

where ae = ade + ace , etc, ap = ae + aw + an + as , and su represents the source terms arising
from the pressure gradient.

= (U y)e Ue (U y)w Uw + (V x)n Un (V x)s Us

We thus get a set of equations relating UP to the values of U at the surrounding nodes.
Having obtained the coefficients and source terms for each grid cell, the resulting system of
equations can be solved by a suitable numerical algorithm.

= Cxe Ue Cxw Uw + Cyn Un Cys Us

where Cxe , Cxw , etc are simply the mass fluxes through the east, west, north and south
faces.

The above upwind scheme is always bounded. However, as implied by its name, it is only
first order accurate.

The values of U at the cell faces, Ue , Uw , Un and Us need to be obtained by interpolation


between nodal values.
The scheme used to interpolate these values will affect both the stability and accuracy of the
overall solution, and a few commonly-used alternatives are outlined below.

To illustrate this, we assume that Cxe > 0. Then the scheme approximates

U
Cxe Ue Cxe UP = Cxe Ue + (xe xP )
+ O((xe xP )2 )
x e

(21)

The leading error term in this can thus be written as

U
(u )e
y
x e
where the numerical viscosity (u )e = Cxe x/(2y).
- p. 10

- p. 12

QUICK Scheme

The error is therefore diffusive in nature, and so tends to make the solution stable, but
inaccurate.

The QUICK (Quadratic Upwind Interpolation for Convection Kinetics) scheme fits a parabola
between three points to approximate Ue .

Recall that the order of accuracy gives information on how rapidly numerical errors decrease
as the grid is refined. Since the error in the above scheme decreases only linearly with grid
spacing, a very fine grid can be needed in order to achieve sufficient accuracy.

If Cxe > 0 a parabola is fitted through the


points W , P and E .

For this reason, whilst first order schemes are often used, it is usually preferable to employ a
higher order convection scheme.

If Cxe < 0 a parabola is fitted through the


points P , E and EE .

Note, however, that in practical applications it is a fairly common practice to begin a


calculation with a first order scheme, for its stability, and then switch to a higher order one
once the solution is closer to convergence.

For Cxe > 0, on a regular grid we get


e = P +

EE

E P
1
(E 2P + W )
2
8

(26)

The QUICK scheme can be shown to be third order


accurate.
However, it is not bounded, and can produce
undershoots and overshoots in regions of steep
gradients.

- p. 13

Central Difference Scheme


This scheme simply interpolates linearly between UP and UE to approximate Ue . For a
uniform grid this gives
Ue = 0.5(UE + UP )

- p. 15

Note that the discretization stencil associated with the QUICK scheme is larger than that of
the first and second order schemes outlined earlier, since contributions from UEE , UW W ,
UN N and USS now appear.
(22)

This is a second order approximation, which can be seen by writing Taylor series expansions
for Ue and UE :

U
Ue = UP + (xe xP )
+ O(x2 )
(23)
x P

U
+ O(x2 )
UE = UP + (xE xP )
x P

U
= UP + 2(xe xP )
+ O(x2 )
(24)
x P

However, the QUICK (and other) schemes are often coded as deferred corrections. This
means that the upwind scheme contributions are included in the coefficients ae , aw , etc.
whilst the additional contributions from the QUICK (or other) scheme are simply placed in
the source term Su .
Higher order schemes can also be devised and employed. However, in order to benefit
significantly from them the simple formulations introduced earlier for approximating surface
and volume integrals (which are only second order accurate) should also be replaced by a
higher order method.

Subtracting 0.5 equation (24) from equation (23) then gives


Ue = 0.5(UE + UP ) + O(x2 )

(25)

The central difference scheme is thus more accurate than the first order upwind scheme,
although it can produce oscillatory solutions.

- p. 14

- p. 16

Convection Scheme Performances


As an example, we consider the pure convection problem:

V
U
+
=0
x
y

(27)

on the box 0 < x < 1, 0 < y < 1 with velocities U and V constant and prescribed as a step
function at y = 0 and /x = 0 at x = 0 and x = 1.
x

V = 1, U = 0.2

The exact solution is that the step function is simply convected with the velocity.
y

U =0

U >0

The graphs on the following slides show results with U = 0 and U 6= 0 using the three
convection schemes outlined earlier on grids ranging from 10 to 160 points in the x direction.
- p. 17

- p. 19

In the U = 0 case the flow is aligned with the grid lines and all the schemes perform
reasonably well (obviously resolving the step change better as the grid is refined).

When U 6= 0 the flow is not aligned with the grid lines.


In this case the numerical diffusion introduced by the first order upwind scheme is clearly
present.
x

The centred scheme captures the steep gradient better, but shows significant oscillations.

V = 1, U = 0

The QUICK scheme also represents the steep gradients quite well, but does show some
over- and under-shoots at the base and crest of the step.

- p. 18

- p. 20

Boundary Condition Treatments


For illustration we consider a cell at the east
boundary of the flow domain.

Typical boundary conditions might be of the form


U = 0 at xE
U/x = 0 at xE .

E
xE

The discretized form of the transport equation can be written as


ap UP = ae UE + aw UW + an UN + as US + su

(28)

where the coefficients ae , aw , an and as contain the convective and diffusive contributions,
and ap = ae + aw + an + as .
The first type of boundary condition above can be simply implemented by setting the value
of UE to zero.
The zero gradient condition can be implemented by noting that this implies UE = UP (ie. a
one-sided difference approximation). This is typically achieved by setting ae = 0, since then
the contributions ae UP and ae UE are effectively removed from the left and right hand sides
of equation (28) respectively.
Fixed flux conditions (eg. a prescribed heat flux) can also be implemented by setting the ae
coefficient to zero and adding the desired flux to the source term su .
- p. 21

Numerical Flow Solver Strategy


Each momentum equation can be discretized as described, leading to a set of algebraic
equations relating the nodal values of U , V and W .
Other transport equations (for temperature, mass fraction, etc.) can be treated similarly.
However, the equations are coupled in a non-linear fashion, through the convection terms
(and sometimes source terms).
An often-used practice is to solve the equations in an iterative, segregated, manner:
Assemble the discretized equations for U , and hence update U .
Assemble the discretized equations for V , and hence update V .
Assemble the discretized equations for W , and hence update W .
Update the pressure field.
Repeat until the solution has converged.
At this stage it is not clear how the updating of the pressure field is achieved, since we do not
have a transport equation for the pressure. This issue will be addressed in the next lecture.

- p. 22

Das könnte Ihnen auch gefallen