ice_bottom_freeze Subroutine

public pure subroutine ice_bottom_freeze(nk, m_lay, enthalpy, salin, bmelt, enth_ocean, salin_freeze, h2o_ocn_to_ice)

Bottom-freezing branch of ice_resize_SIS2 (SIS2_ice_thm.F90:1164-1188; prototype sis2_resize.py:20-45). When bmelt < 0 (net upward heat deficit at the base), freeze ocean water onto the bottom ice layer: enth_freeze = min(enthalpy(nk), enth_ocean - min_denth_freeze), m_freeze = -bmelt/(enth_ocean - enth_freeze), mass-weighted mix of the bottom layer’s enthalpy + salinity, bmelt reset to 0.

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(inout) :: salin(0:nk)

Layer bulk salinities (PSU).

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

Accumulated bottom melting/freezing energy (J/m²); reset to 0 on exit when freezing occurred.

real(kind=wp), intent(in) :: enth_ocean

Ocean-water specific enthalpy at the ice base (J/kg) — TRAP #1: the LIQUID formula ice_enthalpy_liquid(sst, s_surf), never the frozen/mushy ice_enth_from_ts.

real(kind=wp), intent(in) :: salin_freeze

Salinity of newly frozen ice (PSU) — bulk-salinity mode: ICE_BULK_SALINITY.

real(kind=wp), intent(out) :: h2o_ocn_to_ice

Mass flux frozen from the ocean onto the ice base (kg/m²).


Called by

proc~~ice_bottom_freeze~~CalledByGraph proc~ice_bottom_freeze ice_bottom_freeze proc~ice_column_step ice_column_step proc~ice_column_step->proc~ice_bottom_freeze 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 :: enth_freeze
real(kind=wp), private :: m_freeze
real(kind=wp), private :: min_denth_freeze

Source Code

   pure subroutine ice_bottom_freeze(nk, m_lay, enthalpy, salin, bmelt, &
                                     enth_ocean, salin_freeze, h2o_ocn_to_ice)
      !! Bottom-freezing branch of `ice_resize_SIS2`
      !! (SIS2_ice_thm.F90:1164-1188; prototype sis2_resize.py:20-45).
      !! When `bmelt < 0` (net upward heat deficit at the base), freeze
      !! ocean water onto the bottom ice layer: `enth_freeze =
      !! min(enthalpy(nk), enth_ocean - min_denth_freeze)`,
      !! `m_freeze = -bmelt/(enth_ocean - enth_freeze)`, mass-weighted
      !! mix of the bottom layer's enthalpy + salinity, `bmelt` reset
      !! to 0.
      !$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(inout) :: salin(0:nk)
         !! Layer bulk salinities (PSU).
      real(wp), intent(inout) :: bmelt
         !! Accumulated bottom melting/freezing energy (J/m²); reset
         !! to 0 on exit when freezing occurred.
      real(wp), intent(in) :: enth_ocean
         !! Ocean-water specific enthalpy at the ice base (J/kg) —
         !! TRAP #1: the LIQUID formula `ice_enthalpy_liquid(sst,
         !! s_surf)`, never the frozen/mushy `ice_enth_from_ts`.
      real(wp), intent(in) :: salin_freeze
         !! Salinity of newly frozen ice (PSU) — bulk-salinity mode:
         !! `ICE_BULK_SALINITY`.
      real(wp), intent(out) :: h2o_ocn_to_ice
         !! Mass flux frozen from the ocean onto the ice base (kg/m²).

      real(wp) :: min_denth_freeze, enth_freeze, m_freeze

      h2o_ocn_to_ice = 0.0_wp
      if (bmelt < 0.0_wp) then
         min_denth_freeze = ICE_LAT_FUS*(1.0_wp - ICE_LIQ_LIM)
         enth_freeze = min(enthalpy(nk), enth_ocean - min_denth_freeze)
         m_freeze = -bmelt/(enth_ocean - enth_freeze)

         enthalpy(nk) = (m_lay(nk)*enthalpy(nk) + m_freeze*enth_freeze)/ &
                        (m_lay(nk) + m_freeze)
         salin(nk) = (m_lay(nk)*salin(nk) + m_freeze*salin_freeze)/ &
                     (m_lay(nk) + m_freeze)
         m_lay(nk) = m_lay(nk) + m_freeze
         h2o_ocn_to_ice = m_freeze
         bmelt = 0.0_wp
      end if
   end subroutine ice_bottom_freeze