subroutine drain_wrap_centre(fld, nx, ny, nz, nx_phys, ny_phys, nghost, &
per_x, per_y, fold_n, no_wait)
!! Periodic wrap (+ north fold) of a cell-centred drain field.
!! `no_wait` (optional): when .true. AND not folding, the periodic wrap
!! is issued async on queue 1 without syncing, so a caller can batch
!! several independent wraps (e.g. the pal/par/pa6 parabola triple) and
!! `!$acc wait(1)` once. Ignored when fold_n (the fold reads the wrapped
!! field, so the periodic wrap must complete first).
integer, intent(in) :: nx, ny, nz, nx_phys, ny_phys, nghost
real(wp), intent(inout) :: fld(nx, ny, nz)
logical, intent(in) :: per_x, per_y, fold_n
logical, intent(in), optional :: no_wait
logical :: nw
nw = .false.
if (present(no_wait)) nw = no_wait .and. .not. fold_n
if (per_x .or. per_y) then
call ocean_periodic_wrap_centre_3d(fld, nx, ny, nz, &
nx_phys, ny_phys, nghost, per_x, per_y, no_wait=nw)
end if
if (fold_n) call fold_north_centre(fld, nx, ny, nz, nx_phys, ny_phys, nghost)
end subroutine drain_wrap_centre