cavity_count_unloaded_p_top Function

public pure function cavity_count_unloaded_p_top(p_top, p_ice_ref, nx, ny) result(n_unloaded)

Count cells whose top-of-column pressure does NOT carry the isostatic ice load — the melt path’s guard that configure_ocean_cavity (the sole ms%p_top producer) ran, and ran before this check.

The test is p_top < p_ice_ref, which is exact rather than a tolerance: ms%p_top = p_ice_ref + sf%p_surf with sf%p_surf >= 0 by contract, so a loaded column satisfies it with no rounding argument at all, and an unloaded one misses it by the whole 5e6 Pa. A pure predicate, so the refusal can be tested without provoking the error stop.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: p_top(nx,ny)

multilayer_state_t%p_top (Pa).

real(kind=wp), intent(in) :: p_ice_ref(nx,ny)

metrics%p_ice_ref (Pa) = rho_ref*GRAVITY*z_draft.

integer, intent(in) :: nx

First dimension.

integer, intent(in) :: ny

Second dimension.

Return Value integer


Called by

proc~~cavity_count_unloaded_p_top~~CalledByGraph proc~cavity_count_unloaded_p_top cavity_count_unloaded_p_top proc~configure_ocean_cavity_melt configure_ocean_cavity_melt proc~configure_ocean_cavity_melt->proc~cavity_count_unloaded_p_top proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_cavity_melt 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 function cavity_count_unloaded_p_top(p_top, p_ice_ref, nx, ny) result(n_unloaded)
      !! Count cells whose top-of-column pressure does NOT carry the
      !! isostatic ice load — the melt path's guard that
      !! `configure_ocean_cavity` (the sole `ms%p_top` producer) ran, and
      !! ran before this check.
      !!
      !! The test is `p_top < p_ice_ref`, which is exact rather than a
      !! tolerance: `ms%p_top = p_ice_ref + sf%p_surf` with
      !! `sf%p_surf >= 0` by contract, so a loaded column satisfies it
      !! with no rounding argument at all, and an unloaded one misses it
      !! by the whole 5e6 Pa.  A `pure` predicate, so the refusal can be
      !! tested without provoking the `error stop`.
      integer, intent(in) :: nx
         !! First dimension.
      integer, intent(in) :: ny
         !! Second dimension.
      real(wp), intent(in) :: p_top(nx, ny)
         !! `multilayer_state_t%p_top` (Pa).
      real(wp), intent(in) :: p_ice_ref(nx, ny)
         !! `metrics%p_ice_ref` (Pa) = `rho_ref*GRAVITY*z_draft`.
      integer :: n_unloaded
      integer :: i, j
      n_unloaded = 0
      do j = 1, ny
         do i = 1, nx
            if (p_top(i, j) < p_ice_ref(i, j)) n_unloaded = n_unloaded + 1
         end do
      end do
   end function cavity_count_unloaded_p_top