辅导MEC4447-Assignment 3辅导Matlab编程
- 首页 >> Java编程MONASH UNIVERSITY
Department of Mechanical and Aerospace Engineering
MEC4447 — Computers in Fluids and Energy —
Assignment 3
Due Monday 8th June 5 pm through Moodle. (Do it much earlier if possible...)
It contributes 10% to the overall subject mark.
Submit modified Matlab code and writeup.
Solving the Navier-Stokes Equations in Streamfunction-Vorticity Form
to Predict Vortex Breakdown in a Cylindrical Container
The unsteady incompressible Navier-Stokes and continuity equations are
i,j + r∆Ψi,j, with r the relaxation parameter.
This defines a Gauss-Seidel update equation for Ψ, which can be used with SOR to iterate Ψ
given the current estimate of the vorticity field. Typically, this equation should be solved to
some convergence criterion at each timestep. In the code, the minimum number of iterations
is set to 5. That is, it completes at least 5 iterations to update Ψ before stepping forward
ωθ and uθ to the next timestep.
So, in summary a timestep consists of
5
• updating the Ψ field given the current vorticity field using SOR (only internal points
are updated since Ψ = 0 on the boundaries of the computational domain);
• then stepping forward the vorticity and azimuthal velocity to the next timestep using
the updated value of Ψ. Boundary conditions on ωθ (called vort in the code) are also
implemented during this update.
These two steps are repeated until the solution reaches its asymptotic state.
For the assignment you only need to fill in the update equation for uθ, which is similar in form
to equation 6, and then set other parameters such as the Reynolds number: Re = ΩR2/ν,
the physical dimensions: zlen = H and rlen = R, the relaxation parameter: relax , the
timestep: dt = ∆t, etc.
Program
You can download the template code from Moodle. You need to add some lines
defining the update equation for uθ and one of the ωθ boundary conditions. (These bits
are marked by ???? in the template). The rest should be OK. Please have a look at the
structure of the program to understand broadly how it works.
Note that the routine is supplied as a Matlab function rather than a script file (because
often this makes the code run much faster). However, make sure you are running the latest
version of MATLAB. Older versions can be very much slower...
You can call the routine by name (typing cyl cavity time in the command window - as long
as the file is in your matlab path) or just load it and run it.
You should supply the arguments required.
These arguments include:
• the number of cells in z and r: nz, nr;
• the domain size in z and r: zlen, rlen;
• the Reynolds number: re;
• the relaxation parameter for the Ψ equation: relax;
• the convergence criteria: eps psi, eps omega, eps ut;
• the timestep: dt;
To call the program as a function, supply (name, value) pairs as the arguments.
6
For example, typing
cyl cavity time(’re’, 1000, ’nz’, 60, ’nr’, 60, ’relax’, 1.5, ’dt’, 0.05);
calls the function with the values: re=100, nz=60, nr=60, relax=1.5, dt = 0.05.
Alternatively, just change the values directly in the program and rerun it.
Note that there is a primitive restart facility. After running through a case, the fields are
saved and can be used to restart the next run by changing the restart parameter to 1. If you
alter the grid size, Matlab kindly interpolates the old solution onto the new grid for you.
Note that the maximum timestep is controlled by both a Courant condition and a diffusion
condition. For fine grids you may need to use a smaller timestep to get the timestepping to
work.
Other parameters not specified are taken as default values defined at the top of the function.
The defaults are: eps psi=0.000001, eps omega=0.000001, eps ut=0.000001, nz=60, nr=60,
re=1000, zlen=2.5, rlen = 1.0, Ω = 1.
The Project
1. Use the streamfunction vorticity formulation to find the maximum and minimum
streamfunction for Re = 1994. Do a grid resolution study. Explain how you have
ensured that the predictions are accurate to within 2%. Supply images of the con-
verged streamfunction, azimuthal vorticity and azimuthal velocity fields. [2 marks].
2. Run the model at Re = 2765. In this case, the solution is periodic. Determine the
period of oscillation to within 2%. Again explain how you did this. (Note you should
be able to get the period to within sufficient accuracy from the convergence history
plot). [2 marks].
Project Writeup
I want a short report containing the following information.
• Derivation of the finite-difference equation for uθ, finally expressed as an update equa-
tion for uθ at the new timestep. (You can write this by hand and photograph them to
include in your writeup) [2 marks].
• Final Matlab program (submitted through Moodle) [2 marks].
• Brief answers to the questions above.
• Discretionary [2 marks] for the writeup.
A standard reference for this problem is
(1) Lopez, J. M., Axisymmetric vortex breakdown. Part I: Confined swirling flow. Journal
of Fluid Mechanics, 221, 533-552, 1990. (Copy on Moodle page).