budget_contributor_t Derived Type

type, public :: budget_contributor_t

One source/sink of a conserved quantity, populated by a physics kernel each step (adds dt·delta into per_cell) and drained at eval cadence (drain_contributors integrates per_cell·mask·dA over k into total_integrated, then zeroes per_cell). total_integrated is the cumulative RHS checked against LHS = current_total − values_init.


Inherited by

type~~budget_contributor_t~~InheritedByGraph type~budget_contributor_t budget_contributor_t type~ocean_budgets_t ocean_budgets_t type~ocean_budgets_t->type~budget_contributor_t contributors

Components

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

True when per_cell lives on the GPU (mapped via OpenACC by the owning kernel); drain_contributors then acc update self before integrating and acc update device after zeroing. Default false = host-only kernels / synthetic tests.

logical, public :: is_active = .false.
character(len=64), public :: name = ""

Identifier — “continuity”, “vert_diff_heat”, “surface_heat_flux”, …

real(kind=wp), public, pointer :: per_cell(:,:,:) => null()

Kernel-owned per-step accumulator; manager holds a non-owning pointer (kernel guarantees the array outlives registration).

integer, public :: quantity = 0

Tag from BUDGET_* (MASS / SALT_TOTAL / HEAT_TOTAL / …).

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

Cumulative spatial integral of contributions drained so far this run. Sign convention: positive = source.


Source Code

   type :: budget_contributor_t
      !! One source/sink of a conserved quantity, populated by a physics
      !! kernel each step (adds `dt·delta` into `per_cell`) and drained at
      !! eval cadence (`drain_contributors` integrates `per_cell·mask·dA`
      !! over k into `total_integrated`, then zeroes `per_cell`).
      !! `total_integrated` is the cumulative RHS checked against
      !! LHS = current_total − values_init.
      character(len=64) :: name = ""
         !! Identifier — "continuity", "vert_diff_heat", "surface_heat_flux", ...
      integer :: quantity = 0
         !! Tag from BUDGET_* (MASS / SALT_TOTAL / HEAT_TOTAL / ...).
      real(wp), pointer :: per_cell(:, :, :) => null()
         !! Kernel-owned per-step accumulator; manager holds a non-owning
         !! pointer (kernel guarantees the array outlives registration).
      real(wp) :: total_integrated = 0.0_wp
         !! Cumulative spatial integral of contributions drained so
         !! far this run.  Sign convention: positive = source.
      logical :: is_active = .false.
      logical :: device_resident = .false.
         !! True when `per_cell` lives on the GPU (mapped via OpenACC by the
         !! owning kernel); `drain_contributors` then `acc update self`
         !! before integrating and `acc update device` after zeroing.
         !! Default false = host-only kernels / synthetic tests.
   end type budget_contributor_t