Project Assignment 2 - 2023
Project Assignment 2 - 2023
Project Assignment 2 - 2023
Project Instructions:
1. This project contains two problems and is to be done in groups of 10-15 students
and carries 50 points.
2. You are required to submit a well written report including all the steps used in
handling the problems, source code and executable files of the project.
3. This project is due on Monday 5th of June 2023 at midday.
4. Submit the files as C++ source code and the executables through MUELE.
5. The documents should be zipped and the file named as
project2_group_names.zip.
6. One member should submit on behalf of each group.
80 80 80 80 95
At each time step, the temperature in each interior cell (i,j) will be the average of four
of its surrounding neighbours: T(i,j) = (T(i-1,j) + T(i+1,j) + T(i,j-1) + T(i,j+1))/4
a) Part 1
Declare 2 separate two-dimensional arrays named temp and old. Array old will
be used to maintain the current values of the grid temperatures and array
temp will be used to compute the new values obtained at each successive
time step using the equation above.
Prompt the user and enter temperature values for the top, bottom, left, right
sides. Also prompt and enter an initial temperature T(i,j) for the interior cells. (For
this lab, you may initialize all the interior cells to a single, user-input
temperature.)
Initialize temp using these values and display the initial contents of the temp
array on the console.
Obtain a convergence criterion from the user (say, 0.001)
Use a convergence loop to continue updating the temp array until the
temperature in every cell converges using the following method:
1. Set a boolean variable named steady to true
2. Copy temp to old
3. Loop over all the interior cells (but not the edge cells!)
temp[i][j] = 0.25*(old[i][j-1] + . . .)
if |temp[i][j] – old[i][j]| > convergence_criterion,
then set steady to false
Repeat this 3-step process again and again until all the cells simultaneously satisfy the
convergence criterion.
b) Part 2
Modify your program so that the final temperature data can be written to a file
named temp.dat instead of (or in addition to) the terminal screen.
An in-memory database (not required to save data to files) in which the user can
enter/modify/view records. For instance, you might make:
A database of Mechanical Engineering Students (Year 1 to 4) at CEDAT, the
classes they take, etc., allowing adding, removing students, etc.
Further Requirements
Your project should be large enough to take about 10-20 hours of coding.
You may not use external libraries (e.g. for graphical interfaces) but stick to
a text interface.
It is very important that you write easily readable, well designed code.
Include a README file, with some documentation and instructions on how
to use your program. Also, this README file should include the problems you
had with your project, what challenges, and what you have done
differently if you could do it again.
2