ice_ic_target_category Function

public pure function ice_ic_target_category(m, mh_lim, ncat) result(c)

The IC’s target category for a pack of mass m [kg/m^2] (per-ICE-area, ncat>1 convention): the top bin ncat is UNBOUNDED above (mh_lim(ncat+1) is stored but never used as a cap — ice_adjust_categories’s upward pass stops at c = ncat-1), otherwise the unique c with mh_lim(c) <= m < mh_lim(c+1). Declared ncat before the explicit-shape mh_lim that uses it (decl-order).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: m

Pack mass (kg/m^2, per-ICE-area convention).

real(kind=wp), intent(in) :: mh_lim(ncat+1)

Category lower mass limits (kg/m^2), ice%mh_lim — NEVER a re-derivation from ncat alone (PR-58 may override its values via &ocean_ice_nml hlim).

integer, intent(in) :: ncat

Number of ice thickness categories.

Return Value integer


Called by

proc~~ice_ic_target_category~~CalledByGraph proc~ice_ic_target_category ice_ic_target_category proc~ice_init_apply_impl ice_init_apply_impl proc~ice_init_apply_impl->proc~ice_ic_target_category proc~ice_init_apply ice_init_apply proc~ice_init_apply->proc~ice_init_apply_impl proc~engine_setup engine_setup proc~engine_setup->proc~ice_init_apply 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 :: k

Source Code

   pure function ice_ic_target_category(m, mh_lim, ncat) result(c)
      !! The IC's target category for a pack of mass `m` [kg/m^2]
      !! (per-ICE-area, ncat>1 convention): the top bin `ncat` is
      !! UNBOUNDED above (`mh_lim(ncat+1)` is stored but never used as a
      !! cap — `ice_adjust_categories`'s upward pass stops at `c =
      !! ncat-1`), otherwise the unique `c` with
      !! `mh_lim(c) <= m < mh_lim(c+1)`. Declared `ncat` before the
      !! explicit-shape `mh_lim` that uses it (decl-order).
      integer, intent(in) :: ncat
         !! Number of ice thickness categories.
      real(wp), intent(in) :: m
         !! Pack mass (kg/m^2, per-ICE-area convention).
      real(wp), intent(in) :: mh_lim(ncat + 1)
         !! Category lower mass limits (kg/m^2), `ice%mh_lim` — NEVER a
         !! re-derivation from `ncat` alone (PR-58 may override its
         !! values via `&ocean_ice_nml hlim`).
      integer :: c

      integer :: k

      if (m >= mh_lim(ncat)) then
         c = ncat
         return
      end if
      c = 1
      do k = 1, ncat - 1
         if (m >= mh_lim(k) .and. m < mh_lim(k + 1)) then
            c = k
            exit
         end if
      end do
   end function ice_ic_target_category