I wrote the program using Fortran language and choose 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.f
As exesize I run program on 4 processors and for number of points along wave equal 10 and for different time steps. Results are summed here:
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
Home assignments:
See a project: