gather_solution_to_root_2d Subroutine

public subroutine gather_solution_to_root_2d(state, global_field, is_ok, message, global_xc, global_yc)

Gather all per-rank tiles to rank 0, assembling the full global solution field.

This is a pure data-move routine: on rank 0 it assembles the global (neq2d, nx_g, ny_g) field from all ranks' tiles via point-to-point MPI. On non-root ranks it sends the local tile and allocates a 0-size placeholder. No cross-rank reduction of is_ok is performed — the caller is responsible for any par_lor aggregation, matching how 1D's gather_solution_to_root is a pure data move.

When global_xc/global_yc are present (curvilinear grids), the mesh coordinates are also gathered to rank 0: FVM cell centroids (mesh%xc/yc) or, for curvilinear FDM (mesh%fdm_curvilinear), node coordinates (mesh%x_node/y_node) — xc/yc are never allocated on the FDM path.

Arguments

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

Solver state (ub(:,1:nx_local,1:ny_local) = interior cells).

real(kind=wp), intent(out), allocatable :: global_field(:,:,:)
logical, intent(out) :: is_ok

.true. on local success; caller reduces if needed.

character(len=*), intent(out) :: message

Human-readable error on failure.

real(kind=wp), intent(out), optional, allocatable :: global_xc(:,:)
real(kind=wp), intent(out), optional, allocatable :: global_yc(:,:)