ocean_diag_config_t Derived Type

type, public :: ocean_diag_config_t


Inherited by

type~~ocean_diag_config_t~~InheritedByGraph type~ocean_diag_config_t ocean_diag_config_t type~ocean_config_t ocean_config_t type~ocean_config_t->type~ocean_diag_config_t diag type~config_t config_t type~config_t->type~ocean_config_t ocean type~ocean_handle_t ocean_handle_t type~ocean_handle_t->type~config_t cfg

Components

Type Visibility Attributes Name Initial
character(len=16), public :: diag_remap_scheme = "ppm"

In-cell reconstruction for the conservative diagnostic vertical remap (z_fixed / density vgrids): “pcm”, “plm”, “ppm” (default), “ppm_h4”, or “pqm”. All conserve the column integral; PPM is the accurate default (PCM stair-steps). Inert when every diagnostic is on the native “layer” grid.

character(len=512), public :: diags = ""

Unified diagnostic selection list — one authoritative spec that modifies the canonical default set. Whitespace/comma-separated entries, each name[:attr]... with self-identifying colon attributes (order-free):

  • off — turn this diagnostic off (skip it)
  • a cadence 1h/6h/30m/1d — output interval override
  • an op instant/mean/max/min — time-reduction override

A name matching a canonical default applies its attributes (or drops it with :off); a name from the derived-diagnostic catalog (rdb_ocean_diag_derived) is added. Example: "vorticity_z:1d KE:off temperature:6h:mean". Default empty => the canonical set unchanged => bit-identical output for existing namelists. An unknown name fails loud at setup. (Per-diagnostic vertical-coordinate attributes — z*/sigma — land with the multi-coordinate remap; today every diag uses the global vgrid.)

real(kind=wp), public :: dt_out = 3600.0_wp

Cadence (s) at which the diag manager fires every variable’s time op (INSTANT writes, MEAN flushes the accumulator, etc.).

logical, public :: enabled = .true.

Enable per-step diag-manager hook in driver_run_ocean.

character(len=256), public :: filename = "ocean_diag"

Output file basename — output_rank_filename appends the per-rank suffix. Final path: <output_dir>/<filename>_rank_NNNNNN.nc.

logical, public :: mask_vanished_layers = .false.

When .true., remapped (non-layer) diagnostics fill target cells that overlap no water (below-bottom / pinched-out in a shallow column) with a missing sentinel and tag the NetCDF variable with _FillValue / missing_value. Default .false. => those cells read 0 (bit-identical to the legacy writer).

integer, public :: n_rho_levels = 0

Number of entries used in rho_levels (0 = none).

integer, public :: n_sigma_levels = 0

Number of entries used in sigma_levels (0 = auto-uniform).

integer, public :: n_z_levels = 0

Number of entries used in z_levels (0 = none).

integer, public :: n_zstar_levels = 0

Number of entries used in zstar_levels (0 = auto-uniform).

character(len=16), public :: output_precision = "double"

Element width of the DIAGNOSTIC NetCDF data variables: “double” (default => byte-identical to the pre-knob writer) or “single” (fp32 => ~half the bytes per frame; diagnostic output is write-bandwidth bound, so this is the main lever on its cost). fp32 carries ~7 decimal digits — ~1e-5 degC, ~1e-5 PSU, ~1e-9 m/s at 1 m/s — orders of magnitude below the model’s own discretisation error.

Scope, deliberately narrow: this knob reaches the diagnostic stream ONLY. Restart files, console conservation totals and checksums are unconditionally working precision — a restart that does not round-trip exactly makes a resumed run a different run, so there is no way to ask for a lossy one. The diag TIME coordinate variables also stay double.

Caveat: a regression baseline that compares diagnostic NetCDF byte-for-byte will not match a “single” file; opting in means regenerating those baselines deliberately.

logical, public :: reproducing_sums = .true.

console-conservation totals (Mass/KE/Salt/Heat + sea-ice area) and the salt/heat closed-budget out/src terms use order-invariant extended-fixed-point (EFP) summation (rdb_efp + halo_allreduce_efp_list) instead of plain FP !$acc parallel loop reduction(+:acc) + MPI_SUM — the printed console is identical on every rank count (1 included) and reduction order, and the Error residual is formed via efp_real_diff (a fixed-point difference) rather than a double subtraction of two already-quantised totals. It runs only at the status cadence and changes diagnostic TEXT only, never the trajectory. .false. restores the pre-PR-32 FP console (whose last digits depend on the decomposition). See docs/CAPABILITIES_AND_LIMITATIONS.md’s conservation-contract section for the achievable guarantee + the EFP_MAX_RANKS = 131072 envelope.

real(kind=wp), public :: rho_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp

Output target potential-density bin edges (kg/m^3, strictly increasing, light->dense) when vgrid = “density”. No auto-fill — validate_config requires n_rho_levels > 0 whenever the density vgrid is selected (globally or per-diagnostic).

real(kind=wp), public :: sigma_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp

Output sigma levels — cumulative fractions (0..1, shallow->deep) when sigma output is used. Empty => auto-generate nz_ml uniform fractions.

character(len=16), public :: vgrid = "layer"

Default output vertical grid for layer-shaped diags: “layer” (native nz_ml layers, default), “z_fixed” (conservative remap to z_levels), “sigma” (terrain-following, sigma_levels), “zstar” (SSH-tracking, zstar_levels), or “density” (isopycnal bins, rho_levels — requires n_rho_levels > 0, strictly increasing). Per-diagnostic overrides via the diags list :layer/z/sigma/zstar/density attribute.

real(kind=wp), public :: z_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp

Output z-levels (m, positive downward) when vgrid = “z_fixed”.

real(kind=wp), public :: zstar_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp

Output z reference interface depths (m, positive-down, shallow->deep; deepest = H_ref) when z output is used. Empty => auto-generate nz_ml uniform depths (== sigma; supply a non-uniform reference for z* to differ).


Source Code

   type :: ocean_diag_config_t
      logical :: enabled = .true.
         !! Enable per-step diag-manager hook in driver_run_ocean.
      character(len=256) :: filename = "ocean_diag"
         !! Output file basename — `output_rank_filename` appends the
         !! per-rank suffix.  Final path:
         !! `<output_dir>/<filename>_rank_NNNNNN.nc`.
      real(wp) :: dt_out = 3600.0_wp
         !! Cadence (s) at which the diag manager fires every variable's
         !! time op (INSTANT writes, MEAN flushes the accumulator, etc.).
      character(len=16) :: vgrid = "layer"
         !! Default output vertical grid for layer-shaped diags: "layer"
         !! (native `nz_ml` layers, default), "z_fixed" (conservative remap
         !! to `z_levels`), "sigma" (terrain-following, `sigma_levels`),
         !! "zstar" (SSH-tracking, `zstar_levels`), or "density" (isopycnal
         !! bins, `rho_levels` — requires `n_rho_levels > 0`, strictly
         !! increasing).  Per-diagnostic overrides via the `diags` list
         !! `:layer/z/sigma/zstar/density` attribute.
      real(wp) :: z_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp
         !! Output z-levels (m, positive downward) when vgrid = "z_fixed".
      integer :: n_z_levels = 0
         !! Number of entries used in z_levels (0 = none).
      real(wp) :: sigma_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp
         !! Output sigma levels — cumulative fractions (0..1, shallow->deep)
         !! when sigma output is used.  Empty => auto-generate `nz_ml`
         !! uniform fractions.
      integer :: n_sigma_levels = 0
         !! Number of entries used in sigma_levels (0 = auto-uniform).
      real(wp) :: zstar_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp
         !! Output z* reference interface depths (m, positive-down,
         !! shallow->deep; deepest = H_ref) when z* output is used.  Empty =>
         !! auto-generate `nz_ml` uniform depths (== sigma; supply a
         !! non-uniform reference for z* to differ).
      integer :: n_zstar_levels = 0
         !! Number of entries used in zstar_levels (0 = auto-uniform).
      real(wp) :: rho_levels(MAX_OCEAN_DIAG_Z_LEVELS) = -1.0_wp
         !! Output target potential-density bin edges (kg/m^3, strictly
         !! increasing, light->dense) when vgrid = "density".  No auto-fill —
         !! `validate_config` requires `n_rho_levels > 0` whenever the
         !! density vgrid is selected (globally or per-diagnostic).
      integer :: n_rho_levels = 0
         !! Number of entries used in rho_levels (0 = none).
      logical :: mask_vanished_layers = .false.
         !! When `.true.`, remapped (non-layer) diagnostics fill target cells
         !! that overlap no water (below-bottom / pinched-out in a shallow
         !! column) with a missing sentinel and tag the NetCDF variable with
         !! `_FillValue` / `missing_value`.  Default `.false.` => those cells
         !! read 0 (bit-identical to the legacy writer).
      logical :: reproducing_sums = .true.
         !! PR-32: when `.true.` (the DEFAULT since v0.1.0), the ocean
         !! console-conservation totals (Mass/KE/Salt/Heat + sea-ice area)
         !! and the salt/heat closed-budget `out`/`src` terms use
         !! order-invariant extended-fixed-point (EFP) summation
         !! (`rdb_efp` + `halo_allreduce_efp_list`) instead of plain FP
         !! `!$acc parallel loop reduction(+:acc)` + `MPI_SUM` — the
         !! printed console is identical on every rank count (1 included)
         !! and reduction order, and the `Error` residual is formed via
         !! `efp_real_diff` (a fixed-point difference) rather than a
         !! double subtraction of two already-quantised totals.  It runs
         !! only at the status cadence and changes diagnostic TEXT only,
         !! never the trajectory.  `.false.` restores the pre-PR-32 FP
         !! console (whose last digits depend on the decomposition).  See
         !! `docs/CAPABILITIES_AND_LIMITATIONS.md`'s conservation-contract
         !! section for the achievable guarantee + the `EFP_MAX_RANKS =
         !! 131072` envelope.
      character(len=16) :: output_precision = "double"
         !! Element width of the DIAGNOSTIC NetCDF data variables:
         !! "double" (default => byte-identical to the pre-knob writer) or
         !! "single" (fp32 => ~half the bytes per frame; diagnostic output
         !! is write-bandwidth bound, so this is the main lever on its
         !! cost).  fp32 carries ~7 decimal digits — ~1e-5 degC, ~1e-5 PSU,
         !! ~1e-9 m/s at 1 m/s — orders of magnitude below the model's own
         !! discretisation error.
         !!
         !! Scope, deliberately narrow: this knob reaches the diagnostic
         !! stream ONLY.  Restart files, console conservation totals
         !! and checksums
         !! are unconditionally working precision — a restart that does not
         !! round-trip exactly makes a resumed run a different run, so
         !! there is no way to ask for a lossy one.  The diag TIME
         !! coordinate variables also stay double.
         !!
         !! Caveat: a regression baseline that compares diagnostic NetCDF
         !! byte-for-byte will not match a "single" file; opting in means
         !! regenerating those baselines deliberately.
      character(len=16) :: diag_remap_scheme = "ppm"
         !! In-cell reconstruction for the conservative diagnostic vertical
         !! remap (z_fixed / density vgrids): "pcm", "plm", "ppm" (default),
         !! "ppm_h4", or "pqm".  All conserve the column integral; PPM is the
         !! accurate default (PCM stair-steps).  Inert when every diagnostic
         !! is on the native "layer" grid.
      character(len=512) :: diags = ""
         !! Unified diagnostic selection list — one authoritative spec that
         !! modifies the canonical default set.  Whitespace/comma-separated
         !! entries, each `name[:attr]...` with self-identifying colon
         !! attributes (order-free):
         !!
         !!   * `off`               — turn this diagnostic off (skip it)
         !!   * a cadence `1h`/`6h`/`30m`/`1d` — output interval override
         !!   * an op `instant`/`mean`/`max`/`min` — time-reduction override
         !!
         !! A `name` matching a canonical default applies its attributes (or
         !! drops it with `:off`); a `name` from the derived-diagnostic
         !! catalog (`rdb_ocean_diag_derived`) is added.  Example:
         !! `"vorticity_z:1d  KE:off  temperature:6h:mean"`.  Default empty => the
         !! canonical set unchanged => bit-identical output for existing
         !! namelists.  An unknown name fails loud at setup.  (Per-diagnostic
         !! vertical-coordinate attributes — `z*`/`sigma` — land with the
         !! multi-coordinate remap; today every diag uses the global `vgrid`.)
   end type ocean_diag_config_t