Ghost Cells and Halo Exchange
Ghost cells are local copies of neighbors' boundary data; the halo exchange refreshes them each step so stencil updates need no per-cell communication.
Borrowing the neighbor's edge
A stencil update computes each cell from its neighbors. At a subdomain's edge, some neighbors belong to another process. Rather than fetch them cell by cell, each process keeps a border of ghost cells (also called halo cells): extra rows or layers that hold copies of the adjacent process's boundary values. The interior update then reads only local memory, ghost cells included, with no communication during the computation itself.
The halo exchange
The ghost cells are refreshed once per timestep in a halo exchange: each process sends its own boundary cells to the neighbors that keep them as ghosts, and receives their boundaries into its own ghost layer. The halo width matches the stencil radius, one layer for a nearest-neighbor stencil, more for a wider one. The exchange is a set of point-to-point sends and receives with each spatial neighbor, or a neighborhood collective in modern MPI.
- Ghost cells hold local copies of neighbors' boundary data.
- Halo width equals the stencil's reach (one layer for nearest-neighbor).
- One exchange per step replaces per-cell remote access.
- The exchange overlaps naturally with the interior computation.
Overlap and correctness
Because interior cells do not depend on ghost data, the halo exchange overlaps cleanly with the interior update: post nonblocking sends and receives, update the interior while the halos travel, then update the boundary cells once the halos arrive. Correctness requires the exchange to complete before boundary cells are computed and requires consistent ordering so that data lands in the right ghost positions, including at domain corners where diagonal neighbors contribute.
In practice
A Hyperion field solver surrounds each rank's subdomain with a ghost layer sized to its stencil, exchanges halos each step, and overlaps that exchange with the interior update. This is the concrete mechanism that turns a globally coupled physical field into a scalable, mostly-local computation across many ranks.