From 4018cb975abf3e72c2156366962c9dff7e9e961b Mon Sep 17 00:00:00 2001 From: danieljvickers Date: Wed, 17 Jun 2026 15:54:49 -0400 Subject: [PATCH] Fixed an edge case in periodic bounds checking for neighborhood size where the beginning and ending of a domain would be equal to each other --- src/simulation/m_start_up.fpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 4651133b83..6bb59e7a64 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -1494,6 +1494,13 @@ contains call MPI_SENDRECV(end_val, 1, mpi_p, send_neighbor, ${TAG + 1}$, recv_val, 1, mpi_p, recv_neighbor, & & ${TAG + 1}$, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end_val = recv_val + + ! protect from looping back around on yourself multiple times + if (f_approx_equal(beg_val, ${X}$_cb(${DIM}$)) .or. f_approx_equal(end_val, ${X}$_cb(-1))) then + beg_val = -huge(0._wp) + end_val = huge(0._wp) + exit + end if end do neighbor_domain_${X}$%beg = beg_val neighbor_domain_${X}$%end = end_val