You are on page 1of 9

THE UNIVERSITY OF MELBOURNE

DEPARTMENT OF MECHANICAL ENGINEERING


MCEN90008 Fluid Dynamics 2016
ASSIGNMENT FOR POTENTIAL FLOW

Instructions:
Assignment to be handed in by 23:59 on Friday 16th September 2016.
This assignment should be done in groups of 2 students. Both students

in the group will get the same mark for this assignment. If you choose
to do the assignment alone, no concession will be given. Your assignment
will be marked the same as an assignment done by two students.
Please choose your group partner carefully.
Only hand in one assignment per group.
You can either use the C programming language or MATLAB to do this

assignment. If you should decide to write your computer program in


MATLAB, you are not allowed to use the streamline, odexx or similar
functions in MATLAB i.e. you need to write the program to solve the
ordinary dierential equations yourself and not simply use the functions
in MATLAB. Also do not merely use the contour function of to visualise
streamlines. The aim of this assignment is for you to produce a set of tools
to enable you compute the coordinates of pathlines.
When you submit your assignment, please include
Copies of all computer programs.
Written documentation with computer generated graphs and sketches.

This documentation must contain all discussions and all the exercises
that you were asked to do in the main part of this assignment.
Marks will be deducted for incorrect or absent axis labels.
For your plots please have equal scaling along each axis (this is achieved

by setting daspect([1 1 1]) In Matlab).

1. (Total marks for question = 26) In order to write a computer code to sketch streamlines, it
is best to rst start by writing a computer program to solve a simple problem. Make sure you get
this question right. For the later parts of this assignment you will build on the computer program
which you have written here to study much more complex ows.
(a) Write down the analytical solution to the following ordinary dierential equation (ODE)
dx
x
=
dt
4

(1)

with the initial condition


x=8

at

t = 0.

(2)
(1 Mark)

(b) Write a computer program to solve Eq. (1) using Eulers (EU) and the 4th order Runge Kutta
(RK-4) method (see the appendix for more information on EU and RK-4). Solve the equation
from t = 0 to t = 5. Perform your computations with various step sizes, (h = 1, 0.1, 0.01), and
tabulate your results in the table shown below

t
1.0
2.0
3.0
4.0
5.0

Analytical answer

h=1

EU
h = 0.1

h = 0.01

h=1

RK-4
h = 0.1 h = 0.01

The output from your computer program must approach the analytical answer as h gets
smaller. Which is the more accurate numerical method? EU or RK-4?
(5 Marks)
(c) Write down the analytical solution to the following set of coupled ODE
dx
dt
dy
dt

= 3x 5y
= 5x + 3y

(3)

You are given that at time, t = 0


{

x
y

{
=

1
4

}
.

(4)
(3 Marks)

(d) Extend your program from part (1b) so that it can solve the set of equations given by Eq. (3)
for 0 t tf . Use tf = 2. Check your program by completing the table below for both x and
y. To save time in future questions, you should try to write your program such that you can
easily change the set of equations f (x, y) and g(x, y) as dened in the Appendix.

t
0.4
0.8
1.2
1.6
2.0

Analytical answer

h = 0.1

EU
h = 0.01

h = 0.001

h = 0.1

RK-4
h = 0.01

h = 0.001

(8 Marks)
2

Which is the more accurate numerical method? Use the more accurate numerical method in
ALL subsequent parts of this assignment.
(e) Plot y vs x for h = 0.1, h = 0.01 and h = 0.001 for both EU and RK-4 with tf = 2. Plot
the EU and RK4 calculations on separate gures. Should the lines join up? Do the lines join
up?
(3 Marks)
(f) From your analytical solution, what is the value of tf such that when you plot y vs x, the
streamline exactly returns to the initial conditions (i.e. there is no gap or doubling up)?
(1 Marks)
(g) Use your computer program to plot the streamline pattern for the ow described by Eq. (3)
i.e. plot y vs x for a set of initial conditions. You should modify your program such that
you can pass it a number of starting positions xs and ys , the time step h and total time of
integration tf . In matlab, this could be achieved by writing your program as a function where
you pass the variables xs and ys (which could be vectors) and tf and h. This function would
then be used as follows,
[xr yr] = my_streamline_function(xs, ys, tf, h)
where xr and yr are the returned coordinates (matrices) of the streamline and xs and ys are
the start locations,
xs = [2 3 4 5 6 7];
ys = [0 0 0 0 0 0];
For non-matlabers, your program could read an input le where the rst line contains the
number of streamlines, Nl , the time of integration tf and the time step h. The subsequent Nl
lines in the input le should contain the location of the initial points of the streamlines, (x0i
y0i ). For example, the input le to draw two solution trajectories that start from (0, 1) and
(2, 0) with h = 0.02 and 0 < t < 2 will look something like,
2
0.0
2.0

2 0.02
1.0
0.0
(5 Marks)

2. (Total marks for question = 13) In lectures, it was demonstrated that using the method of
images, the ow of smoke from smokers (modelled as a source) in a room with a suction fan
(modelled as a sink), can be modelled by the following stream function

Qs
(x, y) =
arctan
2

y ls
x

Qs
+
arctan
2

y + ls
x

Qe

arctan
2

y le
x

Qe

arctan
2

y + le
x

)
.
(5)

Here the subscript s refers to the smokers (source), and the subscript e to the extraction fan (sink).
The fan is placed le from the oor directly above the smokers (who have height ls ). The fan has
strength Qe and the strength of the source is Qs .
The velocity components associated with the above stream function shown in Eq. (5) are,

dx
Qs
u(x, y) =
=
dt
2

x
x
+ 2
x2 + (y ls )2
x + (y + ls )2

Qe

x
x
+ 2
x2 + (y le )2
x + (y + le )2

)
(6)

dy
Qs
v(x, y) =
=
dt
2

(y ls )
(y + ls )
+ 2
x2 + (y ls )2
x + (y + ls )2

Qe

(y le )
(y + le )
+ 2
x2 + (y le )2
x + (y + le )2

)
(7)

(a) Use your computer program written in Question 1 and sketch the ow pattern given by Eqs.
(6) and (7). You can assume that le = 4, ls = 1.5, Qs = 2 and Qe = 4. Again, your program
should accept an input that gives the start positions in x and y for the streamlines, the time
step and the time of integration. As a starting point, use a time-step h = 0.01
Please start your streamlines in sensible places to really show the important ow features.
To begin with I suggest 20 starting positions around the smokers at radius = 0.1, equally
spaced in the azimuthal direction. Also add other streamlines coming from the right, left and
top of your gure. You may wish to add other streamlines to best represent the entire oweld
For 10 radially spaced positions about the smokers
x
0.5000
0.4045
0.1545
-0.1545
-0.4045
-0.5000
-0.4045
-0.1545
0.1545
0.4045
0.5000

y
1.5000
1.7939
1.9755
1.9755
1.7939
1.5000
1.2061
1.0245
1.0245
1.2061
1.5000

There are singularities at the center of the source and sink. You will need to add some error
trapping to catch these. One method is to check the radial distance from the sink, and if this
position is less than some threshold (say r = 0.1), set the u and v to zero. This will prevent
your pathline from reaching the singularity (provided your timestep is small enough!!)
rs = sqrt(x.^2 + (y-le).^2);
dxdt((rs<0.1)) = 0;
dydt((rs<0.1)) = 0;
(8 Marks)
(b) Derive analytical expressions for the location of all of the stagnation points in the ow.
Plot all separatrix lines onto your diagram. What is the safe distance for the non-smoker?
ghost
(5 Marks)
3. (Total marks for question = 11) After carefully designating a safe distance for the non-smoker,
someone comes along and opens the window by a tiny amount, believing that this will help. A very
gentle 0.05 ms1 uniform breeze is imposed in the negative x direction.
(a) Write out the new expression for the stream function and the u and v velocity components.
(2 Marks)
(b) Assuming the same Qs , Qe , le and ls use your code to plot the new streamline pattern. Again,
marks will be given for starting streamlines in places that allow us to best visualise the ow.
(4 Marks)
(c) Write out expressions for the stagnation points at x on the oor. Solve this equation by any
means to nd the stagnation point location (these expressions may not be solvable analytically).
Plot the stagnation points and lines of separatrix on your streamline gure. Compare the new
safe distance for a non-smoker downwind of the smokers.
(5 Marks)
4. (Total marks for question = 36).
Consider a doublet in uniform ow with circulation, for which the complex potential function is,
) ( 2)
(
a i
a2
log(z)
w = U z +

z
z 2
|
{z
} |
{z
}
cylinder flow

potential vortex

It will be much easier for this question if you work in the complex plane, this may require some
modication of your codes.
(a) If a = 1, U = 1 and = aU , plot the streamlines for this ow. Also plot the surface of
the cylinder, stagnation points and any separatrix lines.
(4 Marks)
We are going to move towards a Joukowski transformation of
this cylinder ow. We eventually wish to get the ow for a
symmetrical airfoil at an angle-of-attack of = 10 .
This involves 4 transformations.
Rotation (to get angle of attack over cylinder)
Bodily shift
Jowkowski transformation
Rotation (to ensure horizontal freestream)
We will rst perform these transformations one at a time.
(b) Rotate the original ow plotted in part (a) using the following transformation (to obtain the
angle of attack),
z1 = ei z
Plot the results (including cylinder, streamlines and separatrix).

(4 Marks)

(c) Next we need to shift the location of the cylinder center such that the cylinder just touches
the Jowkowski circle (which has a radius 0.95). Since at this stage we just require a symmetric
airfoil, we only shift the real part of z.
z2 = z1 + x0 + iy0
where x0 and y0 are the desired new location for the center of the cylinder.
Plot the results in the z2 plane (including cylinder, streamlines, separatrix and the Jowkowski
circle).
(2 Marks)
(d) The point at which the cylinder just touches the Jowkowski circle will eventually become the
sharp trailing edge of the airfoil. The Kutta-Jowkowski condition states that,
A body with a sharp trailing edge which is moving through a uid will create about
itself a circulation of sucient strength to hold the rear stagnation point at the trailing
edge.
Derive an expression to alter the circulation in the z plane such that this condition is met.
Replot the results (including cylinder, streamlines, separatrix and the Jowkowski circle) in the
z2 plane with the new determined value of .
(5 Marks)
(e) The next step is to apply the Jowkowski transform,
z3 = z2 +

b2
z2

and then rotate the ow to ensure that we have horizontal freestream velocity in the far
upstream of the airfoil.
z4 = z3 ei
Plot the results in the z4 plane, including the transformed cylinder (now a Jowkowski airfoil),
streamlines and separatrix. Note, if your rear stagnation point is not on the sharp trailing edge
of the airfoil, you have not set the circulation correctly in part (d) and you should reattempt.
ghost ghost ghost
(5 Marks)

(f) Show that since U = 1, the pressure distribution around the Jowkowski airfoil can be written
as,
Cp = 1 VJ2
where VJ is the magnitude of the velocity on the surface of the Jowkowski airfoil. The velocity
on the surface of the airfoil can be found from the following,


dw


VJ =
dz4
dw
dw dz dz1 dz2 dz3
=

dz4
dz dz1 dz2 dz3 dz4
Where dw
dz is the velocity on the surface of the cylinder in the z plane. Write out expressions
for each of the terms on the right-hand side of the above equation. Plot Cp vs x4 for the
Jowkowski airfoil. Please submit with your report any computer programs used to calculate
Cp .
(8 Marks)
(g) To produce a cambered Jowkowski airfoil, all we need to do is add a y shift to transformation
2. By considering the geometry, show that in this case, in order to meet the Kutta-Jowkowski
condition, we must locate the stagnation points at,
(
)
y0
= + arctan
where
a2 = (b + x0 ).2 + y02
b + x0
in the original z plane. Plot the resulting streamlines, transformed cylinder and separatrix
lines in the z4 plane for x0 = 0.0450, y0 = 0.0999, b = 0.95. Note, if your rear stagnation
point is not on the sharp trailing edge of the cambered airfoil, you have not set the circulation
correctly in the z plane.
(8 Marks)
(TOTAL MARKS AVAILABLE FROM ALL QUESTIONS = 86)

Appendix: Numerical solution to ordinary dierential equations


Consider the following ordinary dierential equation,
d
x(t) = f (x).
(8)
dt
If f (x) is a relatively simple function, then one can obtain exact solution to Eq. (8) using analytical techniques which you should have learnt in your maths course. However, when f (x) is a complicated function,
one needs to use a computer and numerical algorithms to approximate the solution to Eq. (8). There
are many numerical algorithms that can be used to approximate the solution to an ordinary dierential
equation. In this assignment, you are asked to explore the use of two popular methods, Eulers method
and the 4th order Runge-Kutta method (for more information about these methods, see references [1],
[2] and [3]). The formula for both methods are
Eulers method:
xn+1 = xn + hf (xn )
4th order Runge-Kutta:
(
xn+1 = xn +

)
1
1
1
k1 + (k2 + k3 ) + k4 h
6
3
6

where

k1
k2
k3
k4

= f (xn )
(
)
h
= f xn + k1
2
(
)
h
= f xn + k2
2
= f (xn + hk3 )

where xn is the approximate value of x(t = tn ) where tn = nh. h is the time step that you choose for the
simulation. Generally, the smaller the value of h, the numerical solution that you obtain is more accurate
and stable.

If you are asked to solve a system consisting of a set of coupled ordinary dierential equations
d
x(t) =
dt
d
y(t) =
dt

f (x, y)
g(x, y),

the approximate numerical solution can be obtained using the Euler and 4th order Runge-Kutta methods.
The relevant formulae are
Eulers method:

xn+1

= xn + f (xn , yn )h

yn+1

= yn + g(xn , yn )h

4th order Runge-Kutta method:


(

xn+1
yn+1

)
1
1
1
k11 + (k21 + k31 ) + k41 h
6
3
6
(
)
1
1
1
= yn +
k12 + (k22 + k32 ) + k42 h
6
3
6
= xn +

where the approximated solution of x(t = tn ) and y(t = tn ) are denoted as xn and yn respectively. kij is
calculated as follows

k11
k12

k21
k22

k31
k32

= f (xn , yn )
= g(xn , yn )

(
)
h
h
xn + k11 , yn + k12
2
2
(
)
h
h
= g xn + k11 , yn + k12
2
2
= f

(
)
h
h
= f xn + k21 , yn + k22
2
2
(
)
h
h
= g xn + k21 , yn + k22
2
2

and

k41

= f (xn + hk31 , yn + hk32 )

k42

= g (xn + hk31 , yn + hk32 )

References
[1] Atkinson, K., Elementary Numerical Analysis, John Wylie & Sons, 1985.
[2] Chapra, S. C. and Canale, R. P., Numerical Methods for Engineers, McGraw-Hill, 2002.
[3] Kreyszig, E., Advanced Engineering Mathematics, John Wylie & Sons, 1993.

You might also like