ice_bottom_melt_peel Subroutine

public pure subroutine ice_bottom_melt_peel(nk, m_lay, enthalpy, salin, bmelt, heat_to_ocn, h2o_ice_to_ocn)

Bottom melt peel (SIS2_ice_thm.F90:1246-1271; prototype sis2_resize.py:83-111). Same peel as ice_top_melt_peel but from k=nk down to k=0. The prototype’s separate ablation return is dropped (it is h2o_ice_to_ocn restricted to this call; PR 3b can re-derive it if needed).

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nk

Number of ice layers (declared first — decl-order).

real(kind=wp), intent(inout) :: m_lay(0:nk)

Layer masses (kg/m²), 0 = snow, 1..nk = ice.

real(kind=wp), intent(inout) :: enthalpy(0:nk)

Layer specific enthalpies (J/kg).

real(kind=wp), intent(in) :: salin(0:nk)

Layer bulk salinities (PSU) — index 0 (snow) unused.

real(kind=wp), intent(inout) :: bmelt

Accumulated bottom melting energy (J/m²), consumed by the peel; NOTE unlike ice_bottom_freeze this is intent inout only for interface symmetry — the peel does not reset it (caller passes the post-freeze residual).

real(kind=wp), intent(inout) :: heat_to_ocn

Leftover melt energy after all layers exhausted (J/m²) — accumulator, caller zeroes once per step.

real(kind=wp), intent(inout) :: h2o_ice_to_ocn

Meltwater mass flux to the ocean (kg/m²) — accumulator.


Calls

proc~~ice_bottom_melt_peel~~CallsGraph proc~ice_bottom_melt_peel ice_bottom_melt_peel proc~ice_enthalpy_liquid_freeze ice_enthalpy_liquid_freeze proc~ice_bottom_melt_peel->proc~ice_enthalpy_liquid_freeze

Called by

proc~~ice_bottom_melt_peel~~CalledByGraph proc~ice_bottom_melt_peel ice_bottom_melt_peel proc~ice_column_step ice_column_step proc~ice_column_step->proc~ice_bottom_melt_peel proc~ice_thermo_columns ice_thermo_columns proc~ice_thermo_columns->proc~ice_column_step proc~ice_thermo_driver_step ice_thermo_driver_step proc~ice_thermo_driver_step->proc~ice_thermo_columns proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_thermo_driver_step proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step_ice proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step_ice

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: avail
real(kind=wp), private :: enth_fr(0:ICE_NK_MAX)
integer, private :: k
real(kind=wp), private :: m_melt
real(kind=wp), private :: melt_left

Source Code

   pure subroutine ice_bottom_melt_peel(nk, m_lay, enthalpy, salin, bmelt, &
                                        heat_to_ocn, h2o_ice_to_ocn)
      !! Bottom melt peel (SIS2_ice_thm.F90:1246-1271; prototype
      !! sis2_resize.py:83-111). Same peel as `ice_top_melt_peel` but
      !! from k=nk down to k=0. The prototype's separate `ablation`
      !! return is dropped (it is `h2o_ice_to_ocn` restricted to this
      !! call; PR 3b can re-derive it if needed).
      !$acc routine seq
      integer, intent(in) :: nk
         !! Number of ice layers (declared first — decl-order).
      real(wp), intent(inout) :: m_lay(0:nk)
         !! Layer masses (kg/m²), 0 = snow, 1..nk = ice.
      real(wp), intent(inout) :: enthalpy(0:nk)
         !! Layer specific enthalpies (J/kg).
      real(wp), intent(in) :: salin(0:nk)
         !! Layer bulk salinities (PSU) — index 0 (snow) unused.
      real(wp), intent(inout) :: bmelt
         !! Accumulated bottom melting energy (J/m²), consumed by the
         !! peel; NOTE unlike `ice_bottom_freeze` this is intent
         !! inout only for interface symmetry — the peel does not
         !! reset it (caller passes the post-freeze residual).
      real(wp), intent(inout) :: heat_to_ocn
         !! Leftover melt energy after all layers exhausted (J/m²) —
         !! accumulator, caller zeroes once per step.
      real(wp), intent(inout) :: h2o_ice_to_ocn
         !! Meltwater mass flux to the ocean (kg/m²) — accumulator.

      real(wp) :: enth_fr(0:ICE_NK_MAX)
      real(wp) :: melt_left, avail, m_melt
      integer :: k

      enth_fr(0) = ice_enthalpy_liquid_freeze(0.0_wp)
      do k = 1, nk
         enth_fr(k) = ice_enthalpy_liquid_freeze(salin(k))
      end do

      melt_left = bmelt
      if (melt_left > 0.0_wp) then
         do k = nk, 0, -1
            if (m_lay(k) <= 0.0_wp) cycle
            avail = m_lay(k)*(enth_fr(k) - enthalpy(k))
            if (melt_left < avail) then
               m_melt = melt_left/(enth_fr(k) - enthalpy(k))
               melt_left = 0.0_wp
            else
               m_melt = m_lay(k)
               melt_left = melt_left - avail
            end if
            m_lay(k) = m_lay(k) - m_melt
            h2o_ice_to_ocn = h2o_ice_to_ocn + m_melt
            if (melt_left <= 0.0_wp) exit
         end do
         heat_to_ocn = heat_to_ocn + melt_left
      end if
   end subroutine ice_bottom_melt_peel