LadaF/PoisFFT

Numerical errors when running testmpi.f90 with multiple processors with MPI

s-amouyal12 opened this issue · 6 comments

Hi,

I am getting errors when solving a 2D domain in parallel with MPI. My code is based on your 'testmpi.f90', which is also attached here just to show that it wasn't something I introduced.

I am setting up a sine wave as my RHS as a benchmark case:
rhs = -2 sin(x) sin(y)
exact = sin(x) sin(y)

The solution is correct when including the PoisFFT_FiniteDifference2 flag in the Execute procedure for both serial and parallel computations. When removing the option and thus using the FFT solver, the results are only correct for serial computations and off by a factor of 2 for the parallel ones.

I am using gfortran with gcc 5.4.0 and Open MPI 2.0.1. For completeness, both my version (my_own.f90) and yours (testmpi.f90) are included with a Makefile.

Thanks,

Solal

Makefile.txt
my_own.f90.txt
testmpi.f90.txt

LadaF commented

Thank you for your report. I will have a closer look later this week. Just to be clear, the same solver is used no matter which flag do you supply. The only difference the PoisFFT_Spectral, PoisFFT_FiniteDifference2 and PoisFFT_FiniteDifference4 flags do is the choice of eigenvalues.

LadaF commented

I can reproduce your results with your code, but I have to do more tests to understand what is going on.

LadaF commented

This can indeed be a serious problem. I have done more tests, but now I have to make tests of the FFT procedures separately from the Poisson solver. Especially to test whether the PFFT library is correct and whether it is correct when called from C as well as when called from Fortran. I still don't know where the problem lies.

LadaF commented

I identified the bug and pushed a fix. It was simple sign error.

I downloaded your latest version, everything works as expected. Thanks!