Owns the diagnostics pipeline for the ocean dynamical core. Built around the following design points (Phase 6 work):
Pull model, not push. Kernels write to state and
stay diag-agnostic; this manager iterates a registry each
output step, fetches the source array (by pointer / by
enum tag), remaps onto the configured output vertical
grid, accumulates time means, and hands the ready buffer
to the I/O server. Kernels never call diag%send(...).
Compute-side remap. Layer→z, layer→isopycnal, and
time-mean accumulation all happen on the compute rank
before hand-off. The I/O server then only has to do
compression + netcdf write. Keeps the I/O server lean
(no physics-aware code) at the cost of carrying the
remap target buffers on every compute rank — which is
cheap since they’re shape (nx, ny, nz_out) not
(nx_global, ny_global, nz_out).
I/O server interaction. When a diag_var_t’s
cadence fires, this manager calls io_server_send(buf,
meta) on the per-rank send queue. Backpressure (server
slower than compute) shows up as a hung send and is
logged. Hand-off contract: the manager owns the buffer
lifetime; the I/O server gets a non-owning view.
Phase 0e status: empty scaffold. Components are declared so
Phase 6 can fill in register / step / send_ready without
restructuring the god state. The bound procedures init/destroy
are no-ops on the empty registry.
Collaborator hand-off: this slot is independent of the
dynamical core — once ocean_diag_register lands, every other
kernel can be diagnosed without modification. Good first task
for a new contributor with FMS / diag_manager experience.
Exposed for test_ocean_diag_reduce: the emit-path statistics
reduction is the only device kernel in this module, so it is unit
tested directly (numerics + mem:separate residency) rather than
only through step.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | DIAG_COORD_UNSET | = | 0 |
|
| integer, | public, | parameter | :: | DIAG_LOC_CENTER | = | 1 |
cell centre |
| integer, | public, | parameter | :: | DIAG_LOC_CORNER | = | 4 |
south-west corner |
| integer, | public, | parameter | :: | DIAG_LOC_FACE_X | = | 2 |
east face |
| integer, | public, | parameter | :: | DIAG_LOC_FACE_Y | = | 3 |
north face |
| real(kind=wp), | public, | parameter | :: | DIAG_MISSING_VALUE | = | 1.0e20_wp |
Sentinel written into remapped output cells that overlap no water
(below-bottom / pinched-out) when vanished-target masking is on,
and advertised as the NetCDF |
| integer, | public, | parameter | :: | DIAG_OP_INSTANT | = | 1 |
snapshot at cadence |
| integer, | public, | parameter | :: | DIAG_OP_INTEGRAL | = | 5 |
Cumulative time integral over the cadence window — emits Σ(sample · dt) without dividing. Used for budget closure: time-integrated fluxes through a surface or through an OBC face are the conserved quantity, not their per-step rate. |
| integer, | public, | parameter | :: | DIAG_OP_MAX | = | 3 | |
| integer, | public, | parameter | :: | DIAG_OP_MEAN | = | 2 |
dt-weighted time mean over cadence |
| integer, | public, | parameter | :: | DIAG_OP_MIN | = | 4 | |
| integer, | public, | parameter | :: | DIAG_OP_UNSET | = | -1 |
|
| integer, | public, | parameter | :: | DIAG_VGRID_BOTTOM | = | 5 |
2D bed slice. |
| integer, | public, | parameter | :: | DIAG_VGRID_DENSITY | = | 3 |
Isopycnal bins for watermass analysis. |
| integer, | public, | parameter | :: | DIAG_VGRID_LAYER | = | 1 |
Model layers (k=1 bed, k=nz surface). |
| integer, | public, | parameter | :: | DIAG_VGRID_SIGMA | = | 7 |
Fixed sigma-levels: terrain-following fractional-depth output grid (target interface depth = sigma fraction * col_h). |
| integer, | public, | parameter | :: | DIAG_VGRID_SURFACE | = | 4 |
2D surface slice (no remap needed). |
| integer, | public, | parameter | :: | DIAG_VGRID_ZSTAR | = | 6 |
Fixed z*-levels: SSH-tracking stretched-depth output grid (each column’s target depths scale with col_h / resting depth). |
| integer, | public, | parameter | :: | DIAG_VGRID_Z_FIXED | = | 2 |
Fixed z-levels (e.g., 50 standard depths). |
| integer, | private, | parameter | :: | INITIAL_CAPACITY | = | 16 |
Optional post-fire emit hook. Called by step once per
cadence-fire AFTER the log line; used by the NetCDF
writer to append a slice for the var that just fired.
Kept abstract so the diag module stays free of NetCDF /
I/O-server deps — rdb_ocean_diag_netcdf provides the
concrete implementation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(*), | intent(inout) | :: | diag | |||
| integer, | intent(in) | :: | ivar | |||
| real(kind=wp), | intent(in) | :: | t |
Fill routine signature. state_handle is polymorphic so
this module stays decoupled from ocean_state_t (which
itself composes ocean_diag_t). Implementations live in
rdb_ocean_diag_fills and do a select type cast to the
concrete ocean state inside the body. buf is the
pre-allocated output buffer the manager owns.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(*), | intent(in) | :: | state_handle | |||
| real(kind=wp), | intent(inout) | :: | buf(:,:,:) |
Vertical-remap routine signature. Called by the manager
after fill when a var’s output_vgrid is not LAYER.
layer_buf is the manager-owned native-grid scratch the
fill wrote into; output_buf is the remap target on the
configured output vgrid (z-levels / isopycnals / 2D).
State-side data needed for the remap (e.g. h_layer,
bathy) is fetched via select type on state_handle.
Conservation contract: is_extensive (forwarded by the
manager from diag_var_t%is_extensive) selects the operator.
.false. — INTENSIVE: the target value is the
thickness-weighted average of the overlapping source layers.
.true. — EXTENSIVE: the column integral is conservatively
REDISTRIBUTED (Σ output == Σ layer_buf), for thickness-
integrated quantities (hTr, h·KE, transports).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(*), | intent(in) | :: | state_handle | |||
| real(kind=wp), | intent(in) | :: | z_out(:) | |||
| real(kind=wp), | intent(in) | :: | layer_buf(:,:,:) | |||
| real(kind=wp), | intent(inout) | :: | output_buf(:,:,:) | |||
| logical, | intent(in) | :: | is_extensive |
One parsed entry of the &ocean_diag_nml diags selection list.
Produced by parse_diag_spec; consumed by register_default_diags
(canonical-default overrides / skips) and the derived-diagnostic
orchestrator (apply_diag_selection). Unset attributes carry
sentinels so the consumer falls back to the canonical default.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | coord | = | DIAG_COORD_UNSET |
|
|
| real(kind=wp), | public | :: | dt_out | = | -1.0_wp |
|
|
| character(len=64), | public | :: | name | = | "" |
diagnostic name (catalog or canonical) |
|
| logical, | public | :: | off | = | .false. |
|
|
| integer, | public | :: | time_op | = | DIAG_OP_UNSET |
|
Per-variable diagnostic record. Owned by ocean_diag_t.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public, | allocatable | :: | accumulator(:,:,:) | |||
| real(kind=wp), | public | :: | dt_accum | = | 0.0_wp |
Wall time accumulated into this var’s window (s). |
|
| real(kind=wp), | public | :: | dt_out | = | 3600.0_wp |
Output cadence (s). Manager keeps a per-var counter and fires when the accumulated dt passes the threshold. |
|
| logical, | public | :: | enabled | = | .true. |
When |
|
| procedure(diag_fill_proc), | public, | pointer, nopass | :: | fill | => | null() | |
| integer, | public | :: | fire_count | = | 0 |
Number of times this var’s |
|
| logical, | public | :: | has_missing | = | .false. |
When |
|
| logical, | public | :: | is_extensive | = | .false. |
|
|
| real(kind=wp), | public, | allocatable | :: | layer_buffer(:,:,:) | |||
| character(len=128), | public | :: | long_name | = | "" |
CF-compliant long_name attribute. |
|
| type(diag_mask_t), | public, | allocatable | :: | mask |
Optional region mask. When allocated, |
||
| integer, | public | :: | n_accum | = | 0 |
Number of contributions in the current accumulator window. |
|
| character(len=64), | public | :: | name | = | "" |
Short netcdf variable name. |
|
| integer, | public | :: | nc_time_dimid | = | -1 | ||
| integer, | public | :: | nc_time_index | = | 0 |
Number of slices already written for this var (1-indexed position of the NEXT write). |
|
| integer, | public | :: | nc_time_varid | = | -1 | ||
| integer, | public | :: | nc_varid | = | -1 | ||
| integer, | public | :: | nc_z_dimid | = | -1 |
-1 for 2D vars; set for 3D vars when the stream is opened. |
|
| real(kind=wp), | public, | allocatable | :: | output_buffer(:,:,:) | |||
| integer, | public | :: | output_vgrid | = | DIAG_VGRID_LAYER | ||
| procedure(diag_remap_proc), | public, | pointer, nopass | :: | remap | => | null() |
Optional vertical-remap routine. Set at register time
when |
| integer, | public | :: | source_loc | = | DIAG_LOC_CENTER | ||
| integer, | public | :: | source_vgrid | = | DIAG_VGRID_LAYER | ||
| character(len=64), | public | :: | standard_name | = | "" | ||
| integer, | public | :: | stream_id | = | 0 |
ID of the output stream this var ships to (Phase 6 wires the I/O server stream table). |
|
| integer, | public | :: | time_op | = | DIAG_OP_MEAN | ||
| character(len=32), | public | :: | units | = | "" |
| procedure, public, non_overridable :: bytes => diag_var_bytes |
NetCDF output stream state. Carried inline on ocean_diag_t
so the diag module stays NetCDF-free (no use netcdf here);
the actual file operations live in rdb_ocean_diag_netcdf
which manipulates these fields.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=256), | public | :: | filename | = | "" | ||
| logical, | public | :: | is_open | = | .false. | ||
| integer, | public | :: | ncid | = | -1 | ||
| real(kind=real32), | public, | allocatable | :: | stage(:,:,:) |
Host staging buffer for the fp64 -> fp32 conversion done
immediately before |
||
| integer, | public | :: | x_dimid | = | -1 | ||
| integer, | public | :: | xtype | = | -1 |
Resolved NetCDF element type for the DATA variables of this
stream ( |
|
| integer, | public | :: | y_dimid | = | -1 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public | :: | dt_last_eval | = | 0.0_wp |
Wall time at last evaluation pass (s). |
|
| procedure(diag_emit_proc), | public, | pointer, nopass | :: | emit_post_fire | => | null() |
Optional post-fire hook the manager calls after the log
line. |
| logical, | public | :: | enabled | = | .true. |
Master switch. Phase 6 reads from namelist. |
|
| type(hgrid_t), | public | :: | grid |
Cached grid (scalar-only struct, cheap to copy). Derived
diagnostic fills read |
|||
| logical, | public | :: | is_init | = | .false. |
True between |
|
| integer, | public | :: | n_rho_out | = | 0 | ||
| integer, | public | :: | n_sigma_out | = | 0 | ||
| integer, | public | :: | n_zstar_out | = | 0 | ||
| type(ocean_diag_nc_stream_t), | public | :: | nc_stream | ||||
| integer, | public | :: | nvars | = | 0 |
Live count of registered diagnostics. |
|
| integer, | public | :: | nvars_max | = | 0 |
Capacity of |
|
| integer, | public | :: | nz_out | = | 0 | ||
| logical, | public | :: | on_device | = | .false. |
|
|
| real(kind=wp), | public, | allocatable | :: | rho_out(:) |
Output isopycnal bin edges (kg/m^3). |
||
| real(kind=wp), | public, | allocatable | :: | send_buf(:,:,:) | |||
| real(kind=wp), | public, | allocatable | :: | sigma_out(:) |
Output sigma levels: cumulative fractions (0..1, shallow->deep). |
||
| type(diag_var_t), | public, | allocatable | :: | vars(:) | |||
| real(kind=wp), | public, | allocatable | :: | z_out(:) |
Output z-levels (m, positive up; surface at index nz_out). |
||
| real(kind=wp), | public, | allocatable | :: | zstar_out(:) |
Output z* reference interface depths (m, positive-down; deepest = reference total depth H_ref). Per-column grid stretched by col_h / H_ref (SSH-tracking). |
| procedure, public, non_overridable :: bytes => ocean_diag_bytes | |
| procedure, public, non_overridable :: destroy => ocean_diag_destroy | |
| procedure, public, non_overridable :: disable => ocean_diag_disable | |
| procedure, public, non_overridable :: enter_data => ocean_diag_enter_data | |
| procedure, public, non_overridable :: exit_data => ocean_diag_exit_data | |
| procedure, public, non_overridable :: init => ocean_diag_init | |
| procedure, public, non_overridable :: is_registered => ocean_diag_is_registered | |
| procedure, public, non_overridable :: register => ocean_diag_register | |
| procedure, public, non_overridable :: set_output_density_levels => ocean_diag_set_output_density_levels | |
| procedure, public, non_overridable :: set_output_sigma_levels => ocean_diag_set_output_sigma_levels | |
| procedure, public, non_overridable :: set_output_z_levels => ocean_diag_set_output_z_levels | |
| procedure, public, non_overridable :: set_output_zstar_levels => ocean_diag_set_output_zstar_levels | |
| procedure, public, non_overridable :: step => ocean_diag_step |
Parse the &ocean_diag_nml diags selection string into structured
entries. Entries are whitespace/comma-separated; within an entry,
colon-separated attributes are self-identifying (order-free):
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | spec |
Counted allocatable footprint of ONE registered diagnostic (0 for every buffer that is unallocated).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(diag_var_t), | intent(in) | :: | this |
ASCII lowercase a string (attribute matching is case-insensitive).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s |
Counted allocatable footprint of the diagnostics slot: the flat
remap-level arrays, the host NetCDF staging buffer, AND the
per-variable registry buffers (0 when unallocated). One
arr_bytes term per array — add a term here when a new allocatable
joins the type; new diag_var_t buffers go in diag_var_bytes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(in) | :: | this |
.true. iff a diagnostic named name is registered (enabled or
not). Registration state only — says nothing about whether it
will actually fire (see enabled); a disabled diagnostic is
still registered and this returns .true. for it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | name |
The [diag] console line’s min / max / mean for one diagnostic
buffer, over the finite cells only.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | buf(:,:,:) | |||
| logical, | intent(in) | :: | on_device |
|
||
| real(kind=wp), | intent(out) | :: | vmin | |||
| real(kind=wp), | intent(out) | :: | vmax | |||
| real(kind=wp), | intent(out) | :: | vmean | |||
| integer, | intent(out) | :: | n_valid | |||
| integer, | intent(out) | :: | n_total |
Whole-array min / max / sum of a diagnostic buffer in ONE pass, over the FINITE cells only.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | buf(n1,n2,n3) | |||
| integer, | intent(in) | :: | n1 | |||
| integer, | intent(in) | :: | n2 | |||
| integer, | intent(in) | :: | n3 | |||
| real(kind=wp), | intent(out) | :: | vmin | |||
| real(kind=wp), | intent(out) | :: | vmax | |||
| real(kind=wp), | intent(out) | :: | vsum | |||
| integer, | intent(out), | optional | :: | n_valid |
Number of finite cells folded in. Optional so the pre-existing three-scalar call sites keep working unchanged. |
Invoke the var’s fill (and remap if non-LAYER) so
output_buffer holds the current sample. The accumulation
/ log emission step consumes output_buffer after this.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(diag_var_t), | intent(inout) | :: | v | |||
| class(*), | intent(in) | :: | state_handle | |||
| real(kind=wp), | intent(in), | allocatable | :: | z_out(:) | ||
| real(kind=wp), | intent(in), | allocatable | :: | rho_out(:) | ||
| real(kind=wp), | intent(in), | allocatable | :: | sigma_out(:) | ||
| real(kind=wp), | intent(in), | allocatable | :: | zstar_out(:) |
Device-side scalar fill. Used by reset_accumulator and (when
idx_temperature / idx_salinity is unset) the manager could
also seed output_buffer via this; today only the accumulator
reset goes through here.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | buf(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | val |
Copy the accumulator into output_buffer. Called at
cadence-fire BEFORE log / NetCDF emission consumes
output_buffer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(diag_var_t), | intent(inout) | :: | v |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | out(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | accum(:,:,:) |
Device-side out = accum * scale_factor. Used for MEAN
finalise where scale_factor = 1/dt_accum.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | out(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | accum(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | scale_factor |
Combine the current output_buffer sample into accumulator
per time_op.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(diag_var_t), | intent(inout) | :: | v | |||
| real(kind=wp), | intent(in) | :: | dt |
Masked fold — multiplies sample by weight(i, j) before folding.
MAX/MIN treat weight == 0 as “don’t update” so masked-out cells
keep their seed value. Loop bounds clip to whichever extent is
smaller (accumulator vs mask) so an undersized mask doesn’t OOB.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | accum(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | out(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | weight(:,:) | |||
| integer, | intent(in) | :: | mask_nx | |||
| integer, | intent(in) | :: | mask_ny | |||
| real(kind=wp), | intent(in) | :: | dt | |||
| integer, | intent(in) | :: | time_op |
Whole-buffer fold without a region mask. One do concurrent
per op so the compiler can specialise — case-inside-loop blocks
NVHPC device codegen.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | accum(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | out(:,:,:) | |||
| real(kind=wp), | intent(in) | :: | dt | |||
| integer, | intent(in) | :: | time_op |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this |
Turn OFF the registered diagnostic name so the dispatcher skips
it entirely (no fill, no fold, no emit). Fail-loud if name
matches no registered var — a typo must not silently leave a
diagnostic running. Lists the registered names on abort.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| character(len=*), | intent(in) | :: | name |
Attach each registered var’s per-buffer allocatables to the device.
Called by ocean_state_enter_data after register_default_diags
has populated vars(:) — buffers are sized at register time, so
the descriptors here are valid.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_diag_t), | intent(inout) | :: | this |
Detach in reverse order of enter_data. Idempotency-safe via
is_init gate — repeated calls without intervening enter_data
become no-ops once the manager is destroyed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_diag_t), | intent(inout) | :: | this |
Allocate an empty registry sized at INITIAL_CAPACITY slots.
Subsequent register calls grow the array via doubling.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid |
Register a new diagnostic variable. Grows the registry via
capacity doubling on overflow. Buffer allocation depends on
output_vgrid:
* LAYER (default): one output_buffer(n1, n2, n3) —
fill writes directly into it.
* Z_FIXED (or any non-LAYER target): two buffers —
layer_buffer(n1, n2, n3) for the fill, plus
output_buffer(n1, n2, this%nz_out) for the remapped
result. Caller must have configured nz_out via
set_output_z_levels first, and bind a remap proc.
Caller binds fill to a routine that knows how to populate
the layer-native buffer from the state handle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| character(len=*), | intent(in) | :: | name | |||
| character(len=*), | intent(in) | :: | units | |||
| procedure(diag_fill_proc) | :: | fill | ||||
| integer, | intent(in) | :: | n1 | |||
| integer, | intent(in) | :: | n2 | |||
| integer, | intent(in) | :: | n3 | |||
| character(len=*), | intent(in), | optional | :: | long_name | ||
| character(len=*), | intent(in), | optional | :: | standard_name | ||
| integer, | intent(in), | optional | :: | time_op | ||
| real(kind=wp), | intent(in), | optional | :: | dt_out | ||
| integer, | intent(in), | optional | :: | output_vgrid | ||
| procedure(diag_remap_proc), | optional | :: | remap | |||
| type(diag_mask_t), | intent(in), | optional | :: | mask | ||
| logical, | intent(in), | optional | :: | is_extensive | ||
| logical, | intent(in), | optional | :: | has_missing |
Configure the isopycnal (DENSITY) output grid — monotone-increasing
target potential densities (kg/m³). Stored copy; must be called
BEFORE any register with output_vgrid == DIAG_VGRID_DENSITY so
the manager knows the output buffer shape (one cell per target).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| real(kind=wp), | intent(in) | :: | rho(:) | |||
| integer, | intent(out), | optional | :: | ierr |
Configure the terrain-following (SIGMA) output grid — cumulative
sigma fractions (0..1, monotone shallow->deep). Stored copy; must
be called BEFORE any register with output_vgrid ==
DIAG_VGRID_SIGMA so the manager knows the output buffer shape.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| real(kind=wp), | intent(in) | :: | sigma(:) | |||
| integer, | intent(out), | optional | :: | ierr |
Configure the fixed-z output grid. Stored copy; the original
z array is not retained. Must be called BEFORE any
register with output_vgrid == DIAG_VGRID_Z_FIXED so the
manager knows the output buffer shape.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| real(kind=wp), | intent(in) | :: | z(:) | |||
| integer, | intent(out), | optional | :: | ierr |
Non-zero ( |
Configure the SSH-tracking (ZSTAR) output grid — reference interface
depths (m, positive-down, monotone shallow->deep; deepest = H_ref).
Stored copy; must be called BEFORE any register with
output_vgrid == DIAG_VGRID_ZSTAR so the manager knows the buffer
shape.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| real(kind=wp), | intent(in) | :: | zstar(:) | |||
| integer, | intent(out), | optional | :: | ierr |
Advance every registered variable. Behaviour by time_op:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_diag_t), | intent(inout) | :: | this | |||
| class(*), | intent(in) | :: | state_handle | |||
| real(kind=wp), | intent(in) | :: | dt | |||
| real(kind=wp), | intent(in) | :: | t |
Parse a cadence attribute <int><unit> (unit s/m/h/d) to seconds.
ok=.false. if s is not a well-formed positive cadence.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s | |||
| real(kind=wp), | intent(out) | :: | secs | |||
| logical, | intent(out) | :: | ok |
Parse a single name[:attr]... token into a diag_spec_t.
Fails loud on an unrecognised attribute.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tok | |||
| type(diag_spec_t), | intent(out) | :: | s |
Zero (MEAN), -huge (MAX), or +huge (MIN) the accumulator —
so the first accumulate step seeds correctly. Runs on device
via the flat-impl shim because v%accumulator is reached
through the vars(:) array-of-derived-types indirection that
NVHPC can’t follow inside a do concurrent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(diag_var_t), | intent(inout) | :: | v |