isopycnal_vanish_tol Function

public pure function isopycnal_vanish_tol(angstrom_h, pd_floor) result(tol)

Shared vanish-tolerance for Phase-2/3 kernels: the layer is considered vanished when its thickness is at or below this value. Defined as max(angstrom_h, H_VANISHED) so both the physical floor (Phase 1) and the skip/merge marker are covered by a single threshold. Providing this as a pure helper ensures Phase 2 (reset_vanished_layer_velocities) and Phase 3 (apply_velocity_truncation gate + compute_max_cfl gate) cannot drift in their vanish definition.

pd_floor — the floor/tolerance collision fix (pdc 2c7ad0a1). Positive-definite continuity holds every floored layer at h >= h_lim = angstrom_h, so a floored (dynamically dead) layer sits AT or just-above the plain max(angstrom_h, H_VANISHED) = angstrom_h tolerance — and the h <= tol guards then classify it LIVE, leaving phantom maxvel velocities that the CFL clip can’t reach and that pin the panic MaxCFL (600² spoon, day-16 2.4696). When pd_floor = .true. (PD active, angstrom_h > H_VANISHED) the tolerance is lifted to angstrom_h + H_VANISHED — strictly ABOVE the floor it now rests on — so the at-floor band [h_lim, h_lim + H_VANISHED] reads as vanished. pd_floor absent / .false. ⇒ unchanged ⇒ bit-identical.

Arguments

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

Phase-1 floor (m); 0.0 when Phase 1 is off.

logical, intent(in), optional :: pd_floor

When .true. AND angstrom_h > H_VANISHED: lift the tolerance to angstrom_h + H_VANISHED (above the PD floor).

Return Value real(kind=wp)


Called by

proc~~isopycnal_vanish_tol~~CalledByGraph proc~isopycnal_vanish_tol isopycnal_vanish_tol proc~engine_setup engine_setup proc~engine_setup->proc~isopycnal_vanish_tol proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~isopycnal_vanish_tol proc~run_stage_split run_stage_split proc~ocean_dyn_step_split->proc~run_stage_split proc~run_stage_split->proc~isopycnal_vanish_tol proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~engine_step engine_step proc~driver_run_ocean->proc~engine_step proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~engine_step->proc~ocean_dyn_step_split proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step

Variables

Type Visibility Attributes Name Initial
logical, private :: pd

Source Code

   pure function isopycnal_vanish_tol(angstrom_h, pd_floor) result(tol)
      !! Shared vanish-tolerance for Phase-2/3 kernels: the layer is
      !! considered vanished when its thickness is at or below this value.
      !! Defined as max(angstrom_h, H_VANISHED) so both the physical
      !! floor (Phase 1) and the skip/merge marker are covered by a
      !! single threshold.  Providing this as a `pure` helper ensures
      !! Phase 2 (`reset_vanished_layer_velocities`) and Phase 3
      !! (`apply_velocity_truncation` gate + `compute_max_cfl` gate)
      !! cannot drift in their vanish definition.
      !!
      !! **`pd_floor` — the floor/tolerance collision fix (pdc 2c7ad0a1).**
      !! Positive-definite continuity holds every floored layer at
      !! `h >= h_lim = angstrom_h`, so a floored (dynamically dead) layer
      !! sits AT or just-above the plain `max(angstrom_h, H_VANISHED) =
      !! angstrom_h` tolerance — and the `h <= tol` guards then classify it
      !! LIVE, leaving phantom maxvel velocities that the CFL clip can't
      !! reach and that pin the panic MaxCFL (600² spoon, day-16 2.4696).
      !! When `pd_floor = .true.` (PD active, `angstrom_h > H_VANISHED`)
      !! the tolerance is lifted to `angstrom_h + H_VANISHED` — strictly
      !! ABOVE the floor it now rests on — so the at-floor band
      !! `[h_lim, h_lim + H_VANISHED]` reads as vanished.  `pd_floor`
      !! absent / .false. ⇒ unchanged ⇒ bit-identical.
      real(wp), intent(in) :: angstrom_h
         !! Phase-1 floor (m); 0.0 when Phase 1 is off.
      logical, intent(in), optional :: pd_floor
         !! When .true. AND `angstrom_h > H_VANISHED`: lift the tolerance
         !! to `angstrom_h + H_VANISHED` (above the PD floor).
      real(wp) :: tol
      logical :: pd
      pd = .false.
      if (present(pd_floor)) pd = pd_floor
      if (pd .and. angstrom_h > H_VANISHED) then
         tol = angstrom_h + H_VANISHED
      else
         tol = max(angstrom_h, H_VANISHED)
      end if
   end function isopycnal_vanish_tol