chksum_loc_interior Subroutine

private pure subroutine chksum_loc_interior(grid, loc, i0, i1, j0, j1)

Physical-cell index range for a grid-location tag: the ghost ring excluded. Face locations carry one MORE physical entry than cell centres in their staggered direction (an x-face array spans nx_phys + 1 faces), which is why LOC_U/LOC_Q extend i1 by one and LOC_V/LOC_Q extend j1.

A face on an MPI seam belongs to BOTH tiles’ ranges, so a tile whose west (south) edge is not the grid’s west (south) edge — global offset > 0 — drops its first face column (row): every face is then counted exactly once over the ranks, as on one rank, and the face bits are decomposition-invariant too. (A periodic seam face is counted twice — as the first and the last face — on EVERY decomposition alike.)

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
integer, intent(in) :: loc
integer, intent(out) :: i0
integer, intent(out) :: i1
integer, intent(out) :: j0
integer, intent(out) :: j1

Called by

proc~~chksum_loc_interior~~CalledByGraph proc~chksum_loc_interior chksum_loc_interior proc~rdb_debug_chksum_2d rdb_debug_chksum_2d proc~rdb_debug_chksum_2d->proc~chksum_loc_interior proc~rdb_debug_chksum_3d rdb_debug_chksum_3d proc~rdb_debug_chksum_3d->proc~chksum_loc_interior interface~rdb_debug_chksum rdb_debug_chksum interface~rdb_debug_chksum->proc~rdb_debug_chksum_2d interface~rdb_debug_chksum->proc~rdb_debug_chksum_3d proc~chksum_bt chksum_bt proc~chksum_bt->interface~rdb_debug_chksum proc~chksum_state chksum_state proc~chksum_state->interface~rdb_debug_chksum proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~chksum_state proc~run_stage_split run_stage_split proc~ocean_dyn_step_split->proc~run_stage_split proc~run_stage_split->proc~chksum_bt proc~run_stage_split->proc~chksum_state proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split

Source Code

   pure subroutine chksum_loc_interior(grid, loc, i0, i1, j0, j1)
      !! Physical-cell index range for a grid-location tag: the ghost
      !! ring excluded.  Face locations carry one MORE physical entry
      !! than cell centres in their staggered direction (an x-face array
      !! spans `nx_phys + 1` faces), which is why `LOC_U`/`LOC_Q` extend
      !! `i1` by one and `LOC_V`/`LOC_Q` extend `j1`.
      !!
      !! A face on an MPI seam belongs to BOTH tiles' ranges, so a tile
      !! whose west (south) edge is not the grid's west (south) edge —
      !! global offset > 0 — drops its first face column (row): every face
      !! is then counted exactly once over the ranks, as on one rank, and
      !! the face `bits` are decomposition-invariant too.  (A periodic seam
      !! face is counted twice — as the first and the last face — on EVERY
      !! decomposition alike.)
      type(hgrid_t), intent(in) :: grid
      integer, intent(in) :: loc
      integer, intent(out) :: i0, i1, j0, j1

      i0 = grid%nghost + 1
      j0 = grid%nghost + 1
      i1 = grid%nghost + grid%nx_phys
      j1 = grid%nghost + grid%ny_phys
      select case (loc)
      case (LOC_U)
         i1 = i1 + 1
         if (grid%i_offset_global > 0) i0 = i0 + 1
      case (LOC_V)
         j1 = j1 + 1
         if (grid%j_offset_global > 0) j0 = j0 + 1
      case (LOC_Q)
         i1 = i1 + 1
         j1 = j1 + 1
         if (grid%i_offset_global > 0) i0 = i0 + 1
         if (grid%j_offset_global > 0) j0 = j0 + 1
      case default
         ! LOC_H (and any unknown tag): plain cell-centre range, already set.
      end select
   end subroutine chksum_loc_interior