Fill ghost faces of a 3D x-face field (e.g. u_face_x_layer).
nx_face = nx_total + 1. no_wait (optional): see
ocean_periodic_wrap_centre_3d — batched async(1), sync once at the
caller. Not pure (async/wait directives).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_face,ny_total,nz) |
x-face field, shape (nx_total+1, ny_total, nz). |
||
| integer, | intent(in) | :: | nx_face | |||
| integer, | intent(in) | :: | ny_total | |||
| integer, | intent(in) | :: | nz | |||
| integer, | intent(in) | :: | nx_phys | |||
| integer, | intent(in) | :: | ny_phys | |||
| integer, | intent(in) | :: | nghost | |||
| logical, | intent(in) | :: | wrap_x | |||
| logical, | intent(in) | :: | wrap_y | |||
| logical, | intent(in), | optional | :: | no_wait |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | i_e | ||||
| integer, | private | :: | i_w | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | k | ||||
| logical, | private | :: | lwait |
subroutine ocean_periodic_wrap_face_x_3d(fld, nx_face, ny_total, nz, & nx_phys, ny_phys, nghost, & wrap_x, wrap_y, no_wait) !! Fill ghost faces of a 3D x-face field (e.g. u_face_x_layer). !! nx_face = nx_total + 1. `no_wait` (optional): see !! `ocean_periodic_wrap_centre_3d` — batched async(1), sync once at the !! caller. Not `pure` (async/wait directives). integer, intent(in) :: nx_face, ny_total, nz, nx_phys, ny_phys, nghost real(wp), intent(inout) :: fld(nx_face, ny_total, nz) !! x-face field, shape (nx_total+1, ny_total, nz). logical, intent(in) :: wrap_x logical, intent(in) :: wrap_y logical, intent(in), optional :: no_wait integer :: i, j, k integer :: i_w, i_e logical :: lwait lwait = .true. ! default: blocking (wait) — safe for non-batched callers if (present(no_wait)) lwait = .not. no_wait i_w = nghost + 1 i_e = nghost + nx_phys + 1 ! Two-pass: X-wrap (+ belt-and-braces) first, Y-wrap second. !$acc kernels async(1) if (wrap_x) then do concurrent(k=1:nz, j=1:ny_total, i=1:nx_face) if (i <= nghost) then fld(i, j, k) = fld(i + nx_phys, j, k) end if if (i > nx_phys + nghost + 1) then fld(i, j, k) = fld(i - nx_phys, j, k) end if if (i == i_e) fld(i, j, k) = fld(i_w, j, k) end do end if if (wrap_y) then do concurrent(k=1:nz, j=1:ny_total, i=1:nx_face) if (j <= nghost) then fld(i, j, k) = fld(i, j + ny_phys, k) end if if (j > ny_phys + nghost) then fld(i, j, k) = fld(i, j - ny_phys, k) end if end do end if !$acc end kernels if (lwait) then !$acc wait(1) end if end subroutine ocean_periodic_wrap_face_x_3d