Fold the surface-stress pair: tau_x (u, −) and tau_y (v, − +
fold-row projection) — true vector components. Call after the
pair’s exchange + periodic wrap. No-op when not folding.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(hgrid_t), | intent(in) | :: | grid | |||
| type(ocean_bc_state_t), | intent(in) | :: | bc | |||
| real(kind=wp), | intent(inout) | :: | tau_x(grid%nx_total+1,grid%ny_total) |
x-face stress (nx_total+1, ny_total). |
||
| real(kind=wp), | intent(inout) | :: | tau_y(grid%nx_total,grid%ny_total+1) |
y-face stress (nx_total, ny_total+1). |
||
| logical, | intent(in), | optional | :: | device_resident |
px > 1 only: |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nxt | ||||
| integer, | private | :: | nyt |
subroutine ocean_fold_wrap_stress(grid, bc, tau_x, tau_y, device_resident) !! Fold the surface-stress pair: `tau_x` (u, −) and `tau_y` (v, − + !! fold-row projection) — true vector components. Call after the !! pair's exchange + periodic wrap. No-op when not folding. type(hgrid_t), intent(in) :: grid type(ocean_bc_state_t), intent(in) :: bc real(wp), intent(inout) :: tau_x(grid%nx_total + 1, grid%ny_total) !! x-face stress (nx_total+1, ny_total). real(wp), intent(inout) :: tau_y(grid%nx_total, grid%ny_total + 1) !! y-face stress (nx_total, ny_total+1). logical, intent(in), optional :: device_resident !! px > 1 only: `.false.` for host-side calls. integer :: nxt, nyt if (.not. bc%north_fold) return nxt = grid%nx_total nyt = grid%ny_total if (ocean_fold_is_distributed()) then call ocean_fold_begin(2*(grid%nghost + 1)) call ocean_fold_pack(tau_x, nxt + 1, nyt, FOLD_STAG_U, device_resident) call ocean_fold_pack(tau_y, nxt, nyt + 1, FOLD_STAG_V, device_resident) call ocean_fold_exchange(device_resident) call ocean_fold_unpack(tau_x, nxt + 1, nyt, FOLD_STAG_U, .true., device_resident) call ocean_fold_unpack(tau_y, nxt, nyt + 1, FOLD_STAG_V, .true., device_resident) call ocean_fold_end() return end if call fold_north_u_face(tau_x, nxt + 1, nyt, grid%nx_phys, grid%ny_phys, grid%nghost) call fold_north_v_face(tau_y, nxt, nyt + 1, grid%nx_phys, grid%ny_phys, grid%nghost) end subroutine ocean_fold_wrap_stress