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.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | device_resident | = | .false. |
True when |
|
| 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. |
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