You are on page 1of 7

FINITE DIFFERENCE METHODS

Example

In this example we solve the steady 1D


convection/diffusion equation with
Dirichlet boundary conditions at both
ends.
with the boundary conditions:
= 0 at x = 0, = L at x = L,
The aim is to demonstrate the properties
of the FD discretization technique for a
simple problem which has an analytic
solution.
1
D
DR.. AJMAL
AJMAL SHAH,
SHAH, PIEAS
PIEAS
FINITE DIFFERENCE METHODS

In order to demonstrate the false diffusion


associated with UDS and the possibility of
oscillations when using CDS, we shall
consider the case with
Pe= 50 ( L=1.0, =1.0, u=1.0, =0.02, 0=0,
We start with
and L= 1.0).
results obtained
using uniform grid
with 11 nodes (10
equal
subdivisions).
The profiles of
(x) obtained
using CDS and
UDS for convection 2

and CDS for


R D
D .. AJMAL
AJMAL SHAH,
SHAH, PIEAS
PIEAS
FINITE DIFFERENCE METHODS

The UDS solution is obviously over-diffusive,


it corresponds to the exact solution for Pe
18 (instead of 50).
The CDS solution exhibits severe oscillations.
The oscillations are due to the sudden change
of
If gradient
the in is
grid at the last two points (local
Pe=5).
refined (21
points), the CDS
oscillations are
reduced, but they
are still present.
The false diffusion
with UDS also
decreases with
3
mesh refinement
RD
D .. AJMAL
AJMAL SHAH,
SHAH, PIEAS
PIEAS
FINITE DIFFERENCE METHODS

After the second refinement (41 grid nodes),


the solution is oscillation-free and very
accurate as shown below.
The accuracy of the UDS solution has also
been improved by grid refinement, but it is
still substantially in error for x > 0.8.

4
D
DR.. AJMAL
AJMAL SHAH,
SHAH, PIEAS
PIEAS
FINITE DIFFERENCE METHODS

The CDS oscillations depend on the value of


the local Peclet number, Pe = pu x/.
No oscillations occur if the local Peclet
number is Pe 2 at every grid node.
This is a sufficient, but not necessary
condition for boundedness of CDS solution.
Hybrid scheme was designed to switch from
CDS to UDS at any node at which Pe 2.
Now we repeat the calculation using a
nonuniform grid with 11 nodes. The
smallest and the largest mesh spacings are;
xmin = XN - XN-I = 0.0125 and xmax = x2 -XI =
0.31,
The Pemin = 0.625 (<2) near right boundary,
5
and R D
D .. AJMAL
AJMAL SHAH,
SHAH, PIEAS
PIEAS
FINITE DIFFERENCE METHODS

The Pe is smaller than two in the region


where undergoes strong change and is
large in the region of nearly constant .
The calculated profiles on this grid using the
CDS and
There UDS schemes are shown in Figure
are no
below.
oscillations in the
CDS solution and is
as accurate as the
solution on a
uniform grid with
41 nodes.
The accuracy of the
UDS solution has
also been improved
6
by using a non- D . AJMAL SHAH, PIEAS
DR. AJMAL SHAH, PIEAS
FINITE DIFFERENCE METHODS

Write a computer program in C++/Fortran to


solve this example given in the book.
Keep mesh spacing variable.
No of mesh points variable.
Takes 0 , L , , u, , as inputs from the
user.
You may use Matlab for matrix solution.
Plot the results in Matlab/origion.
Submit in hard as well as in soft form.
Copy from each other is not allowed.
Submission date is 25th November.

7
D
DR.. AJMAL
AJMAL SHAH,
SHAH, PIEAS
PIEAS

You might also like