+27
−17
Loading
Three bugs prevented simulation results from being invariant to
GHOST_CELL_PADDING values greater than 1:
1. wet_dry kernel: incorrect last interior row check
- Original: ix == nrows - 2*GHOST_CELL_PADDING
- Fixed: ix == nrows - GHOST_CELL_PADDING - 1
- For N=2, original checked row nrows-4 instead of nrows-3
2. halo_copy_to_gpu: wrong destination for bottom ghost cells
- Original temp offset (nrows - 2N) pointed to interior cells
instead of ghost cells for N > 1
- Original loop also overwrote interior edge cells with stale
data (harmless for N=1 since values were unchanged, but
corrupts results for N > 1)
- Fixed: only process N rows (ghost cells), use correct offset
(nrows - N), and read from MPI-received positions (9N-12N)
3. compute_extbc_values: hardcoded boundary indices
- Original assumed GHOST_CELL_PADDING=1 with ix==1, iy==1
- Fixed to use GHOST_CELL_PADDING for first/last interior row/col
All configurations now produce bitwise-identical results:
- GHOST_CELL_PADDING: 1-5
- MPI ranks: 1, 2, 4, 6