0% found this document useful (0 votes)
26 views

Assign 1

This assignment involves writing a parallel Fortran program using MPI to solve a 2D advection-diffusion equation. Students are asked to discretize the PDE using finite differences, then use a red-black iterative solver to obtain the steady temperature field. The program must be tested on different grid sizes and processor counts to analyze accuracy and parallel efficiency.

Uploaded by

Vignesh K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Assign 1

This assignment involves writing a parallel Fortran program using MPI to solve a 2D advection-diffusion equation. Students are asked to discretize the PDE using finite differences, then use a red-black iterative solver to obtain the steady temperature field. The program must be tested on different grid sizes and processor counts to analyze accuracy and parallel efficiency.

Uploaded by

Vignesh K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

AMME5060 ADVANCED COMPUTATIONAL ENGINEERING

Assignment #1 Due 8 September 11.59pm; Weighting of %15


This assignment is estimated to take 14 hours to complete (if you have completed all other
tutorials and mini-assignments).

In this assignment you will write a parallel iterative solver using Fortran and MPI to solve a
simple two dimensional advection diffusion problem. The idealised two dimensional scenario
considered is shown in the figure 1.

ܶ = ݂(‫)ݔ‬

ܶ=0 ܶ=0
L

ܶ = െ݂(‫)ݔ‬
x

Figure 1: Solution domain with boundary conditions.

Here a fluid is heated by the upper boundary which is held at constant temperature (◦ C) defined
by the function,
f (x) = cos2 (2πx/Lx )
The lower boundary is defined by −f (x) as shown in the figure. The other boundary edges of
the domain are held at fixed temperatures of T = 0◦ C. The fluid has a spatially varying velocity
field with U (x, y) and V (x, y) velocity components being,

U (x, y) = sin(πx/Lx ) cos(πy/Ly ) + sin(2πx/Lx ) cos(2πy/Ly ),

V (x, y) = − cos(πx/Lx ) sin(πy/Ly ) − cos(2πx/Lx ) sin(2πy/Ly ).


The two dimensional steady diffusion equation for this problem is,

dT dT d2 T d2 T
αU + αV − 2 − 2 − βT = 0,
dx dy dx dy
where T is the temperature and the constants are α = 80, β = 0.5 and Lx = Ly = 1.

Your task is to obtain the steady temperature field for this problem i.e. find T (x, y). You are
required to obtain this solution by writing your own parallel Fortran program. Your program
should have the following attributes:

1. You should discretise the problem using a second order accurate centered finite difference
scheme to obtain the linear set of equations which you will solve.

1
2. Your solution algorithm should use the iterative Red-black linear solver (or Jacobi Solver
for -3 mark).

3. Your code should be written in Fortran and parallelised using the OpenMPI library.

4. Your parallel algorithm should use domain decomposition by partitioning your domain.
You should use non-blocking communication (or blocking comms for reduced marks).

5. The logical structure of your MPI code should be efficient. You should consider memory
layout when organising your communication.

6. Your algorithm should be flexible. It must be able to work on any number of processors
BUT you can place restrictions on use e.g. you can require that only certain numbers of
grid points can be used (e.g. only even numbers of points). This may simplify domain
decomposition. More flexible programs will receive more credit.

7. After obtaining a solution the program should print the value of the maximum temperature
in the domain to screen to 8 significant figures.

8. The code should gather all data to a single node and print off the solution data in a .tec
file for visualisation (use ParaView or VisIt or Tecplot to produce plots from this output).
A short piece of code is provided on the canvas site which will help with this (file called
Tec.f90), you may include this in your code. The MPI communication for the global gather
can be blocking.

You should test your code extensively and report on the accuracy of your solution and the
parallel efficiency of your code

1. Run the program on a range of grid sizes. Record the maximum domain temperature for
each simulation. For each simulation test the solver residual is sufficiently small.

2. Run the code in parallel on different numbers of cores (np = 1,2,..) using your home PC.
Repeat this test with different grid sizes. Determine the parallel efficiency for each grid
size and no. of cores. If running on your home computer, you may find parallel efficiency
is poor, this is normal.

3. NOTE: If your ∆x or ∆y is too large you may find your solution becomes unstable because
the Péclet number limit for the problem has been exceeded.

Submission and Reporting

1. You should write a short ∼ 4 page report presenting the results of your testing above. The
report should contain:

(a) Provide the discrete equations you solve


(b) Simple plots or tables which demonstrate the accuracy of your solution
(c) Simple plots or tables showing parallel efficiency with different grid sizes
(d) Your solution T (x, y) using a contour plots.

2. You will need to submit your Fortran code as a single .f90 text file. This file should
be extensively commented. The first comment in the file should contain instructions for
compiling and executing your program.

2
3. You need to preface your assignment submission with a short statement, in your own
words, that indicates you have read the University of Sydney requirements on academic
honesty and that all work submitted is your own. If you have taken any code from
another source or had assistance in writing your code you must in detail, exhaustively and
completely describe these sources and contributions. No assignment will be graded until
this statement is submitted.

3
Submission Check-list and Marking Guide:

Mark

Algorithm 3
Discrete equations are correct
Boundary conditions are correct
Iterative Solver algorithm is correct

Code : 9
Clearly commented with inputs clearly indicated
Red-black solver implementation is correct (or Jacobi -3 Mark)
Non-blocking MPI communication
Domain decomposition works for any number of processors
Paralellisation is efficient
Memory management is considered (not necessarily advanced)
Maximum domain temperature is obtained via collective communication
Write global temperature field to .tec file and produce contour plots

Report Presentation and Testing: 3


Final discrete equations are briefly presented
All results are discussed in text and explained
The solution is presented with neat plots, including a contour plot
All plots have figure captions, axis are labelled and referred to in the text
The accuracy of the method and solution is tested very well and discussed
Parallel efficiency is determined
The report is submitted as per the requirements listed below (.pdf file and .f90 file)
Preface indicating adherence to academic honesty as described above.

Final Note: We reserve the right to conduct an oral exam on any submitted work. This would
be used where there is reason to believe there is a breach of academic honesty requirements. In
these cases the oral exam grade would be implemented as a multiplier on the grade determined
using the marking scheme above.

4
Final Submission: There is no fixed page limit but I suggest 4 pages is sufficient for a concise
report.

The assignment files must be submitted through the course Canvas Site. Text-based similarity
detecting software (Turnitin) will be used to detect plagiarism.

You should submit two files:

i) Your Fortran code: lastname.f90 (you can submit multiple Fortran files if needed, give the
subsequent files sensible names)
ii) Your report as .pdf : lastnameSIDReport.pdf

There will be a submission portal for you to upload a single .zip file containing both files listed
above. The code will be run by the marker.

Important:
The report should be submitted as a pdf document only ( Microsoft word documents will
not be marked ).

Learning Outcomes:
The focus of this assignment is to assess the following learning outcomes:

LO5. Students will be able to apply advanced numerical methods to a range of complex engi-
neering problems. Students will be required to write their own software.

LO6. Students will become proficient in advanced numerical methods, their suitability and ap-
plication to numerical modelling of engineering problem.

This is achieved here by implementing a linear solver typical to large scale advanced engineering
computations (Red-Black linear solver) to solve a model engineering problem ( typical of steady
state in-compressible CFD calculations) and write efficient code using MPI which is typical of
that used in large scale computations and also in most engineering packages.

We also take steps towards LO2:


LO2. Students will have to engage with engineering standards for computational mechanics and
ensure their testing of their software meets these standards. This includes appropriate bench-
marking of solutions, professionally presenting these and indicating the range of applicability
for their solution
This is achieved by the requirement to extensively test the accuracy of your code and numerical
method (using grid independence and residual checks) and report on this in a concise way.

You might also like