@@ -47,7 +47,7 @@ subroutine setup_mesh_adjacency()
4747
4848 ! local parameters
4949 ! maximum number of neighbors
50- integer ,parameter :: MAX_NEIGHBORS_DIRECT = 50 ! maximum number of neighbors (for direct element neighbors)
50+ integer ,parameter :: MAX_NEIGHBORS_DIRECT = 80 ! maximum number of neighbors (for direct element neighbors only )
5151 integer ,parameter :: MAX_NEIGHBORS = 300 ! maximum number of neighbors (with neighbor of neighbors)
5252
5353 ! temporary
@@ -84,8 +84,8 @@ subroutine setup_mesh_adjacency()
8484 integer , dimension (:,:), allocatable :: node_to_elem
8585 integer , dimension (:), allocatable :: node_to_elem_count
8686 integer :: icount
87- integer , dimension (MAX_NEIGHBORS_DIRECT) :: elem_neighbors
88- integer , dimension (MAX_NEIGHBORS) :: elem_neighbors_of_neighbors
87+ integer , dimension (MAX_NEIGHBORS_DIRECT) :: elem_neighbors ! direct neighbors
88+ integer , dimension (MAX_NEIGHBORS) :: elem_neighbors_of_neighbors ! with neighboring element neighbors
8989
9090 ! user output
9191 if (myrank == 0 ) then
@@ -231,7 +231,7 @@ subroutine setup_mesh_adjacency()
231231 num_neighbors = num_neighbors + 1
232232
233233 ! check
234- if (num_neighbors > MAX_NEIGHBORS_DIRECT) stop ' Error maximum of direct neighbors exceeded'
234+ if (num_neighbors > MAX_NEIGHBORS_DIRECT) stop ' Error maximum of neighbors (direct) exceeded'
235235
236236 ! store element
237237 elem_neighbors(num_neighbors) = ispec
@@ -248,7 +248,7 @@ subroutine setup_mesh_adjacency()
248248 inum_neighbor = inum_neighbor + num_neighbors
249249
250250 ! checks
251- if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop ' Error maximum neighbors exceeded'
251+ if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop ' Error maximum of total neighbors exceeded'
252252
253253 ! adds to adjacency
254254 tmp_adjncy(inum_neighbor- num_neighbors+1 :inum_neighbor) = elem_neighbors(1 :num_neighbors)
@@ -302,6 +302,11 @@ subroutine setup_mesh_adjacency()
302302 if (is_neighbor) then
303303 ! adds to adjacency
304304 num_neighbor_neighbors = num_neighbor_neighbors + 1
305+
306+ ! check
307+ if (num_neighbor_neighbors > MAX_NEIGHBORS) stop ' Error maximum of neighbors (with neighbors) exceeded'
308+
309+ ! store element
305310 elem_neighbors_of_neighbors(num_neighbor_neighbors) = ispec
306311 endif
307312 enddo
@@ -314,7 +319,7 @@ subroutine setup_mesh_adjacency()
314319 inum_neighbor = inum_neighbor + num_neighbor_neighbors
315320
316321 ! checks
317- if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop ' Error maximum neighbors exceeded'
322+ if (inum_neighbor > MAX_NEIGHBORS * NSPEC_AB) stop ' Error maximum of total neighbors (with neighbors) exceeded'
318323
319324 ! adds elements
320325 tmp_adjncy(inum_neighbor- num_neighbor_neighbors+1 :inum_neighbor) = elem_neighbors_of_neighbors(1 :num_neighbor_neighbors)
0 commit comments