conservation_budget_t Derived Type

type, public :: conservation_budget_t

Cumulative (time-integrated, since t=0) budget terms that CLOSE the domain integral of each extensive quantity, so the reported Error is a true numerical-leak residual even with open boundaries + surface forcing. For quantity Q the residual is

leak_Q = (Q_total − Q0) + out_Q − src_Q

(change in the domain integral, plus what left through the open boundaries, minus what the surface added), which should stay ~round-off for a conservative scheme. Same units as the matching total. A quantity whose *_active flag is .false. falls back to raw drift (Q_total − Q0)/Q0 — byte-identical to the pre-budget behaviour (used for the not-yet-instrumented quantities/paths).


Components

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

budget residual + shows out/src; .false. ⇒ plain drift. Per-quantity so a phased rollout (mass first) doesn’t print misleading out 0 for a quantity whose flux isn’t tracked yet.

real(kind=wp), public :: heat_out = 0.0_wp

Net OUTFLUX through open boundaries (positive = left the domain).

real(kind=wp), public :: heat_src = 0.0_wp

Net SURFACE source (positive = added to the domain: precip, surface heat/salt flux).

logical, public :: mass_active = .false.
real(kind=wp), public :: mass_out = 0.0_wp
real(kind=wp), public :: mass_src = 0.0_wp
logical, public :: salt_active = .false.
real(kind=wp), public :: salt_out = 0.0_wp
real(kind=wp), public :: salt_src = 0.0_wp

Source Code

   type :: conservation_budget_t
      !! Cumulative (time-integrated, since t=0) budget terms that CLOSE the
      !! domain integral of each extensive quantity, so the reported `Error`
      !! is a true numerical-leak residual even with open boundaries + surface
      !! forcing.  For quantity Q the residual is
      !!
      !!   leak_Q = (Q_total − Q0) + out_Q − src_Q
      !!
      !! (change in the domain integral, plus what left through the open
      !! boundaries, minus what the surface added), which should stay
      !! ~round-off for a conservative scheme.  Same units as the matching
      !! total.  A quantity whose `*_active` flag is `.false.` falls back to
      !! raw drift `(Q_total − Q0)/Q0` — byte-identical to the pre-budget
      !! behaviour (used for the not-yet-instrumented quantities/paths).
      real(wp) :: mass_out = 0.0_wp
      real(wp) :: salt_out = 0.0_wp
      real(wp) :: heat_out = 0.0_wp
         !! Net OUTFLUX through open boundaries (positive = left the domain).
      real(wp) :: mass_src = 0.0_wp
      real(wp) :: salt_src = 0.0_wp
      real(wp) :: heat_src = 0.0_wp
         !! Net SURFACE source (positive = added to the domain: precip,
         !! surface heat/salt flux).
      logical :: mass_active = .false.
      logical :: salt_active = .false.
      logical :: heat_active = .false.
         !! Per-quantity: `.true.` ⇒ that quantity's `Error` is the closed
         !! budget residual + shows `out`/`src`; `.false.` ⇒ plain drift.
         !! Per-quantity so a phased rollout (mass first) doesn't print
         !! misleading `out 0` for a quantity whose flux isn't tracked yet.
   end type conservation_budget_t