Exchange ghost cells for the four multilayer prognostic field kinds via the O1 halo primitives:
h_layer — cell-centred layer thickness (centre_3d)u_face_x_layer — east-face layer velocity (face_x_3d)v_face_y_layer — north-face layer velocity (face_y_3d)tracers(it)%hTr — per-tracer thickness-weighted scalar
(centre_3d, outer-shim loop)Unconditional (D0): single-rank + non-periodic ⇒ no-op; single-rank + periodic ⇒ local wrap; multi-rank ⇒ messages. Corner ghosts valid on return (D2 two-pass inside the primitives).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(multilayer_state_t), | intent(inout) | :: | ms |
Multilayer C-grid state whose ghost bands are to be filled. |
||
| logical, | intent(in), | optional | :: | device_resident |
Forwarded to every primitive call. Pass .false. for init-time host-side exchanges that occur before ocean_state_enter_data. Default (.true.) is the normal device-resident path. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | it |
subroutine ocean_halo_exchange_ml_state(ms, device_resident) !! Exchange ghost cells for the four multilayer prognostic field kinds !! via the O1 halo primitives: !! !! * `h_layer` — cell-centred layer thickness (centre_3d) !! * `u_face_x_layer` — east-face layer velocity (face_x_3d) !! * `v_face_y_layer` — north-face layer velocity (face_y_3d) !! * `tracers(it)%hTr` — per-tracer thickness-weighted scalar !! (centre_3d, outer-shim loop) !! !! Unconditional (D0): single-rank + non-periodic ⇒ no-op; !! single-rank + periodic ⇒ local wrap; multi-rank ⇒ messages. !! Corner ghosts valid on return (D2 two-pass inside the primitives). type(multilayer_state_t), intent(inout) :: ms !! Multilayer C-grid state whose ghost bands are to be filled. logical, intent(in), optional :: device_resident !! Forwarded to every primitive call. Pass .false. for init-time !! host-side exchanges that occur before ocean_state_enter_data. !! Default (.true.) is the normal device-resident path. integer :: it call profiler_start("ocean_comms_ml") call oh_count_ml_state() call oh_count_suppress_on() call ocean_halo_centre(ms%h_layer, ms%nz_ml, device_resident) call ocean_halo_face_x(ms%u_face_x_layer, ms%nz_ml, device_resident) call ocean_halo_face_y(ms%v_face_y_layer, ms%nz_ml, device_resident) ! Per-tracer loop outside DC — outer-shim pattern: array-of-DT ! cannot be dereferenced inside a do concurrent on-device. if (allocated(ms%tracers)) then do it = 1, size(ms%tracers) if (.not. allocated(ms%tracers(it)%hTr)) cycle call ocean_halo_centre(ms%tracers(it)%hTr, ms%nz_ml, device_resident) end do end if call oh_count_suppress_off() call profiler_stop("ocean_comms_ml") end subroutine ocean_halo_exchange_ml_state