Fill ghost cell bathymetry by constant extrapolation from the nearest interior cell. This ensures boundary flux computations see a consistent bottom elevation across the ghost-interior interface. Works on a target 2D array directly so both the coastal and ocean barotropic slots can reuse it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | b(:,:) | |||
| type(hgrid_t), | intent(in) | :: | grid |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | ng | ||||
| integer, | private | :: | nx | ||||
| integer, | private | :: | ny |
subroutine fill_bathymetry_ghosts_array(b, grid) !! Fill ghost cell bathymetry by constant extrapolation from the !! nearest interior cell. This ensures boundary flux computations !! see a consistent bottom elevation across the ghost-interior !! interface. Works on a target 2D array directly so both the !! coastal and ocean barotropic slots can reuse it. real(wp), intent(inout) :: b(:, :) type(hgrid_t), intent(in) :: grid integer :: ng, i, j, nx, ny ng = grid%nghost nx = grid%nx_phys ny = grid%ny_phys ! West and east ghost columns do j = 1, grid%ny_total do i = 1, ng b(i, j) = b(ng + 1, j) ! west b(ng + nx + i, j) = b(ng + nx, j) ! east end do end do ! South and north ghost rows (corners already filled above) do j = 1, ng do i = 1, grid%nx_total b(i, j) = b(i, ng + 1) ! south b(i, ng + ny + j) = b(i, ng + ny) ! north end do end do end subroutine fill_bathymetry_ghosts_array