Homework #7 Description: You are to design and write a C program utilizing pthre
ID: 3602063 • Letter: H
Question
Homework #7 Description: You are to design and write a C program utilizing pthreads to efficiently perform 2D Successive Over-Relaxation (SOR) (often used in 3D form to solve differential equations such as Navier-Stokes equations for fluid flow) 2D SOR Problem: Initially, the 2D-array val contains 0.0s everywhere, except for the 1.0s down column 0. On each iteration, SOR updates all interior values (i.e., only the white values in the diagram change with the gray boundary values being fixed) by the average of their four nearest neighbors: above, below, to the left, and to the right. Eventually after many iterations the values will stablize. We won't run to complete stablization, but just until the maximum value change across the whole array during an iteration is less than a user specified threshold (e.g., 0.0001) 1.0 00 0.0 0.0 00 0.0 1.0 0.0 0.0 00 00 0.0 1.0 0.0 0.0 0.0 00 0.0 1.0 00 0.0 00 00 00 1.0 0.0 0.0 00 00 0.0 1.0 0.0 00 0.0 00 0.0 r value Boundary value During an iteration use the 2D-array val to compute the updated values in a second 2D- array new. Before the next iteration, flip-flop and reuse these 2D-arrays. This is actually easy and efficient since val and new are really pointers to the arrays, so all we really need to do is swap their pointer vi ter values va new temp = new ; new val; val temp | You'l need to complete the pthread parallelization. The general steps are: * decide how to decompose the work among threads - keep in mind load balancing cache performance * decide how to synchronize the threads so all threads finish an iteration before any start the next iteration * decide how to synchronize the threads so all threads stop if the max. change at any spot during an iteration is less than the threshold * code the threadmain function run by all the threads * test and debug your programExplanation / Answer
Introduction, what is CFD, examples, computers,
elementary numerical analysis, course administration
Elementary numerical analysis, accuracy, stability,
partial differential equations
Review of fluid mechanics: the governing equations
Finite Difference solution of the
Navier
-Stokes
Equations in
vorticity
/
streamfunction
form
Finite Volume Approach, Solving the
Navier
-Stokes
Equations in Primitive Variables, the MAC Method
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.