ice_frazil_uptake Subroutine

public pure subroutine ice_frazil_uptake(grid, eos, ms, ice, dt_therm)

Outer shim (outer-shim + flat-impl pattern): dereference the tracer registry (ms%tracers(idx)%hTr) on the HOST and forward bare arrays to the device kernel — NVHPC stdpar cannot follow the array-of-derived-types indirection inside a do-concurrent body (same rule as ice_frazil_accumulate). No-op when either S or T is unregistered.

PR 4a dispatch (module docstring two-mode convention): ncat==1 calls the EXISTING ice_frazil_uptake_impl byte-for-byte UNCHANGED (bit-identity with PR 3c); ncat>1 calls the new ice_frazil_uptake_multicat_impl. The branch lives ONLY here — never inside a kernel.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(eos_t), intent(in) :: eos
type(multilayer_state_t), intent(in) :: ms

ocean-side effect of the uptake (brine rejection) arrives only via Q_salt on the NEXT thermo window, through ice_ocean_brine_flux + ocean_surface_flux_apply_tracers.

type(ocean_sea_ice_t), intent(inout) :: ice
real(kind=wp), intent(in) :: dt_therm

Effective thermo timestep (s) — ocean_dyn_t%therm_dt(dt).


Calls

proc~~ice_frazil_uptake~~CallsGraph proc~ice_frazil_uptake ice_frazil_uptake proc~ice_frazil_uptake_impl ice_frazil_uptake_impl proc~ice_frazil_uptake->proc~ice_frazil_uptake_impl proc~ice_frazil_uptake_multicat_impl ice_frazil_uptake_multicat_impl proc~ice_frazil_uptake->proc~ice_frazil_uptake_multicat_impl local local proc~ice_frazil_uptake_impl->local proc~eos_freezing_point eos_freezing_point proc~ice_frazil_uptake_impl->proc~eos_freezing_point proc~ice_frazil_uptake_column ice_frazil_uptake_column proc~ice_frazil_uptake_impl->proc~ice_frazil_uptake_column proc~ice_frazil_uptake_multicat_impl->local proc~ice_frazil_uptake_multicat_impl->proc~eos_freezing_point proc~ice_frazil_uptake_multicat_impl->proc~ice_frazil_uptake_column proc~ice_enth_from_ts ice_enth_from_ts proc~ice_frazil_uptake_column->proc~ice_enth_from_ts proc~ice_enthalpy_liquid ice_enthalpy_liquid proc~ice_frazil_uptake_column->proc~ice_enthalpy_liquid proc~ice_rebalance_layers ice_rebalance_layers proc~ice_frazil_uptake_column->proc~ice_rebalance_layers proc~ice_t_freeze ice_t_freeze proc~ice_frazil_uptake_column->proc~ice_t_freeze

Called by

proc~~ice_frazil_uptake~~CalledByGraph proc~ice_frazil_uptake ice_frazil_uptake proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_frazil_uptake 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 proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: idx_S
integer, private :: idx_T

Source Code

   pure subroutine ice_frazil_uptake(grid, eos, ms, ice, dt_therm)
      !! Outer shim (outer-shim + flat-impl pattern): dereference the
      !! tracer registry (`ms%tracers(idx)%hTr`) on the HOST and forward
      !! bare arrays to the device kernel — NVHPC stdpar cannot follow
      !! the array-of-derived-types indirection inside a do-concurrent
      !! body (same rule as `ice_frazil_accumulate`). No-op when either
      !! S or T is unregistered.
      !!
      !! PR 4a dispatch (module docstring two-mode convention): `ncat==1`
      !! calls the EXISTING `ice_frazil_uptake_impl` byte-for-byte
      !! UNCHANGED (bit-identity with PR 3c); `ncat>1` calls the new
      !! `ice_frazil_uptake_multicat_impl`. The branch lives ONLY here —
      !! never inside a kernel.
      type(hgrid_t), intent(in) :: grid
      type(eos_t), intent(in) :: eos
      type(multilayer_state_t), intent(in) :: ms
         !! READ-ONLY: SST/SSS are SAMPLED here, never written — the
         !! ocean-side effect of the uptake (brine rejection) arrives
         !! only via `Q_salt` on the NEXT thermo window, through
         !! `ice_ocean_brine_flux` + `ocean_surface_flux_apply_tracers`.
      type(ocean_sea_ice_t), intent(inout) :: ice
      real(wp), intent(in) :: dt_therm
         !! Effective thermo timestep (s) — `ocean_dyn_t%therm_dt(dt)`.

      integer :: idx_T, idx_S

      idx_T = ms%idx_temperature
      idx_S = ms%idx_salinity
      if (idx_T <= 0 .or. idx_S <= 0) return

      if (ice%ncat == 1) then
         call ice_frazil_uptake_impl(ms%tracers(idx_T)%hTr, ms%tracers(idx_S)%hTr, &
                                     ms%h_layer, ms%wet_mask, eos, &
                                     ice%frazil_heat, ice%m_ice, ice%m_snow, &
                                     ice%enth_ice, ice%sal_ice, &
                                     ice%m_frozen_diag, ice%salt_flux_diag, &
                                     dt_therm, grid%nghost, ice%ncat, ice%nk_ice, &
                                     ms%nz_ml, grid%nx_total, grid%ny_total)
      else
         call ice_frazil_uptake_multicat_impl(ms%tracers(idx_T)%hTr, ms%tracers(idx_S)%hTr, &
                                              ms%h_layer, ms%wet_mask, eos, &
                                              ice%frazil_heat, ice%part_size, ice%m_ice, &
                                              ice%m_snow, ice%enth_ice, ice%sal_ice, &
                                              ice%m_frozen_diag, ice%salt_flux_diag, &
                                              dt_therm, grid%nghost, ice%ncat, ice%nk_ice, &
                                              ms%nz_ml, grid%nx_total, grid%ny_total)
      end if
   end subroutine ice_frazil_uptake