diff --git a/runtime/domain/regular_6d_stencil.hpp b/runtime/domain/regular_6d_stencil.hpp index 6414e4cb226452221285d0c6ce528986e398f1ed..ddff6e865a276a29c6cc9c071bd922395b4a114d 100644 --- a/runtime/domain/regular_6d_stencil.hpp +++ b/runtime/domain/regular_6d_stencil.hpp @@ -69,7 +69,7 @@ public: for(int d = 0; d < ndims; d++) { MPI_Cart_shift(cartesian, d, 1, &(this->prev[d]), &(this->next[d])); this->pbc_prev[d] = (myloc[d] == 0) ? 1 : 0; - this->pbc_next[d] = (myloc[d] == this->nranks[d]) ? -1 : 0; + this->pbc_next[d] = (myloc[d] == this->nranks[d] - 1) ? -1 : 0; this->subdom_min[d] = this->grid_min[d] + rank_length[d] * (real_t)myloc[d]; this->subdom_max[d] = this->subdom_min[d] + rank_length[d]; }