cavity_apply_land_exclusion Subroutine

public pure subroutine cavity_apply_land_exclusion(z_draft, b, nx, ny, n_over_land)

NO ICE OVER LAND (design rule R2): force z_draft = 0 on every column the bathymetry already calls land (b < LAND_DEPTH_THRESHOLD), and report how many were touched so the caller can log it.

Why zero rather than refuse: a formula shelf box drawn over a continent is a normal thing to write, and the physical meaning is unambiguous (there is no ocean there). Zeroing it keeps land columns byte-identical to a cavity-free run AND keeps the datum invariant (I) exact everywhere — bt_H_ref = b - z_draft and p_ice_ref = rho_ref*g*z_draft are then consistent on every column, land included, with no merge anywhere downstream.

GROUNDED columns (wet bed, but too little water under the ice) are NOT touched here: they keep their draft and are removed by the wet mask instead, which is what makes the metric-zeroing land mask do the rest.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: z_draft(nx,ny)
real(kind=wp), intent(in) :: b(nx,ny)
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(out) :: n_over_land

Count of columns whose draft was zeroed (ghosts included).


Called by

proc~~cavity_apply_land_exclusion~~CalledByGraph proc~cavity_apply_land_exclusion cavity_apply_land_exclusion proc~seed_cavity_draft seed_cavity_draft proc~seed_cavity_draft->proc~cavity_apply_land_exclusion 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_apply_land_exclusion(z_draft, b, nx, ny, n_over_land)
      !! NO ICE OVER LAND (design rule R2): force `z_draft = 0` on every
      !! column the bathymetry already calls land (`b <
      !! LAND_DEPTH_THRESHOLD`), and report how many were touched so the
      !! caller can log it.
      !!
      !! Why zero rather than refuse: a formula shelf box drawn over a
      !! continent is a normal thing to write, and the physical meaning is
      !! unambiguous (there is no ocean there).  Zeroing it keeps land
      !! columns byte-identical to a cavity-free run AND keeps the datum
      !! invariant (I) exact everywhere — `bt_H_ref = b - z_draft` and
      !! `p_ice_ref = rho_ref*g*z_draft` are then consistent on every
      !! column, land included, with no `merge` anywhere downstream.
      !!
      !! GROUNDED columns (wet bed, but too little water under the ice)
      !! are NOT touched here: they keep their draft and are removed by
      !! the wet mask instead, which is what makes the metric-zeroing land
      !! mask do the rest.
      integer, intent(in) :: nx, ny
      real(wp), intent(inout) :: z_draft(nx, ny)
      real(wp), intent(in) :: b(nx, ny)
      integer, intent(out) :: n_over_land
         !! Count of columns whose draft was zeroed (ghosts included).
      integer :: i, j
      n_over_land = 0
      do j = 1, ny
         do i = 1, nx
            if (b(i, j) < LAND_DEPTH_THRESHOLD .and. z_draft(i, j) /= 0.0_wp) then
               z_draft(i, j) = 0.0_wp
               n_over_land = n_over_land + 1
            end if
         end do
      end do
   end subroutine cavity_apply_land_exclusion