# CS计算机代考程序代写 chain High Performance Computing

High Performance Computing
Course Notes
Coursework 2
Dr Ligang He

Problem Domain

Coursework taken from the field of Computational Fluid Dynamics (CFD)
 Fluid dynamics based on three fundamental principles: (i) mass is conserved; (ii) Newton’s second law ;(iii) energy is conserved
 Expressed as partial differential equations, showing how velocity and pressure are related, etc. (called governing equations).
Computer Science, University of Warwick
2

Governing Equations
Computer Science, University of Warwick
3

Problem Domain
• Coursework taken from the field of Computational Fluid Dynamics (CFD)

 Fluid dynamics based on three fundamental principles: (i) mass is conserved; (ii) Newton’s second law ;(iii) energy is conserved
 Expressed as partial differential equations, showing how velocity and pressure are related, etc. (called governing equations).
 The coordinates and time are independent variables while velocity and pressure are dependent variables
Computational Fluid Dynamics is the science of finding the numerical solution to the governing equations of fluid flow, over the discretized space or time
Computer Science, University of Warwick
4

CFD code
The code in the coursework, called Karman, calculates the velocity and pressure of a 2D flow
The code writes the solution values into a binary file Currently the code is sequential
The purpose of the coursework is to parallelize the code
Computer Science, University of Warwick
5

Data and stencil
The area represented as a 2D Grid (discretize) Calculate one point in each cell
Computer Science, University of Warwick
6

CFD code
jmax
There are two types of cell: fluid (C_F) and obstacle (C_B)
Computer Science, University of Warwick
7

Data and stencil
• The properties of a cell in the grid
• Communication pattern: using a five-point stencil to
calculate a point
Computer Science, University of Warwick
8

Numerical method for solving the governing equations
Initialize each cell value
Check if the solution satisfies the governing equations
If not, generate the new solution based on a stencil of current solutions from neighbouring cells
Iterations are advanced until the termination condition is met
Computer Science, University of Warwick
9

General Steps for using the numerical method to solve the linear equations
 Aim: solve AΦ=B
 Step 1: Guess a initial solution Φ0
 Step 2: If the convergence is reached by checking the residual B-AΦi=0), Φ(i+1)= f(Φ(i)), go to Step 2 e.g., f(Φ(i))=Φ(i)+(B-AΦ(i))
 Key: when we repeat iterative steps, each step generates a better solution
Computer Science, University of Warwick
10

Successive Over-Relaxation(SOR)
 SOR is a method to generate new solutions: it can speed up convergence
 For a set of linear equations: AΦ=B
 let A=D+U+L, where D, L and U denote the diagonal, strictly lower
triangular, and strictly upper triangular parts of A, respectively
 The successive over-relaxation (SOR) iteration is defined by the following