Exercises Computational Fluid Dynamics
General remarks
During the course several computer exercises have to be made. These exercises are to be
solved in pairs of one or two students. A (short) written report of the findings has to be
handed in the following week; discussion of the homework with other pairs of CFD students
is not allowed during that period.
All software required for the exercises is available by downloading the files from the Nestor
pages for this course:
Computational Fluid Dynamics > Course Information
An alternative is to download them from
[Link]
Exercise 1 Artificial diffusion
Files and commands Required files: cfd 1.m, cfd upw.m, ns exact.m
The program is started in Matlab with the command cfd 1.
Description
Consider the inhomogeneous convection-diffusion equation
d d2
k 2 =S on 0 x 1, with (0) = 0, (1) = 1.
dx dx
The right-hand side is given by
(
2 5x , 0 x 0.4,
S(x) =
0 , 0.4 < x 1.
In this exercise an upwind discretization of the above equation is applied. The discrete
solution for three values of the diffusion coefficient k is plotted in one picture. Also the exact
solution for one value of k can be included in this picture.
Questions
1. Firstly, study the discrete solution for a grid with N = 20 grid points, at the following
values of k: k = 0.1, 0.01 and 0.001. These values correspond with mesh-Peclet numbers
P = 0.5, 5 and 50, respectively. One would expect (or at least hope) that these solutions
tend to the (analytical) solution for k = 0. Hence, compare the discrete solutions to
the exact solution at k = 0 (ignore the Matlab warnings concerning division by zero).
What do you observe; is there any such relation?
1
2. Next, compare the same three discrete solutions at k = 0.1, 0.01 and 0.001 (again for
N = 20) to the exact solution at k = 0.025. Now, there seems to be some relation
between the upwind limit for k 0 and the exact solution at k = 0.025. Explain this
relation.
3. Finally, study once more the upwind solutions at k = 0.1, 0.01 and 0.001, but now
on a grid with N = 40 grid points. Which exact solution, i.e. at which value of k,
corresponds with the upwind limit for k 0?