Exchanges +/-x then +/-y halos sequentially; no corner exchange. Each axis uses four non-blocking operations (2 Irecv + 2 Isend) followed by a single MPI_Waitall, matching the 1D halo_exchange pattern.
Neighbours stored as MPI_PROC_NULL (non-periodic physical boundaries) make the matching Irecv/Isend calls silent no-ops per MPI standard ยง6.6. The conditional halo-copy guards that follow are still needed so stale (-1) interior values are not written into those halo positions.
The Cartesian communicator is obtained via cart_comm_2d(); call setup_decomp_2d(state) before exchange_halos_2d.
Legacy-MPI note (CFD_SOLVER_LEGACY_MPI): MPI_Request is a bare integer under
the legacy mpi module; the mpi_f08 path uses derived-type handles.
MPI_STATUSES_IGNORE is provided by both but requires the same guard to stay
type-consistent. MPI_DOUBLE_PRECISION is an integer constant in both paths.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private, | parameter | :: | TAG_X_LO | = | 2001 | |
| integer, | private, | parameter | :: | TAG_X_HI | = | 2002 | |
| integer, | private, | parameter | :: | TAG_Y_LO | = | 2003 | |
| integer, | private, | parameter | :: | TAG_Y_HI | = | 2004 |
Fill state%ub halo cells from MPI neighbours in both x and y directions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_2d_t), | intent(inout) | :: | state |
Solver state (ub must already be allocated via allocate_work_arrays_2d). |
||
| type(decomp_2d_t), | intent(in) | :: | d |
Per-rank 2D decomposition (neighbour ranks, local extents). |