bathymetry_fill_ghosts_array Subroutine

public subroutine bathymetry_fill_ghosts_array(b, grid)

Fill ghost-cell bathymetry by constant extrapolation from the nearest interior cell. Deliberate duplicate of rdb_bathymetry::fill_bathymetry_ghosts_array — see the module docstring for why this module cannot use that one.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: b(:,:)
type(hgrid_t), intent(in) :: grid

Called by

proc~~bathymetry_fill_ghosts_array~~CalledByGraph proc~bathymetry_fill_ghosts_array bathymetry_fill_ghosts_array proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~bathymetry_fill_ghosts_array proc~seed_cavity_draft seed_cavity_draft proc~ocean_state_seed_from_cfg->proc~seed_cavity_draft proc~rdb_ocean_set_bathymetry rdb_ocean_set_bathymetry proc~rdb_ocean_set_bathymetry->proc~bathymetry_fill_ghosts_array proc~seed_cavity_draft->proc~bathymetry_fill_ghosts_array proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: ng
integer, private :: nx
integer, private :: ny

Source Code

   subroutine bathymetry_fill_ghosts_array(b, grid)
      !! Fill ghost-cell bathymetry by constant extrapolation from the
      !! nearest interior cell. Deliberate duplicate of
      !! `rdb_bathymetry::fill_bathymetry_ghosts_array` — see the module
      !! docstring for why this module cannot `use` that one.
      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 bathymetry_fill_ghosts_array