GPU-resident periodic ghost-wrap helpers. Seam invariant after every wrap call: (a) every ghost cell equals its interior partner, and (b) u(i_w, ·) == u(i_e, ·) bit-for-bit (i_w = nghost+1, i_e = nghost+nx_phys+1).
Explicit-shape dummies (never assumed-shape), j-outer / i-inner
do concurrent for NVHPC GPU coalescing. The fast barotropic substep
does NOT call these — it wraps inline in its !$acc kernels async(1)
region.
Fill ghost cells of a cell-centred 2D field (e.g. η, bt_H_ref) with the periodically-matching interior values. Explicit-shape dummies avoid per-launch descriptor-walk memcpys.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_total,ny_total) |
Cell-centred field, shape (nx_total, ny_total). |
||
| integer, | intent(in) | :: | nx_total | |||
| integer, | intent(in) | :: | ny_total | |||
| integer, | intent(in) | :: | nx_phys | |||
| integer, | intent(in) | :: | ny_phys | |||
| integer, | intent(in) | :: | nghost | |||
| logical, | intent(in) | :: | wrap_x |
Wrap ghost columns (west ↔ east). |
||
| logical, | intent(in) | :: | wrap_y |
Wrap ghost rows (south ↔ north). |
Fill ghost cells of a cell-centred 3D field (e.g. h_layer, hTr, T, S).
no_wait (optional, default .false.): when .true., loops issue on
OpenACC queue 1 and the routine returns WITHOUT syncing, so a batched
caller can pipeline many tiny ghost-slab wraps and !$acc wait(1)
once. Default ⇒ self-contained blocking wrap. Not pure (directives).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_total,ny_total,nz) |
Cell-centred field, shape (nx_total, ny_total, nz). |
||
| integer, | intent(in) | :: | nx_total | |||
| 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 |
Fill ghost faces of a 2D x-face field (e.g. bt_ubt, shape nx_total+1). Also copies the west physical-wall face value onto the east physical-wall face (belt-and-braces seam invariant, §1.1 property b). nx_face = nx_total + 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_face,ny_total) |
x-face field, shape (nx_total+1, ny_total). |
||
| integer, | intent(in) | :: | nx_face | |||
| integer, | intent(in) | :: | ny_total | |||
| integer, | intent(in) | :: | nx_phys | |||
| integer, | intent(in) | :: | ny_phys | |||
| integer, | intent(in) | :: | nghost | |||
| logical, | intent(in) | :: | wrap_x | |||
| logical, | intent(in) | :: | wrap_y |
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 |
Fill ghost faces of a 2D y-face field (e.g. bt_vbt, shape ny_total+1). Also copies south physical-wall face onto north physical-wall face. ny_face = ny_total + 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_total,ny_face) |
y-face field, shape (nx_total, ny_total+1). |
||
| integer, | intent(in) | :: | nx_total | |||
| integer, | intent(in) | :: | ny_face | |||
| integer, | intent(in) | :: | nx_phys | |||
| integer, | intent(in) | :: | ny_phys | |||
| integer, | intent(in) | :: | nghost | |||
| logical, | intent(in) | :: | wrap_x | |||
| logical, | intent(in) | :: | wrap_y |
Fill ghost faces of a 3D y-face field (e.g. v_face_y_layer).
ny_face = ny_total + 1. no_wait (optional): see
ocean_periodic_wrap_centre_3d. Not pure (async/wait directives).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | fld(nx_total,ny_face,nz) |
y-face field, shape (nx_total, ny_total+1, nz). |
||
| integer, | intent(in) | :: | nx_total | |||
| integer, | intent(in) | :: | ny_face | |||
| 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 |
Convenience wrapper: wrap h_layer, u/v layer faces, and every
registered tracer. Called at stage entry (before
derive_bt_from_layers) and after continuity (before hdiff).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(hgrid_t), | intent(in) | :: | grid | |||
| type(ocean_bc_state_t), | intent(in) | :: | bc | |||
| type(multilayer_state_t), | intent(inout) | :: | ms | |||
| logical, | intent(in), | optional | :: | skip_x |
When .true., suppress the local x-axis wrap (D4 multi-rank). |
|
| logical, | intent(in), | optional | :: | skip_y |
When .true., suppress the local y-axis wrap (D4 multi-rank). |