Rebuild of the transient per-term KE attribution meter used to
localise the split-corrector anti-damping term
(LAGRANGIAN_PGF_BUG.md §R). Samples the h-weighted layer
kinetic energy between the split stage’s tendency applies and
prints KE_ATTR rows: the dKE between consecutive samples IS the
energy injected/removed by the segment just executed, so one
instrumented run names the anti-damping term directly.
Three regions per sample, one device pass (three reduction(+:)
accumulators):
full — all physical cells;
rim — cells within rim_band of any physical wall (the slow
exponential is rim-trapped);
east — cells within east_band of the east wall (the mode-1
internal Kelvin wave is wall-trapped there).
Gated by &ocean_bt_nml debug_ke_attr with an optional
[ke_attr_start_step, ke_attr_end_step] outer-step window.
Default off ⇒ bit-identical (untaken branches only). Single-rank
debug tool: no halo reduction — multi-rank sums are per-rank.
module~~rdb_ocean_ke_probe~~UsesGraph
module~rdb_ocean_ke_probe
rdb_ocean_ke_probe
module~rdb_constants
rdb_constants
module~rdb_ocean_ke_probe->module~rdb_constants
module~rdb_coriolis_adv
rdb_coriolis_adv
module~rdb_ocean_ke_probe->module~rdb_coriolis_adv
module~rdb_grid
rdb_grid
module~rdb_ocean_ke_probe->module~rdb_grid
module~rdb_multilayer_state
rdb_multilayer_state
module~rdb_ocean_ke_probe->module~rdb_multilayer_state
module~rdb_ocean_metrics
rdb_ocean_metrics
module~rdb_ocean_ke_probe->module~rdb_ocean_metrics
pic_types
pic_types
module~rdb_constants->pic_types
module~rdb_coriolis_adv->module~rdb_constants
module~rdb_coriolis_adv->module~rdb_grid
module~rdb_coriolis_adv->module~rdb_multilayer_state
module~rdb_coriolis_adv->module~rdb_ocean_metrics
iso_fortran_env
iso_fortran_env
module~rdb_coriolis_adv->iso_fortran_env
module~rdb_barotropic_state
rdb_barotropic_state
module~rdb_coriolis_adv->module~rdb_barotropic_state
module~rdb_mem_report
rdb_mem_report
module~rdb_coriolis_adv->module~rdb_mem_report
module~rdb_ocean_porous
rdb_ocean_porous
module~rdb_coriolis_adv->module~rdb_ocean_porous
module~rdb_scratch_3d
rdb_scratch_3d
module~rdb_coriolis_adv->module~rdb_scratch_3d
module~rdb_grid->module~rdb_constants
module~rdb_multilayer_state->module~rdb_constants
module~rdb_multilayer_state->module~rdb_grid
module~rdb_multilayer_state->iso_fortran_env
module~rdb_efp
rdb_efp
module~rdb_multilayer_state->module~rdb_efp
module~rdb_error_ring
rdb_error_ring
module~rdb_multilayer_state->module~rdb_error_ring
module~rdb_multilayer_state->module~rdb_mem_report
module~rdb_tracer
rdb_tracer
module~rdb_multilayer_state->module~rdb_tracer
pic_logger
pic_logger
module~rdb_multilayer_state->pic_logger
module~rdb_ocean_metrics->module~rdb_constants
module~rdb_ocean_metrics->module~rdb_grid
module~rdb_ocean_metrics->iso_fortran_env
module~rdb_ocean_metrics->module~rdb_error_ring
module~rdb_io_netcdf
rdb_io_netcdf
module~rdb_ocean_metrics->module~rdb_io_netcdf
module~rdb_ocean_metrics->module~rdb_mem_report
module~rdb_ocean_bipolar
rdb_ocean_bipolar
module~rdb_ocean_metrics->module~rdb_ocean_bipolar
module~rdb_ocean_fold
rdb_ocean_fold
module~rdb_ocean_metrics->module~rdb_ocean_fold
module~rdb_ocean_status
rdb_ocean_status
module~rdb_ocean_metrics->module~rdb_ocean_status
netcdf
netcdf
module~rdb_ocean_metrics->netcdf
module~rdb_ocean_metrics->pic_logger
pic_strings
pic_strings
module~rdb_ocean_metrics->pic_strings
module~rdb_barotropic_state->module~rdb_constants
module~rdb_barotropic_state->module~rdb_grid
module~rdb_barotropic_state->iso_fortran_env
module~rdb_barotropic_state->module~rdb_mem_report
module~rdb_efp->iso_fortran_env
ieee_arithmetic
ieee_arithmetic
module~rdb_efp->ieee_arithmetic
module~rdb_error_ring->pic_logger
module~rdb_io_netcdf->module~rdb_constants
module~rdb_io_netcdf->iso_fortran_env
module~rdb_io_netcdf->module~rdb_error_ring
module~rdb_io_netcdf->netcdf
module~rdb_io_netcdf->pic_logger
module~rdb_io_netcdf->pic_strings
iso_c_binding
iso_c_binding
module~rdb_io_netcdf->iso_c_binding
module~rdb_mem_report->module~rdb_constants
module~rdb_mem_report->iso_fortran_env
module~rdb_mem_report->pic_logger
module~rdb_mem_report->pic_strings
module~rdb_ocean_bipolar->module~rdb_constants
module~rdb_ocean_fold->module~rdb_constants
module~rdb_ocean_porous->module~rdb_constants
module~rdb_ocean_porous->ieee_arithmetic
module~rdb_scratch_3d->module~rdb_constants
module~rdb_scratch_3d->iso_fortran_env
module~rdb_scratch_3d->module~rdb_mem_report
module~rdb_tracer->module~rdb_constants
module~rdb_tracer->module~rdb_grid
module~rdb_tracer->iso_fortran_env
module~rdb_tracer->module~rdb_mem_report
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
module~~rdb_ocean_ke_probe~~UsedByGraph
module~rdb_ocean_ke_probe
rdb_ocean_ke_probe
module~rdb_ocean_dyn
rdb_ocean_dyn
module~rdb_ocean_dyn->module~rdb_ocean_ke_probe
module~rdb_driver
rdb_driver
module~rdb_driver->module~rdb_ocean_dyn
module~rdb_ocean_engine
rdb_ocean_engine
module~rdb_driver->module~rdb_ocean_engine
module~rdb_ocean_state
rdb_ocean_state
module~rdb_driver->module~rdb_ocean_state
module~rdb_ocean_api
rdb_ocean_api
module~rdb_ocean_api->module~rdb_ocean_dyn
module~rdb_ocean_api->module~rdb_ocean_engine
module~rdb_handle
rdb_handle
module~rdb_ocean_api->module~rdb_handle
module~rdb_ocean_diag_derived
rdb_ocean_diag_derived
module~rdb_ocean_api->module~rdb_ocean_diag_derived
module~rdb_ocean_diag_fills
rdb_ocean_diag_fills
module~rdb_ocean_api->module~rdb_ocean_diag_fills
module~rdb_ocean_engine->module~rdb_ocean_dyn
module~rdb_ocean_setup
rdb_ocean_setup
module~rdb_ocean_engine->module~rdb_ocean_setup
module~rdb_ocean_engine->module~rdb_ocean_state
module~rdb_ocean_engine->module~rdb_ocean_diag_derived
module~rdb_ocean_engine->module~rdb_ocean_diag_fills
module~rdb_ocean_setup->module~rdb_ocean_dyn
module~rdb_ocean_setup->module~rdb_ocean_state
module~rdb_ocean_state->module~rdb_ocean_dyn
module~rdb_handle->module~rdb_ocean_engine
module~rdb_handle->module~rdb_ocean_state
module~rdb_ocean_diag_derived->module~rdb_ocean_state
module~rdb_ocean_diag_derived->module~rdb_ocean_diag_fills
module~rdb_ocean_diag_fills->module~rdb_ocean_state
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Derived Types
Config + running state for the KE attribution meter. Lives on
ocean_dyn_t; host-only (never device-mapped).
Components
Type
Visibility Attributes
Name
Initial
integer,
public
::
east_band
=
16
East-wall band width in cells (the Kelvin-wave region; 16
covers the ~6-cell internal-radius wall trapping).
logical,
public
::
enable
=
.false.
Master gate — &ocean_bt_nml debug_ke_attr.
integer,
public
::
end_step
=
0
Last outer step to sample (0 = no upper bound).
logical,
public
::
have_prev
=
.false.
.true. once a sample has landed; first row prints dKE = KE.
logical,
public
::
header_done
=
.false.
Column-header row emitted.
real(kind=wp),
public
::
prev_east
=
0.0_wp
KE at the previous sample, per region.
real(kind=wp),
public
::
prev_full
=
0.0_wp
real(kind=wp),
public
::
prev_rim
=
0.0_wp
integer,
public
::
rim_band
=
8
Rim-region width in cells (distance from any physical wall).
integer,
public
::
start_step
=
0
First outer step to sample (0 = from the start).
Functions
Gate: enabled AND inside the step window.
Arguments
Type
Intent Optional Attributes
Name
type(ke_probe_t ),
intent(in)
::
probe
integer,
intent(in)
::
step
Return Value
logical
Subroutines
Sub-attribute the coriolis_adv segment: split the just-applied
tendency into its PV-flux part and its −∇KE part and print each
part’s work integral per region (KE_ATTR_PV rows). Call
immediately AFTER coriolis_adv_apply_tendencies (and after
the “coriolis_adv” KE_ATTR sample).
Read more…
Arguments
Type
Intent Optional Attributes
Name
type(hgrid_t ),
intent(in)
::
grid
type(ocean_metrics_t ),
intent(in)
::
metrics
type(multilayer_state_t ),
intent(in)
::
ms
type(coriolis_adv_t ),
intent(in)
::
cor
type(ke_probe_t ),
intent(inout)
::
probe
integer,
intent(in)
::
stage
integer,
intent(in)
::
step
real(kind=wp),
intent(in)
::
dt
Sample the three-region layer KE and print the attribution row.
Call AFTER the segment being attributed; the printed dKE is
“this sample minus the previous one” — i.e. the segment’s
energy contribution. Drains all device queues first so the
async velocity-apply chain (queue 1) has landed.
Arguments
Type
Intent Optional Attributes
Name
type(hgrid_t ),
intent(in)
::
grid
type(multilayer_state_t ),
intent(in)
::
ms
type(ke_probe_t ),
intent(inout)
::
probe
character(len=*),
intent(in)
::
label
Segment tag, e.g. “coriolis_adv”, “bt_correction”.
integer,
intent(in)
::
stage
integer,
intent(in)
::
step
Device pass: per-face PV/∇KE work split, three regions.
Faces attributed to their west/south cell’s region mask.
Arguments
Type
Intent Optional Attributes
Name
real(kind=wp),
intent(in)
::
h (nx,ny,nz)
real(kind=wp),
intent(in)
::
u (nx+1,ny,nz)
real(kind=wp),
intent(in)
::
v (nx,ny+1,nz)
real(kind=wp),
intent(in)
::
fx (nx+1,ny,nz)
real(kind=wp),
intent(in)
::
fy (nx,ny+1,nz)
real(kind=wp),
intent(in)
::
kec (nx,ny,nz)
real(kind=wp),
intent(in)
::
idxCu (nx+1,ny)
real(kind=wp),
intent(in)
::
idyCv (nx,ny+1)
integer,
intent(in)
::
nx
integer,
intent(in)
::
ny
integer,
intent(in)
::
nz
integer,
intent(in)
::
nghost
integer,
intent(in)
::
nx_phys
integer,
intent(in)
::
ny_phys
integer,
intent(in)
::
rim_w
integer,
intent(in)
::
east_w
real(kind=wp),
intent(in)
::
dt
real(kind=wp),
intent(out)
::
wpv_full
real(kind=wp),
intent(out)
::
wpv_rim
real(kind=wp),
intent(out)
::
wpv_east
real(kind=wp),
intent(out)
::
wke_full
real(kind=wp),
intent(out)
::
wke_rim
real(kind=wp),
intent(out)
::
wke_east
h-weighted layer KE over the three regions, one device pass.
Per cell: KE = Σ_k [ ¼(h_W·u_W² + h_E·u_E²) + ¼(h_S·v_S² + h_N·v_N²) ]
with h_face the centred face thickness (m³/s² per unit area;
uniform-Δx Cartesian, so the area factor is a constant and is
dropped — attribution only needs a consistent measure).
Explicit OpenACC reduction — a sum() intrinsic on a
present-mapped array silently runs host-side under NVHPC
non-managed mode and returns the stale host shadow.
Arguments
Type
Intent Optional Attributes
Name
real(kind=wp),
intent(in)
::
h (nx,ny,nz)
real(kind=wp),
intent(in)
::
u (nx+1,ny,nz)
real(kind=wp),
intent(in)
::
v (nx,ny+1,nz)
integer,
intent(in)
::
nx
integer,
intent(in)
::
ny
integer,
intent(in)
::
nz
integer,
intent(in)
::
nghost
integer,
intent(in)
::
nx_phys
integer,
intent(in)
::
ny_phys
integer,
intent(in)
::
rim_w
integer,
intent(in)
::
east_w
real(kind=wp),
intent(out)
::
ke_full
real(kind=wp),
intent(out)
::
ke_rim
real(kind=wp),
intent(out)
::
ke_east