vcoord_h_min_is_coherent Function

public pure function vcoord_h_min_is_coherent(coord_type, h_min) result(ok)

Is zstar_h_min coherent with the contract coord_type gives it?

.false. for exactly two configurations, both of which are silently wrong rather than loudly broken at runtime:

  1. h_min <= 0 — any family. Defeats the knob’s one documented purpose (never hand a kernel an exactly-zero target_h) with no diagnostic; a negative value puts negative thicknesses into the target grid. validate_config REFUSES this.
  2. h_min > H_VANISHED under an INERT-role family. The below-bed filler layers stop being vanished and start participating in the physics — see vcoord_h_min_role. Callers that genuinely want a LIVE minimum layer thickness want the D4 floor knob (&ocean_isopycnal_nml angstrom_h), not this one. validate_config only WARNS on this one today: the repo’s own Python worked example sits in the band, so refusing it would stop a configuration that runs. Promoting it to fail-loud is a deliberate, answer-changing follow-up — this predicate already returns .false., so that promotion is a one-line change at the call site, not a re-derivation of the rule.

h_min == H_VANISHED is accepted: every downstream vanish gate is a strict > H_VANISHED, so a layer sitting exactly on the marker still reads as vanished. It is the boundary, though — the shipped namelists sit on it, so any gate that ever relaxes to >= changes their answers.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: coord_type

VCOORD_* code (from parse_vcoord_type).

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

The configured &vcoord_nml zstar_h_min (m).

Return Value logical


Calls

proc~~vcoord_h_min_is_coherent~~CallsGraph proc~vcoord_h_min_is_coherent vcoord_h_min_is_coherent proc~vcoord_h_min_role vcoord_h_min_role proc~vcoord_h_min_is_coherent->proc~vcoord_h_min_role

Called by

proc~~vcoord_h_min_is_coherent~~CalledByGraph proc~vcoord_h_min_is_coherent vcoord_h_min_is_coherent proc~validate_config validate_config proc~validate_config->proc~vcoord_h_min_is_coherent proc~build_pending_handle build_pending_handle proc~build_pending_handle->proc~validate_config proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~build_pending_handle proc~rdb_ocean_create_pending rdb_ocean_create_pending proc~rdb_ocean_create_pending->proc~build_pending_handle

Source Code

   pure logical function vcoord_h_min_is_coherent(coord_type, h_min) result(ok)
      !! Is `zstar_h_min` coherent with the contract `coord_type` gives it?
      !!
      !! `.false.` for exactly two configurations, both of which are silently
      !! wrong rather than loudly broken at runtime:
      !!
      !!  1. `h_min <= 0` — any family.  Defeats the knob's one documented
      !!     purpose (never hand a kernel an exactly-zero `target_h`) with no
      !!     diagnostic; a negative value puts negative thicknesses into the
      !!     target grid.  `validate_config` REFUSES this.
      !!  2. `h_min > H_VANISHED` under an INERT-role family.  The below-bed
      !!     filler layers stop being vanished and start participating in the
      !!     physics — see `vcoord_h_min_role`.  Callers that genuinely want a
      !!     LIVE minimum layer thickness want the D4 floor knob
      !!     (`&ocean_isopycnal_nml angstrom_h`), not this one.
      !!     `validate_config` only WARNS on this one today: the repo's own
      !!     Python worked example sits in the band, so refusing it would
      !!     stop a configuration that runs.  Promoting it to fail-loud is a
      !!     deliberate, answer-changing follow-up — this predicate already
      !!     returns `.false.`, so that promotion is a one-line change at the
      !!     call site, not a re-derivation of the rule.
      !!
      !! `h_min == H_VANISHED` is accepted: every downstream vanish gate is a
      !! strict `> H_VANISHED`, so a layer sitting exactly on the marker still
      !! reads as vanished.  It is the boundary, though — the shipped
      !! namelists sit on it, so any gate that ever relaxes to `>=` changes
      !! their answers.
      integer, intent(in) :: coord_type
         !! `VCOORD_*` code (from `parse_vcoord_type`).
      real(wp), intent(in) :: h_min
         !! The configured `&vcoord_nml zstar_h_min` (m).
      ok = .true.
      if (h_min <= 0.0_wp) then
         ok = .false.
      else if (vcoord_h_min_role(coord_type) == VCOORD_HMIN_INERT .and. &
               h_min > H_VANISHED) then
         ok = .false.
      end if
   end function vcoord_h_min_is_coherent