Assignment 5 -- The second MPI assignment

Solving the Wave Equation in MPI

This assignment is quite similar to assignment 4 except that if you have used C/MPI for assignment 4, you need to use Java/MPI for this one.

Let us consider the problem of a vibrating string which has fixed end points. The time dependent motion of the string is represented by the partial differential equation:

1/c2 * (partial2 * psi) / (partial * t2) - (partial2 * psi) / (partial * x2) = 0

This problem is described in Chapter 5 of the book Solving Problems on Concurrent Processors, Volume 1 by Fox et al.

The solution of this equation psi(x,t) is the vibration amplitude of the string expressed as a function of the x position of the string and time t. If we give an initial position and velocity of the string as a function of x, then we can solve the equation to find the position of the string at any time t.

Let us assume that the string stretches over the interval from 0 to 1 in the x direction, and that the ends are anchored at amplitude 0. To solve this problem numerically, we choose uniform intervals delta x and delta t, of space and time. Then for each point i along the x direction, we can derive a scheme for computing the value of the amplitude at each time step. This assumes that we are computing the value at a new time step (t + delta t)(let's call this t+1) where we already know the values at the current time step t and the previous time step (t - delta t)(let's call it t-1):

psii(t+1)= (2 * psii(t)) - psii(t-1) + tau2 [psii-1(t) - (2 * psii(t)) + psii+1(t)]

where tau = c * (delta t / delta x)

To set up this problem for MPI, you should choose N, the number of points in the discretization of the x direction. If the total x interval is from 0 to 1, this determines delta x as 1/(N-1), and position i as i/(N-1). You can choose time units so that delta t is 1. The units for the string equation can also be chosen so that the constant c is 1.

This is set up to be a one-dimensional problem, so you can divide up the points among the processors, so each processor is computing psi for N/NumProcs points. You will need arrays to record the values of the points at the various time steps. Then note the equation for point i also requires you to know the value of point i-1 and point i+1. Except for the global left and right endpoint which remains fixed at psi = 0, this leads to the following algorithm for each processor:

  1. Initialize starting values for time steps 1 and 2.
  2. Identify left and right neighbor processors.
  3. For each time step
    { exchange end values with neighbors;
    perform update psii(t) -> psii(t+1) }
  4. Send resulting values at final time step to one "control" processor, say processor 0, which will print out all results showing the position of the string at the final time step.

Due Date

Tuesday, November 18, 1997. Please try to work on it as soon as possible.

References

MPI functions you need to know

Send any questions to saleh@npac.syr.edu.

Last modified: Thu Nov 13 12:35:18 EST 1997