Count LEDGE cells: a cell that is LIVE at layer k but all four
of whose own-layer faces are closed, i.e. water the mask has
isolated. A ledge needs a one-cell-wide spike in the bed or the
draft; it is inert by construction (no flux in or out, and its
velocity is zeroed every stage), but a non-zero count is worth
saying out loud once at configure, because it means the mask is
walling off real water.
Interior cells only (2:nx-1, 2:ny-1) — the ghost ring has no
four-face neighbourhood of its own.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | open_u(nx+1,ny,nz) | |||
| real(kind=wp), | intent(in) | :: | open_v(nx,ny+1,nz) | |||
| real(kind=wp), | intent(in) | :: | target_h(nx,ny,nz) | |||
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny | |||
| integer, | intent(in) | :: | nz | |||
| real(kind=wp), | intent(in) | :: | h_vanished |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | k |
pure function ocean_vcoord_count_ledges(open_u, open_v, target_h, & nx, ny, nz, h_vanished) result(n_ledge) !! Count LEDGE cells: a cell that is LIVE at layer `k` but all four !! of whose own-layer faces are closed, i.e. water the mask has !! isolated. A ledge needs a one-cell-wide spike in the bed or the !! draft; it is inert by construction (no flux in or out, and its !! velocity is zeroed every stage), but a non-zero count is worth !! saying out loud once at configure, because it means the mask is !! walling off real water. !! !! Interior cells only (`2:nx-1`, `2:ny-1`) — the ghost ring has no !! four-face neighbourhood of its own. integer, intent(in) :: nx, ny, nz real(wp), intent(in) :: open_u(nx + 1, ny, nz) real(wp), intent(in) :: open_v(nx, ny + 1, nz) real(wp), intent(in) :: target_h(nx, ny, nz) real(wp), intent(in) :: h_vanished integer :: n_ledge integer :: i, j, k n_ledge = 0 do k = 1, nz do j = 2, ny - 1 do i = 2, nx - 1 if (target_h(i, j, k) <= h_vanished) cycle if (open_u(i, j, k) == 0.0_wp .and. & open_u(i + 1, j, k) == 0.0_wp .and. & open_v(i, j, k) == 0.0_wp .and. & open_v(i, j + 1, k) == 0.0_wp) then n_ledge = n_ledge + 1 end if end do end do end do end function ocean_vcoord_count_ledges