cavity_safe_state Subroutine

private pure subroutine cavity_safe_state(eos, S_w, p_b, T_b, S_b, m_mass)

The documented SAFE STATE returned on every non-OK status: zero melt, interface salinity equal to the far field, interface temperature on the liquidus there. m_mass is EXACTLY zero, so a failed column contributes nothing to a heat/salt budget rather than contributing a plausible wrong number.

T_b/S_b inherit whatever S_w/p_b were: if the caller handed in a NaN, a NaN comes back. That is deliberate — this routine must not INVENT a finite interface state out of corrupted input. The melt flux, the one output that would silently poison a budget, is the one pinned to zero.

Arguments

Type IntentOptional Attributes Name
type(eos_t), intent(in) :: eos

Shared EOS handle — carries the liquidus coefficient set.

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

Far-field salinity (g/kg).

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

Interface pressure (Pa).

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

Interface temperature (degC) = T_f(S_w, p_b).

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

Interface salinity (g/kg) = S_w.

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

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


Calls

proc~~cavity_safe_state~~CallsGraph proc~cavity_safe_state cavity_safe_state proc~eos_freezing_point eos_freezing_point proc~cavity_safe_state->proc~eos_freezing_point

Called by

proc~~cavity_safe_state~~CalledByGraph proc~cavity_safe_state cavity_safe_state proc~cavity_solve_melt_f cavity_solve_melt_f proc~cavity_solve_melt_f->proc~cavity_safe_state proc~cavity_state_at_x cavity_state_at_x proc~cavity_solve_melt_f->proc~cavity_state_at_x proc~cavity_state_at_x->proc~cavity_safe_state proc~cavity_three_equation cavity_three_equation proc~cavity_state_at_x->proc~cavity_three_equation proc~cavity_three_equation->proc~cavity_safe_state proc~cavity_two_equation cavity_two_equation proc~cavity_two_equation->proc~cavity_safe_state 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

Source Code

   pure subroutine cavity_safe_state(eos, S_w, p_b, T_b, S_b, m_mass)
      !! The documented SAFE STATE returned on every non-OK status: zero
      !! melt, interface salinity equal to the far field, interface
      !! temperature on the liquidus there.  `m_mass` is EXACTLY zero, so
      !! a failed column contributes nothing to a heat/salt budget rather
      !! than contributing a plausible wrong number.
      !!
      !! `T_b`/`S_b` inherit whatever `S_w`/`p_b` were: if the caller
      !! handed in a NaN, a NaN comes back.  That is deliberate — this
      !! routine must not INVENT a finite interface state out of
      !! corrupted input.  The melt flux, the one output that would
      !! silently poison a budget, is the one pinned to zero.
      !$acc routine seq
      type(eos_t), intent(in) :: eos
         !! Shared EOS handle — carries the liquidus coefficient set.
      real(wp), intent(in) :: S_w
         !! Far-field salinity (g/kg).
      real(wp), intent(in) :: p_b
         !! Interface pressure (Pa).
      real(wp), intent(out) :: T_b
         !! Interface temperature (degC) = `T_f(S_w, p_b)`.
      real(wp), intent(out) :: S_b
         !! Interface salinity (g/kg) = `S_w`.
      real(wp), intent(out) :: m_mass
         !! Melt mass flux (kg/m^2/s) = exactly 0.
      T_b = eos_freezing_point(eos, S_w, p_b)
      S_b = S_w
      m_mass = 0.0_wp
   end subroutine cavity_safe_state