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).
| Type | Intent | Optional | 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), |
||
| integer, | intent(in) | :: | ncat |
Number of ice thickness categories. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | k |
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