solution_gather Module

Phase D helper. Reused by write_solution_file and write_snapshot to produce byte-identical multi-rank output.

Hybrid cpp split mirrors src/parallel_reductions.F90: MS-MPI ships only the legacy use mpi module; OpenMPI ships both and we prefer mpi_f08 for the strong typing.



Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: TAG_EDGE_RIGHT = 4001

Point-to-point tag for the right-edge ghost exchange (F2). The left edge never needs a tag: decompose()'s contiguous block partition always gives rank 0 global index 1, so the left edge is always already local to rank 0 (see the two subroutines below for the full ownership argument).


Subroutines

public subroutine gather_solution_to_root(local_prim, n_local, decomp, gather_buf)

Gather (neq, n_local) primitives from every rank into (neq, n_global) on rank 0 via MPI_Gatherv.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: local_prim(:,:)
integer, intent(in) :: n_local

this rank's interior cell count

type(decomp_t), intent(in) :: decomp

per-rank decomposition descriptor (needed for n_global, n_ranks)

real(kind=wp), intent(inout) :: gather_buf(:,:)

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.

Read more…

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(:,:)

public subroutine scatter_edge_ghosts_from_root(state, left, right)

Inverse of gather_edge_ghosts_to_root: rank 0 delivers the left/ right ghost blocks (as just read from a checkpoint) to the ranks that own those edges, copying directly into state % ub's halo columns. Same ownership derivation and np=1 pure-local-copy behaviour as the gather — F2.

Arguments

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

This rank's solver state (ub receives the restored ghosts).

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