The next example is more interesting than parallelPi. Our objective is to solve a two-dimensional diffusion PDE:
where u(x,y,t) is the temperature of the surface being modeled, and D is the so-called diffusion coefficient.
Let us choose as the surface a rectangular plate:
In this workshop, we will not worry about the exact solution (an infinite sum). Instead we will look at an approximate solution using a discrete grid. We don't bother about the real math because our objective is to learn parallel computing. In any case, the exact solution to the above equation is shown at the end of this page.
Going back to the rectangular place shown above, let us superimpose a computational grid upon the plate we are modeling:
which shows the numbering of the x and y grid indices i and j, respectively. The number of interior grid points in the x-direction is nni, in the y-direction nnj. The boundaries are i = 0, i = nni + 1, j = 0, and j = nnj + 1.
Each point in the grid can be computed using the following equation: (based on a finite-difference equation):
Let us call the expressions outside of the parentheses mu, c and nu. Using temperature at time step n, the temperature at time step n + 1 can be computed.
For the above finite-difference representation of the two-dimensional diffusion equation, we will have to consider a 5-point stencil that must be computed to obtain u_ij at the next time step. The stencil considers the closest neighbors (diagonal points are not considered because they are not the closest).
Just for information's sake, the exact solution for our 2-D diffusion equation with u = 0 boundary conditions and a uniform initial temperature Uo is:
| Previous: Computing PI using Parallel... | Up: Table of Contents | Next: Serial Numerical Solution |
|---|