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.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
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 seqtype(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_wm_mass=0.0_wpend subroutine cavity_safe_state