register_default_diags Subroutine

public subroutine register_default_diags(state, dt_out, specs, default_coord)

Register the canonical ocean diagnostic variable set. Called once from setup (driver init or test) after state%diag%init. When specs (parsed &ocean_diag_nml diags) is present, each canonical diagnostic consults it: a :off entry skips registration entirely, and :cadence / :op / :coord attributes override the defaults. default_coord (the global &ocean_diag_nml vgrid, default LAYER) sets the output vgrid for layered diagnostics absent a per-diag :coord. Absent specs + LAYER default => the canonical defaults, bit-identical to the legacy behaviour. The canonical set also gains ice_conc / ice_thick when &ocean_ice_nml enable.

Arguments

Type IntentOptional Attributes Name
type(ocean_state_t), intent(inout), target :: state
real(kind=wp), intent(in), optional :: dt_out
type(diag_spec_t), intent(in), optional :: specs(:)
integer, intent(in), optional :: default_coord

Calls

proc~~register_default_diags~~CallsGraph proc~register_default_diags register_default_diags proc~register_one_canonical register_one_canonical proc~register_default_diags->proc~register_one_canonical proc~coord_remap_proc coord_remap_proc proc~register_one_canonical->proc~coord_remap_proc proc~ocean_diag_register ocean_diag_t%ocean_diag_register proc~register_one_canonical->proc~ocean_diag_register proc~resolve_canonical_spec resolve_canonical_spec proc~register_one_canonical->proc~resolve_canonical_spec proc~reset_accumulator reset_accumulator proc~ocean_diag_register->proc~reset_accumulator proc~fill_buffer_impl fill_buffer_impl proc~reset_accumulator->proc~fill_buffer_impl

Called by

proc~~register_default_diags~~CalledByGraph proc~register_default_diags register_default_diags proc~apply_diag_selection apply_diag_selection proc~apply_diag_selection->proc~register_default_diags proc~engine_configure_diag engine_configure_diag proc~engine_configure_diag->proc~apply_diag_selection proc~engine_setup engine_setup proc~engine_setup->proc~engine_configure_diag proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
integer, private :: dcoord
real(kind=wp), private :: dtout
integer, private :: nz

Source Code

   subroutine register_default_diags(state, dt_out, specs, default_coord)
      !! Register the canonical ocean diagnostic variable set.  Called once
      !! from setup (driver init or test) after `state%diag%init`.  When
      !! `specs` (parsed `&ocean_diag_nml diags`) is present, each canonical
      !! diagnostic consults it: a `:off` entry skips registration entirely,
      !! and `:cadence` / `:op` / `:coord` attributes override the defaults.
      !! `default_coord` (the global `&ocean_diag_nml vgrid`, default LAYER)
      !! sets the output vgrid for layered diagnostics absent a per-diag
      !! `:coord`.  Absent `specs` + LAYER default => the canonical defaults,
      !! bit-identical to the legacy behaviour.  The canonical set also
      !! gains `ice_conc` / `ice_thick` when `&ocean_ice_nml enable`.
      type(ocean_state_t), intent(inout), target :: state
      real(wp), intent(in), optional :: dt_out
      type(diag_spec_t), intent(in), optional :: specs(:)
      integer, intent(in), optional :: default_coord
      integer :: nz, dcoord
      real(wp) :: dtout

      dtout = 3600.0_wp
      if (present(dt_out)) dtout = dt_out
      dcoord = DIAG_VGRID_LAYER
      if (present(default_coord)) dcoord = default_coord
      nz = state%multilayer%nz_ml

      call register_one_canonical(state, specs, dcoord, dtout, "SSH", "m", fill_ssh, &
                                  1, DIAG_OP_INSTANT, "sea_surface_height_above_geoid", &
                                  "sea_surface_height")
      if (state%multilayer%idx_temperature > 0) then
         call register_one_canonical(state, specs, dcoord, dtout, "temperature", "degC", &
                                     fill_temperature, nz, DIAG_OP_MEAN, &
                                     "sea_water_potential_temperature", &
                                     "sea_water_potential_temperature")
      end if
      if (state%multilayer%idx_salinity > 0) then
         call register_one_canonical(state, specs, dcoord, dtout, "salinity", "psu", &
                                     fill_salinity, nz, DIAG_OP_MEAN, &
                                     "sea_water_salinity", "sea_water_salinity")
      end if
      if (state%multilayer%idx_age > 0) then
         call register_one_canonical(state, specs, dcoord, dtout, "age", "s", fill_age, &
                                     nz, DIAG_OP_MEAN, "ideal_age_of_sea_water", &
                                     "age_of_sea_water")
      end if
      if (state%multilayer%idx_pseudo_salt > 0) then
         call register_one_canonical(state, specs, dcoord, dtout, "pseudo_salt", "psu", &
                                     fill_pseudo_salt, nz, DIAG_OP_MEAN, &
                                     "pseudo_salt_passive_tracer")
         call register_one_canonical(state, specs, dcoord, dtout, "pseudo_salt_diff", "psu", &
                                     fill_pseudo_salt_diff, nz, DIAG_OP_MEAN, &
                                     "difference_between_pseudo_salt_and_salt")
      end if
      call register_one_canonical(state, specs, dcoord, dtout, "u", "m s-1", fill_u_centre, &
                                  nz, DIAG_OP_MEAN, "eastward_velocity_at_cell_centre")
      call register_one_canonical(state, specs, dcoord, dtout, "v", "m s-1", fill_v_centre, &
                                  nz, DIAG_OP_MEAN, "northward_velocity_at_cell_centre")
      call register_one_canonical(state, specs, dcoord, dtout, "KE", "m2 s-2", fill_ke, &
                                  nz, DIAG_OP_MEAN, "kinetic_energy_per_unit_mass")
      if (state%epbl%enable) then
         call register_one_canonical(state, specs, dcoord, dtout, "MLD_EPBL", "m", &
                                     fill_mld_epbl, 1, DIAG_OP_MEAN, &
                                     "epbl_active_mixing_layer_depth")
         call register_one_canonical(state, specs, dcoord, dtout, "Kd_EPBL", "m2 s-1", &
                                     fill_kd_epbl, nz, DIAG_OP_MEAN, &
                                     "epbl_diffusivity_at_layer_bottom_interface")
      end if
      if (state%kshear%enable) then
         call register_one_canonical(state, specs, dcoord, dtout, "Kd_KSHEAR", "m2 s-1", &
                                     fill_kd_kshear, nz, DIAG_OP_MEAN, &
                                     "kappa_shear_diffusivity_at_layer_bottom_interface")
      end if
      if (state%ice%enable) then
         call register_one_canonical(state, specs, dcoord, dtout, "ice_conc", "1", &
                                     fill_ice_conc, 1, DIAG_OP_MEAN, &
                                     "sea_ice_area_fraction", "sea_ice_area_fraction")
         ! ice_thick carries NO CF standard_name: the CF `sea_ice_thickness`
         ! conventionally means actual floe thickness, but this is the
         ! grid-mean (effective) thickness mice/ICE_RHO_ICE — so only the
         ! long_name identifies it (omit standard_name, as u/v/KE do).
         call register_one_canonical(state, specs, dcoord, dtout, "ice_thick", "m", &
                                     fill_ice_thick, 1, DIAG_OP_MEAN, &
                                     "grid_mean_sea_ice_thickness")
      end if
   end subroutine register_default_diags