cavity_count_grounded Subroutine

public pure subroutine cavity_count_grounded(b, z_draft, h_min, ng, nx_phys, ny_phys, nx, ny, n_grounded, n_interior)

Count the INTERIOR columns the cavity grounds: wet bed (b >= LAND_DEPTH_THRESHOLD) but water thickness b - z_draft < h_min. Interior-only, because the ghost band carries extrapolated bathymetry and would bias the fraction the grounded_max_frac sanity bound is taken against.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: b(nx,ny)
real(kind=wp), intent(in) :: z_draft(nx,ny)
real(kind=wp), intent(in) :: h_min
integer, intent(in) :: ng
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(out) :: n_grounded
integer, intent(out) :: n_interior

Called by

proc~~cavity_count_grounded~~CalledByGraph proc~cavity_count_grounded cavity_count_grounded proc~seed_cavity_draft seed_cavity_draft proc~seed_cavity_draft->proc~cavity_count_grounded proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~seed_cavity_draft 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

Source Code

   pure subroutine cavity_count_grounded(b, z_draft, h_min, ng, nx_phys, ny_phys, &
                                         nx, ny, n_grounded, n_interior)
      !! Count the INTERIOR columns the cavity grounds: wet bed
      !! (`b >= LAND_DEPTH_THRESHOLD`) but water thickness
      !! `b - z_draft < h_min`.  Interior-only, because the ghost band
      !! carries extrapolated bathymetry and would bias the fraction the
      !! `grounded_max_frac` sanity bound is taken against.
      integer, intent(in) :: ng, nx_phys, ny_phys, nx, ny
      real(wp), intent(in) :: b(nx, ny)
      real(wp), intent(in) :: z_draft(nx, ny)
      real(wp), intent(in) :: h_min
      integer, intent(out) :: n_grounded
      integer, intent(out) :: n_interior
      integer :: i, j
      n_grounded = 0
      n_interior = nx_phys*ny_phys
      do j = ng + 1, ng + ny_phys
         do i = ng + 1, ng + nx_phys
            if (b(i, j) >= LAND_DEPTH_THRESHOLD .and. &
                b(i, j) - z_draft(i, j) < h_min) then
               n_grounded = n_grounded + 1
            end if
         end do
      end do
   end subroutine cavity_count_grounded