@@ -440,8 +440,11 @@ contains
440440 integer :: patch_id !< IB Patch ID
441441 integer :: dir
442442 integer :: index
443+ logical :: bounds_error
443444
444- $:GPU_PARALLEL_LOOP(private=' [q,gp,i,j,k,physical_loc,patch_id,dist,norm,dim,bound,dir,index,temp_loc,s_cc]' )
445+ bounds_error = .false.
446+
447+ $:GPU_PARALLEL_LOOP(private=' [q,gp,i,j,k,physical_loc,patch_id,dist,norm,dim,bound,dir,index,temp_loc,s_cc]' , copy=' [bounds_error]' )
445448 do q = 1, num_gps
446449 gp = ghost_points_in(q)
447450 i = gp%loc(1)
@@ -489,10 +492,10 @@ contains
489492 index = ghost_points_in(q)%loc(dim)
490493 temp_loc = ghost_points_in(q)%ip_loc(dim)
491494 do while ((temp_loc < s_cc(index) &
492- .or. temp_loc > s_cc(index + 1)))
495+ .or. temp_loc > s_cc(index + 1)) .and. (.not. bounds_error) )
493496 index = index + dir
494497 if (index < -buff_size .or. index > bound) then
495- #if !defined(' MFC_OpenACC' ) && !defined(' MFC_OpenMP' )
498+ #if !defined(MFC_OpenACC) && !defined(MFC_OpenMP)
496499 print *, "A required image point is not located in this computational domain."
497500 print *, "Ghost Point is located at :"
498501 if (p == 0) then
@@ -509,9 +512,10 @@ contains
509512 print *, "Levelset ", dist, " and Norm: ", norm(:)
510513 print *, "A short term fix may include increasing buff_size further in m_helper_basic (currently set to a minimum of 10)"
511514#endif
512- error stop "Ghost Point and Image Point on Different Processors"
515+ bounds_error = .true.
513516 end if
514517 end do
518+
515519 ghost_points_in(q)%ip_grid(dim) = index
516520 if (ghost_points_in(q)%DB(dim) == -1) then
517521 ghost_points_in(q)%ip_grid(dim) = ghost_points_in(q)%loc(dim) + 1
@@ -523,6 +527,8 @@ contains
523527 end do
524528 $:END_GPU_PARALLEL_LOOP()
525529
530+ if (bounds_error) error stop "Ghost Point and Image Point on Different Processors. Exiting"
531+
526532 end subroutine s_compute_image_points
527533
528534 !> Subroutine that finds the number of ghost points, used for allocating
0 commit comments