console_stats_t Derived Type

type, public :: console_stats_t

Holds initial-snapshot values for relative-drift reporting. is_initialised flips on the first report call.


Inherits

type~~console_stats_t~~InheritsGraph type~console_stats_t console_stats_t type~efp_t efp_t type~console_stats_t->type~efp_t mass0_efp, salt0_efp, heat0_efp

Components

Type Visibility Attributes Name Initial
logical, public :: exact_sums = .false.

.true. once mass_efp/salt_efp/heat_efp have been latched (the ocean EFP path is active); gates whether emit_drift_line’s caller may rely on mass0_efp etc. being meaningful. Coastal callers never set this (stays .false. for the lifetime of a coastal run’s console_stats_t).

real(kind=wp), public :: heat0 = 0.0_wp
type(efp_t), public :: heat0_efp

alongside mass0/salt0/heat0 on the first report when the caller supplies mass_efp/salt_efp/heat_efp (the ocean reproducing_sums = .true. path). Their sole purpose is efp_real_diff(current_efp, mass0_efp) – a difference formed in FIXED POINT, not current - mass0 in double. This is the SS2.2 fix: latching the reference as a real(wp) alone (as mass0 does) already quantises it to ~1 ulp of a ~1e21 total (~1.3e5 kg) before any subtraction happens, so an exact SUM feeding an unchanged double-difference would not move the drift floor at all.

real(kind=wp), public :: heat_out0 = 0.0_wp
real(kind=wp), public :: heat_src0 = 0.0_wp
logical, public :: is_initialised = .false.
real(kind=wp), public :: ke0 = 0.0_wp
real(kind=wp), public :: mass0 = 0.0_wp
type(efp_t), public :: mass0_efp

alongside mass0/salt0/heat0 on the first report when the caller supplies mass_efp/salt_efp/heat_efp (the ocean reproducing_sums = .true. path). Their sole purpose is efp_real_diff(current_efp, mass0_efp) – a difference formed in FIXED POINT, not current - mass0 in double. This is the SS2.2 fix: latching the reference as a real(wp) alone (as mass0 does) already quantises it to ~1 ulp of a ~1e21 total (~1.3e5 kg) before any subtraction happens, so an exact SUM feeding an unchanged double-difference would not move the drift floor at all.

real(kind=wp), public :: mass_out0 = 0.0_wp
real(kind=wp), public :: mass_src0 = 0.0_wp
logical, public :: panic_on_cfl = .true.

Early-stop abort when MaxCFL exceeds the panic threshold. Right for the ocean (advective CFL IS its stability criterion), but the coastal path sets this .false.: coastal stability is gravity-wave-limited, so a high advective CFL is normal (fast shallow flows) and must not trip a spurious abort.

logical, public :: panic_on_nan = .true.

Early-stop abort when any stat is NaN (a NaN is always fatal).

logical, public :: report_thermodynamics = .true.

.false. suppresses the Salt / Temp columns + detail blocks (a 2D-barotropic / adiabatic run has no meaningful S/T, so it doesn’t print misleading lines).

real(kind=wp), public :: salt0 = 0.0_wp
type(efp_t), public :: salt0_efp

alongside mass0/salt0/heat0 on the first report when the caller supplies mass_efp/salt_efp/heat_efp (the ocean reproducing_sums = .true. path). Their sole purpose is efp_real_diff(current_efp, mass0_efp) – a difference formed in FIXED POINT, not current - mass0 in double. This is the SS2.2 fix: latching the reference as a real(wp) alone (as mass0 does) already quantises it to ~1 ulp of a ~1e21 total (~1.3e5 kg) before any subtraction happens, so an exact SUM feeding an unchanged double-difference would not move the drift floor at all.

real(kind=wp), public :: salt_out0 = 0.0_wp
real(kind=wp), public :: salt_src0 = 0.0_wp

Source Code

   type :: console_stats_t
      !! Holds initial-snapshot values for relative-drift reporting.
      !! `is_initialised` flips on the first `report` call.
      logical :: is_initialised = .false.
      real(wp) :: mass0 = 0.0_wp
      real(wp) :: salt0 = 0.0_wp
      real(wp) :: heat0 = 0.0_wp
      real(wp) :: ke0 = 0.0_wp
      ! Cumulative budget terms at the reference (latched with the totals on
      ! the first report), so the residual is measured over the SAME window
      ! as the drift — the accumulators run from t=0 but the reference report
      ! may fire after a warmup step.
      real(wp) :: mass_out0 = 0.0_wp, salt_out0 = 0.0_wp, heat_out0 = 0.0_wp
      real(wp) :: mass_src0 = 0.0_wp, salt_src0 = 0.0_wp, heat_src0 = 0.0_wp
      type(efp_t) :: mass0_efp, salt0_efp, heat0_efp
         !! PR-32: extended-fixed-point (EFP) reference snapshots, latched
         !! alongside `mass0`/`salt0`/`heat0` on the first report when the
         !! caller supplies `mass_efp`/`salt_efp`/`heat_efp` (the ocean
         !! `reproducing_sums = .true.` path).  Their sole purpose is
         !! `efp_real_diff(current_efp, mass0_efp)` -- a difference formed
         !! in FIXED POINT, not `current - mass0` in double.  This is the
         !! SS2.2 fix: latching the reference as a `real(wp)` alone (as
         !! `mass0` does) already quantises it to ~1 ulp of a ~1e21 total
         !! (~1.3e5 kg) before any subtraction happens, so an exact SUM
         !! feeding an unchanged double-difference would not move the
         !! drift floor at all.
      logical :: exact_sums = .false.
         !! `.true.` once `mass_efp`/`salt_efp`/`heat_efp` have been
         !! latched (the ocean EFP path is active); gates whether
         !! `emit_drift_line`'s caller may rely on `mass0_efp` etc. being
         !! meaningful.  Coastal callers never set this (stays `.false.`
         !! for the lifetime of a coastal run's `console_stats_t`).
      logical :: report_thermodynamics = .true.
         !! `.false.` suppresses the Salt / Temp columns + detail blocks
         !! (a 2D-barotropic / adiabatic run has no meaningful S/T, so it
         !! doesn't print misleading lines).
      logical :: panic_on_nan = .true.
         !! Early-stop abort when any stat is NaN (a NaN is always fatal).
      logical :: panic_on_cfl = .true.
         !! Early-stop abort when MaxCFL exceeds the panic threshold.  Right
         !! for the ocean (advective CFL IS its stability criterion), but
         !! the coastal path sets this `.false.`: coastal stability is
         !! gravity-wave-limited, so a high *advective* CFL is normal (fast
         !! shallow flows) and must not trip a spurious abort.
   end type console_stats_t