cavity_heat_fluxes Subroutine

public pure subroutine cavity_heat_fluxes(T_w, T_b, m_mass, gamma_t, ice, const, q_ocean, q_ice, q_latent)

The three heat fluxes of (E2), W/m^2:

q_ocean = rho_w*c_w*gamma_t*(T_w - T_b) ocean → interface q_ice = kh*(T_b - T_ice) + m_mass*c_i_eff*(T_b - T_ice) q_latent = m_mass*L_f

The closure q_ocean - q_ice - q_latent = 0 is what the unit tests assert to round-off, independently of any golden number.

The melt/freeze branch is taken here from sign(m_mass), which for both shipped ice modes is identical to the sign(T_star) branch the solve used (see the derivation block) — the two agree by construction, including at exactly zero melt.

This is a DIAGNOSTIC re-evaluation, so it carries no status: a reserved or invalid ice mode leaves c_i_eff = kh = 0, i.e. the insulating fluxes, and the refusal is reported by the SOLVER that produced m_mass in the first place.

Arguments

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

Far-field temperature (degC).

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

Interface temperature (degC).

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

Melt mass flux (kg/m^2/s).

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

Heat exchange velocity (m/s).

type(ocean_cavity_ice_t), intent(in) :: ice

Ice-conduction bundle.

type(ocean_cavity_const_t), intent(in) :: const

Constants bundle.

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

Turbulent heat flux ocean → interface (W/m^2).

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

Conductive + ice-warming flux interface → ice (W/m^2).

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

Latent heat consumed by the phase change (W/m^2).


Calls

proc~~cavity_heat_fluxes~~CallsGraph proc~cavity_heat_fluxes cavity_heat_fluxes proc~cavity_ice_terms cavity_ice_terms proc~cavity_heat_fluxes->proc~cavity_ice_terms proc~cavity_t_ice cavity_t_ice proc~cavity_heat_fluxes->proc~cavity_t_ice

Called by

proc~~cavity_heat_fluxes~~CalledByGraph proc~cavity_heat_fluxes cavity_heat_fluxes proc~cavity_solve_melt_f cavity_solve_melt_f proc~cavity_solve_melt_f->proc~cavity_heat_fluxes proc~cavity_melt_point_gamma_f cavity_melt_point_gamma_f proc~cavity_melt_point_gamma_f->proc~cavity_solve_melt_f proc~cavity_solve_melt cavity_solve_melt proc~cavity_solve_melt->proc~cavity_solve_melt_f proc~cavity_melt_columns_2d cavity_melt_columns_2d proc~cavity_melt_columns_2d->proc~cavity_melt_point_gamma_f proc~cavity_melt_point cavity_melt_point proc~cavity_melt_point->proc~cavity_solve_melt proc~cavity_melt_point_gamma cavity_melt_point_gamma proc~cavity_melt_point_gamma->proc~cavity_melt_point_gamma_f proc~cavity_melt_columns cavity_melt_columns proc~cavity_melt_columns->proc~cavity_melt_point proc~ocean_cavity_flux_step ocean_cavity_flux_step proc~ocean_cavity_flux_step->proc~cavity_melt_columns_2d proc~engine_step_finalize engine_step_finalize proc~engine_step_finalize->proc~ocean_cavity_flux_step

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: T_ice
real(kind=wp), private :: c_i_eff
integer, private :: ice_stat
real(kind=wp), private :: kh

Source Code

   pure subroutine cavity_heat_fluxes(T_w, T_b, m_mass, gamma_t, ice, const, &
                                      q_ocean, q_ice, q_latent)
      !! The three heat fluxes of (E2), W/m^2:
      !!
      !!   `q_ocean  = rho_w*c_w*gamma_t*(T_w - T_b)`  ocean → interface
      !!   `q_ice    = kh*(T_b - T_ice) + m_mass*c_i_eff*(T_b - T_ice)`
      !!   `q_latent = m_mass*L_f`
      !!
      !! The closure `q_ocean - q_ice - q_latent = 0` is what the unit
      !! tests assert to round-off, independently of any golden number.
      !!
      !! The melt/freeze branch is taken here from `sign(m_mass)`, which
      !! for both shipped ice modes is identical to the `sign(T_star)`
      !! branch the solve used (see the derivation block) — the two agree
      !! by construction, including at exactly zero melt.
      !!
      !! This is a DIAGNOSTIC re-evaluation, so it carries no status: a
      !! reserved or invalid ice mode leaves `c_i_eff = kh = 0`, i.e. the
      !! insulating fluxes, and the refusal is reported by the SOLVER
      !! that produced `m_mass` in the first place.
      !$acc routine seq
      real(wp), intent(in) :: T_w
         !! Far-field temperature (degC).
      real(wp), intent(in) :: T_b
         !! Interface temperature (degC).
      real(wp), intent(in) :: m_mass
         !! Melt mass flux (kg/m^2/s).
      real(wp), intent(in) :: gamma_t
         !! Heat exchange velocity (m/s).
      type(ocean_cavity_ice_t), intent(in) :: ice
         !! Ice-conduction bundle.
      type(ocean_cavity_const_t), intent(in) :: const
         !! Constants bundle.
      real(wp), intent(out) :: q_ocean
         !! Turbulent heat flux ocean → interface (W/m^2).
      real(wp), intent(out) :: q_ice
         !! Conductive + ice-warming flux interface → ice (W/m^2).
      real(wp), intent(out) :: q_latent
         !! Latent heat consumed by the phase change (W/m^2).
      real(wp) :: T_ice, c_i_eff, kh
      integer :: ice_stat

      T_ice = cavity_t_ice(ice)
      call cavity_ice_terms(ice, m_mass > 0.0_wp, const, c_i_eff, kh, ice_stat)
      q_ocean = const%rho_w*const%c_w*gamma_t*(T_w - T_b)
      q_ice = kh*(T_b - T_ice) + m_mass*c_i_eff*(T_b - T_ice)
      q_latent = m_mass*const%L_f
   end subroutine cavity_heat_fluxes