LadaF / PoisFFT

Free parallel fast Poisson solver. Requires FFTW3 and optionally PFFT.
Other
55 stars 18 forks source link

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

Closed s-amouyal12 closed 7 years ago

s-amouyal12 commented 7 years ago

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 7 years ago

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.

s-amouyal12 commented 7 years ago

Ha, that indeed makes more sense. I'm looking forward to your response.

Also, thanks for this library. I've been using it for a unstable case, where both iterative and multigrid methods made my code blow up but your solver seems to do the trick! (only when using the PoisFFT_Spectral option though). I just tried using (and looking for) PoisFFT_FiniteDifference4, it does not seem to be included in the library.


Solal Amouyal

On Wed, Sep 13, 2017 at 4:08 PM, LadaF notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LadaF/PoisFFT/issues/4#issuecomment-329162220, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpQrNSqKjHpmP_yqpPZLvEdz4U5_lR-ks5sh9PogaJpZM4PUYtK .

LadaF commented 7 years ago

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

LadaF commented 7 years ago

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 7 years ago

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

s-amouyal12 commented 7 years ago

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