gather_edge_ghosts_to_root Subroutine

public subroutine gather_edge_ghosts_to_root(state, left, right)

Gather the boundary halo/ghost cells owned by the global left- and right-edge ranks to rank 0: left(neq,h) = the left-edge rank's ub(:,1-h:0), right(neq,h) = the right-edge rank's ub(:,n_local+1:n_local+h). Needed because checkpoint/restart must persist these cells for "prescribed" BCs (dirichlet/inflow/ supersonic_inlet) whose ghost values are never recomputed by apply_bcs after the initial seed, yet are NOT actually constant across a run (see checkpoint.f90's module header for the full story) — F2.

Edge ownership follows decompose()'s deterministic contiguous-block partition: rank 0 always owns global index 1 (the left edge). The right edge is owned by rank decomp%n_ranks - 1, a value every rank computes identically from its own decomp (n_ranks is constant across ranks) — no rank-divergent I/O or extra handshake is needed to discover it. At np=1 (or whenever n_ranks-1 == 0) both edges are local to rank 0 and this is a pure local copy — no MPI traffic.

Arguments

Type IntentOptional Attributes Name
type(solver_state_t), intent(in) :: state

This rank's solver state (ub must be allocated/populated).

real(kind=wp), intent(inout) :: left(:,:)
real(kind=wp), intent(inout) :: right(:,:)