Assignment-5

by Erdenebayar Dambasuren

Solving the Wave Equation in Java-MPI

I rewrote the program of assignment-4 using c and Java language with same static initial conditions, described by function:

    f(x) = H*x,       if x<=0.5
    f(x) = H*(1-x),   if x>0.5

The source code is here:

wave_eq_MPI.c

Wave_Eq_MPI.java

As exesize I run both programs on 4 processors and for number of points along wave equal 10 and for different time steps. Results are exactly same as in assignment-4:

 time  |                        poits along wave 
 steps |    1      2      3      4      5      6      7      8      9     10
  n=0  |  0.091  0.182  0.273  0.364  0.455  0.455  0.364  0.273  0.182  0.091
  n=5  |  0.091  0.182  0.271  0.343  0.354  0.354  0.343  0.271  0.182  0.091
  n=10 |  0.090  0.173  0.222  0.217  0.212  0.212  0.217  0.222  0.173  0.090
  n=15 |  0.066  0.092  0.076  0.075  0.078  0.078  0.075  0.076  0.092  0.066
  n=20 | -0.033 -0.062 -0.060 -0.057 -0.060 -0.060 -0.057 -0.060 -0.062 -0.033
In order to view this result I wrote java applet, which runs same code and displays the result:

Source code: Wave_Eq_View.java

Home assignments:

Assignment-1

Assignment-2

Assignment-3

Assignment-4

Assignment-6

See a project:

Project