Commit b4e8f6e1 authored by Daniel Wortmann's avatar Daniel Wortmann

Bugfix in parallel construction of step-function

parent 559f41d0
......@@ -140,6 +140,11 @@
!
! --> set up stepfunction on fft-grid:
!
#ifdef CPP_MPI
ALLOCATE ( bfft_local(0:ifftd-1), ufft_local(0:ifftd-1) )
bfft_local = 0.0
ufft_local = 0.0
#endif
ALLOCATE ( bfft(0:ifftd-1) )
im1=CEILING(1.5*stars%mx1); im2=CEILING(1.5*stars%mx2); im3=CEILING(1.5*stars%mx3)
......@@ -173,13 +178,13 @@
i3_start = 0
i3_end = im3
#ifdef CPP_MPI
chunk_size = im3/mpi%isize
leftover_size = modulo(im3,mpi%isize)
chunk_size = (im3+1)/mpi%isize
leftover_size = modulo(im3+1,mpi%isize)
IF (mpi%irank < leftover_size ) THEN
i3_start = mpi%irank * (chunk_size + 1)
i3_end = (mpi%irank + 1) * (chunk_size + 1) - 1
i3_start = mpi%irank * chunk_size
i3_end = (mpi%irank + 1) * chunk_size - 1
ELSE
i3_start = leftover_size * (chunk_size + 1) + (mpi%irank - leftover_size) * chunk_size
i3_start = leftover_size * chunk_size + (mpi%irank - leftover_size) * chunk_size
i3_end = (i3_start + chunk_size) - 1
ENDIF
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment