build_mesh_cellcentered_local Subroutine

public subroutine build_mesh_cellcentered_local(mesh, decomp, x_left, x_right)

Build this rank's local cell-centered coordinates and widths (FVM path).

The MPI twin of build_mesh_cellcentered_1d: where that routine builds the replicated GLOBAL cell-centered mesh, this slices out the per-rank LOCAL cell-centered mesh from the decomposition, mirroring how build_mesh_local slices the nodal mesh. For local cell i (1..n_local) the 1-based global cell index is decomp % i_first_global - 1 + i; the uniform cell width is dx = (x_right - x_left) / decomp % n_global (the FVM decomposition counts CELLS, so n_global is the global cell count); the cell center is x_left + (global_i - 0.5) * dx.

UNIFORM grids: the ghost layers 1-h .. 0 and n_local+1 .. n_local+h are filled with the same center formula evaluated at their (possibly out-of-domain) global cell index, so the global-edge ghosts extrapolate linearly by dx. At np=1 (i_first_global == 1, n_local == n_global) this reduces exactly to build_mesh_cellcentered_1d(mesh, n_global, x_left, x_right, halo_width).

NON-UNIFORM grids (.not. mesh % uniform, i.e. an FVM file grid): interior cells are sliced from the replicated global arrays built by build_mesh_cellcentered_global — x_cell(i) = x_cell_global(g), dx_cell(i) = dx_cell_global(g) with g = i_first_global - 1 + i, mirroring build_mesh_local's nodal slice. Ghost cells beyond the global domain (g < 1 or g > n_global) are filled by linear extrapolation of the edge face positions: the nearest edge cell width is held constant and the center steps out by that width. These ghost geometry values are NOT used by the residual (which only divides interior cells 1..n_local by their own dx_cell) nor by the uniform-coefficient reconstruction (which is geometry-agnostic); they are filled only so the arrays are consistent.

Arguments

Type IntentOptional Attributes Name
type(mesh_1d_t), intent(inout) :: mesh

Mesh object to populate (x_cell and dx_cell are set).

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

This rank's decomposition (cell-counted for the FVM path).

real(kind=wp), intent(in) :: x_left

Left domain boundary coordinate.

real(kind=wp), intent(in) :: x_right

Left domain boundary coordinate. Right domain boundary coordinate.