mom_diag_mediator module reference

The subroutines here provide convenient wrappers to the fms diag_manager interfaces with additional diagnostic capabilies.

More…

Data Types

diag_dsamp

Contained for down sampled masks.

axes_grp

A group of 1D axes that comprise a 1D/2D/3D mesh.

diag_grids_type

Contains an array to store a diagnostic target grid.

diag_grid_storage

Stores all the remapping grids and the model’s native space thicknesses.

diag_type

This type is used to represent a diagnostic at the diag_mediator level.

diagcs_dsamp

Container for down sampling information.

diag_ctrl

The following data type a list of diagnostic fields an their variants, as well as variables that control the handling of model output.

Functions/Subroutines

set_axes_info()

Sets up diagnostics axes.

set_axes_info_dsamp()

set_masks_for_axes()

set_masks_for_axes sets up the 2d and 3d masks for diagnostics using the current grid recorded after calling diag_update_remap_grids()

set_masks_for_axes_dsamp()

diag_register_area_ids()

Attaches the id of cell areas to axes groups for use with cell_measures.

register_cell_measure()

Sets a handle inside diagnostics mediator to associate 3d cell measures.

diag_associate_volume_cell_measure()

Attaches the id of cell volumes to axes groups for use with cell_measures.

diag_get_volume_cell_measure_dm_id()

Returns diag_manager id for cell measure of h-cells.

define_axes_group()

Defines a group of “axes” from list of handles.

define_axes_group_dsamp()

Defines a group of downsampled “axes” from list of handles.

set_diag_mediator_grid()

Set up the array extents for doing diagnostics.

post_data_0d()

Make a real scalar diagnostic available for averaging or output.

post_data_1d_k()

Make a real 1-d array diagnostic available for averaging or output.

post_data_2d()

Make a real 2-d array diagnostic available for averaging or output.

post_data_2d_low()

Make a real 2-d array diagnostic available for averaging or output using a diag_type() instead of an integer id.

post_data_3d()

Make a real 3-d array diagnostic available for averaging or output.

post_data_3d_low()

Make a real 3-d array diagnostic available for averaging or output using a diag_type() instead of an integer id.

post_product_u()

Calculate and write out diagnostics that are the product of two 3-d arrays at u-points.

post_product_sum_u()

Calculate and write out diagnostics that are the vertical sum of the product of two 3-d arrays at u-points.

post_product_v()

Calculate and write out diagnostics that are the product of two 3-d arrays at v-points.

post_product_sum_v()

Calculate and write out diagnostics that are the vertical sum of the product of two 3-d arrays at v-points.

post_xy_average()

Post the horizontally area-averaged diagnostic.

enable_averaging()

This subroutine enables the accumulation of time averages over the specified time interval.

enable_averages()

Enable the accumulation of time averages over the specified time interval in time units.

disable_averaging()

Call this subroutine to avoid averaging any offered fields.

query_averaging_enabled()

Call this subroutine to determine whether the averaging is currently enabled.

get_diag_time_end()

This function returns the valid end time for use with diagnostics that are handled outside of the MOM6 diagnostics infrastructure.

register_diag_field()

Returns the “diag_mediator” handle for a group (native, CMOR, z-coord, …) of diagnostics derived from one field.

register_diag_field_expand_cmor()

Returns True if either the native or CMOr version of the diagnostic were registered.

register_diag_field_expand_axes()

Returns an FMS id from register_diag_field_fms (the diag_manager routine) after expanding axes (axes-group) into handles and conditionally adding an FMS area_id for cell_measures.

add_diag_to_list()

Create a diagnostic type and attached to list.

add_xyz_method()

Adds the encoded “cell_methods” for a diagnostics as a diag% property This allows access to the cell_method for a given diagnostics at the time of sending.

attach_cell_methods()

Attaches “cell_methods” attribute to a variable based on defaults for axes_grp() or optional arguments.

register_scalar_field()

register_static_field()

Registers a static diagnostic, returning an integer handle.

describe_option()

Describe an option setting in the diagnostic files.

ocean_register_diag()

Registers a diagnostic using the information encapsulated in the vardesc type argument and returns an integer handle to this diagostic.

diag_mediator_infrastructure_init()

diag_mediator_init()

diag_mediator_init initializes the MOM diag_mediator and opens the available diagnostics file, if appropriate.

diag_set_state_ptrs()

Set pointers to the default state fields used to remap diagnostics.

diag_update_remap_grids()

Build/update vertical grids for diagnostic remapping.

diag_masks_set()

Sets up the 2d and 3d masks for native diagnostics.

diag_mediator_close_registration()

axes_grp_end()

diag_mediator_end()

i2s()

Convert the first n elements (up to 3) of an integer array to an underscore delimited string.

get_new_diag_id()

Returns a new diagnostic id, it may be necessary to expand the diagnostics array.

initialize_diag_type()

Initializes a diag_type() (used after allocating new memory) (used after allocating new memory)

alloc_diag_with_id()

Make a new diagnostic.

log_available_diag()

Log a diagnostic to the available diagnostics file.

log_chksum_diag()

Log the diagnostic chksum to the chksum diag file.

diag_grid_storage_init()

Allocates fields necessary to store diagnostic remapping fields.

diag_copy_diag_to_storage()

Copy from the main diagnostic arrays to the grid storage as well as the native thicknesses.

diag_copy_storage_to_diag()

Copy from the stored diagnostic arrays to the main diagnostic grids.

diag_save_grids()

Save the current diagnostic grids in the temporary structure within diag.

diag_restore_grids()

Restore the diagnostic grids from the temporary structure within diag.

diag_grid_storage_end()

Deallocates the fields in the remapping fields container.

downsample_diag_masks_set()

downsample_diag_indices_get()

Get the diagnostics-compute indices (to be passed to send_data) based on the shape of the diag field (the same way they are deduced for non-downsampled fields)

downsample_diag_field_3d()

This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-compurte indices for the downsampled array 3d interface.

downsample_diag_field_2d()

This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-compurte indices for the downsampled array 2d interface.

downsample_field_3d()

This subroutine allocates and computes a down sampled 3d array given an input array The down sample method is based on the “cell_methods” for the diagnostics as explained in the above table.

downsample_field_2d()

This subroutine allocates and computes a down sampled 2d array given an input array The down sample method is based on the “cell_methods” for the diagnostics as explained in the above table.

downsample_mask_2d()

Allocate and compute the 2d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it’s closed (0)

downsample_mask_3d()

Allocate and compute the 3d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it’s closed (0)

found_in_diagtable()

Fakes a register of a diagnostic to find out if an obsolete parameter appears in the diag_table.

Detailed Description

The subroutines here provide convenient wrappers to the fms diag_manager interfaces with additional diagnostic capabilies.

Type Documentation

type mom_diag_mediator/diag_dsamp

Contained for down sampled masks.

Type fields:
  • % mask2d [real(:,:),pointer, private] :: Mask for 2d (x-y) axes [nondim].

  • % mask3d [real(:,:,:),pointer, private] :: Mask for 3d axes [nondim].

type mom_diag_mediator/axes_grp

A group of 1D axes that comprise a 1D/2D/3D mesh.

Type fields:
  • % id [character (len=15)] :: The id string for this particular combination of handles.

  • % rank [integer] :: Number of dimensions in the list of axes.

  • % handles [integer(:),allocatable] :: Handles to 1D axes.

  • % diag_cs [type( diag_ctrl ),pointer] :: Circular link back to the main diagnostics control structure (Used to avoid passing said structure into every possible call).

  • % x_cell_method [character (len=9)] :: Default nature of data representation, if axes group includes x-direction.

  • % y_cell_method [character (len=9)] :: Default nature of data representation, if axes group includes y-direction.

  • % v_cell_method [character (len=9)] :: Default nature of data representation, if axes group includes vertical direction.

  • % nz [integer] :: Vertical dimension of diagnostic.

  • % vertical_coordinate_number [integer] :: Index of the corresponding diag_remap_ctrl for this axis group.

  • % is_h_point [logical] :: If true, indicates that this axes group is for an h-point located field.

  • % is_q_point [logical] :: If true, indicates that this axes group is for a q-point located field.

  • % is_u_point [logical] :: If true, indicates that this axes group is for a u-point located field.

  • % is_v_point [logical] :: If true, indicates that this axes group is for a v-point located field.

  • % is_layer [logical] :: If true, indicates that this axes group is for a layer vertically-located field.

  • % is_interface [logical] :: If true, indicates that this axes group is for an interface vertically-located field.

  • % is_native [logical] :: If true, indicates that this axes group is for a native model grid. False for any other grid. Used for rank>2.

  • % needs_remapping [logical] :: If true, indicates that this axes group is for a intensive layer-located field that must be remapped to these axes. Used for rank>2.

  • % needs_interpolating [logical] :: If true, indicates that this axes group is for a sampled interface-located field that must be interpolated to these axes. Used for rank>2.

  • % downsample_level [integer] :: If greater than 1, the factor by which this diagnostic/axes/masks be downsampled.

  • % xyave_axes [type( axes_grp ),pointer] :: The associated 1d axes for horizontall area-averaged diagnostics.

  • % id_area [integer] :: The diag_manager id for area to be used for cell_measure of variables with this

  • % id_volume [integer] :: The diag_manager id for volume to be used for cell_measure of variables with this

  • % mask2d [real(:,:),pointer] :: Mask for 2d (x-y) axes [nondim].

  • % mask3d [real(:,:,:),pointer] :: Mask for 3d axes [nondim].

  • % dsamp [type( diag_dsamp )(2:2)] :: Downsample container.

type mom_diag_mediator/diag_grids_type

Contains an array to store a diagnostic target grid.

Type fields:
  • % h [real(:,:,:),allocatable, private] :: Target grid for remapped coordinate [H ~> m or kg m-2] or [Z ~> m].

type mom_diag_mediator/diag_grid_storage

Stores all the remapping grids and the model’s native space thicknesses.

Type fields:
  • % num_diag_coords [integer] :: Number of target coordinates.

  • % h_state [real(:,:,:),allocatable] :: Layer thicknesses in native space [H ~> m or kg m-2].

  • % diag_grids [type( diag_grids_type )(:),allocatable] :: Primarily empty, except h field.

type mom_diag_mediator/diag_type

This type is used to represent a diagnostic at the diag_mediator level.

Type fields:
  • % in_use [logical,private] :: True if this entry is being used.

  • % fms_diag_id [integer,private] :: Underlying FMS diag_manager id.

  • % fms_xyave_diag_id [integer,private] :: For a horizontally area-averaged diagnostic.

  • % downsample_diag_id [integer,private] :: For a horizontally area-downsampled diagnostic.

  • % debug_str [character (64),private] :: For FATAL errors and debugging.

  • % axes [type( axes_grp ),pointer, private] :: The axis group for this diagnostic.

  • % next [type( diag_type ),pointer, private] :: Pointer to the next diagnostic.

  • % conversion_factor [real,private] :: If non-zero, a factor to multiply data by before posting to FMS, often including factors to undo internal scaling in units of [a A-1 ~> 1].

  • % v_extensive [logical,private] :: True for vertically extensive fields (vertically integrated). False for intensive (concentrations).

  • % xyz_method [integer,private] :: A 3 digit integer encoding the diagnostics cell method It can be used to determine the downsample algorithm.

type mom_diag_mediator/diagcs_dsamp

Container for down sampling information.

Type fields:
  • % axesbl [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axestl [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axescul [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axescvl [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axesbi [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axesti [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axescui [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axescvi [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axesb1 [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axest1 [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axescu1 [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % axescv1 [type( axes_grp ),private] :: Axes for each location on a diagnostic grid.

  • % remap_axestl [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axesbl [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axescul [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axescvl [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axesti [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axesbi [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axescui [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % remap_axescvi [type( axes_grp )(:),allocatable, private] :: Axes for each location on a diagnostic grid.

  • % mask3dtl [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dbl [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dcul [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dcvl [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dti [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dbi [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dcui [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % mask3dcvi [real(:,:,:),pointer, private] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i), all [nondim]

  • % isc [integer,private] :: The start i-index of cell centers within the computational domain.

  • % iec [integer,private] :: The end i-index of cell centers within the computational domain.

  • % jsc [integer,private] :: The start j-index of cell centers within the computational domain.

  • % jec [integer,private] :: The end j-index of cell centers within the computational domain.

  • % isd [integer,private] :: The start i-index of cell centers within the data domain.

  • % ied [integer,private] :: The end i-index of cell centers within the data domain.

  • % jsd [integer,private] :: The start j-index of cell centers within the data domain.

  • % jed [integer,private] :: The end j-index of cell centers within the data domain.

  • % isg [integer,private] :: The start i-index of cell centers within the global domain.

  • % ieg [integer,private] :: The end i-index of cell centers within the global domain.

  • % jsg [integer,private] :: The start j-index of cell centers within the global domain.

  • % jeg [integer,private] :: The end j-index of cell centers within the global domain.

  • % isgb [integer,private] :: The start i-index of cell corners within the global domain.

  • % iegb [integer,private] :: The end i-index of cell corners within the global domain.

  • % jsgb [integer,private] :: The start j-index of cell corners within the global domain.

  • % jegb [integer,private] :: The end j-index of cell corners within the global domain.

  • % mask2dt [real(:,:),pointer, private] :: 2D mask array for cell-center points [nondim]

  • % mask2dbu [real(:,:),pointer, private] :: 2D mask array for cell-corner points [nondim]

  • % mask2dcu [real(:,:),pointer, private] :: 2D mask array for east-face points [nondim]

  • % mask2dcv [real(:,:),pointer, private] :: 2D mask array for north-face points [nondim]

type mom_diag_mediator/diag_ctrl

The following data type a list of diagnostic fields an their variants, as well as variables that control the handling of model output.

Type fields:
  • % axesbl [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axestl [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axescul [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axescvl [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axesbi [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axesti [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axescui [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axescvi [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axesb1 [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axest1 [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axescu1 [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % axescv1 [type( axes_grp )] :: The following are 3D and 2D axis groups defined for output. The names indicate the horizontal (B, T, Cu, or Cv) and vertical (L, i, or 1) locations.

  • % mask3dtl [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dbl [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dcul [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dcvl [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dti [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dbi [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dcui [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % mask3dcvi [real(:,:,:),pointer] :: 3D mask arrays for diagnostics at layers (mask…L) and interfaces (mask…i) all [nondim]

  • % dsamp [type( diagcs_dsamp )(2:max_dsamp_lev)] :: Downsample control container.

  • % remap_axestl [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axesbl [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axescul [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axescvl [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axesti [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axesbi [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axescui [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % remap_axescvi [type( axes_grp )(:),allocatable] :: Axes used for remapping.

  • % available_diag_doc_unit [integer] :: The unit number of a diagnostic documentation file. This file is open if available_diag_doc_unit is > 0.

  • % chksum_iounit [integer] :: The unit number of a diagnostic documentation file. This file is open if available_diag_doc_unit is > 0.

  • % diag_as_chksum [logical] :: If true, log chksums in a text file instead of posting diagnostics.

  • % show_call_tree [logical] :: Display the call tree while running. Set by VERBOSITY level.

  • % grid_space_axes [logical] :: If true, diagnostic horizontal coordinates axes are in grid space.

  • % is [integer] :: The start i-index of cell centers within the computational domain.

  • % ie [integer] :: The end i-index of cell centers within the computational domain.

  • % js [integer] :: The start j-index of cell centers within the computational domain.

  • % je [integer] :: The end j-index of cell centers within the computational domain.

  • % isd [integer] :: The start i-index of cell centers within the data domain.

  • % ied [integer] :: The end i-index of cell centers within the data domain.

  • % jsd [integer] :: The start j-index of cell centers within the data domain.

  • % jed [integer] :: The end j-index of cell centers within the data domain.

  • % time_int [real] :: The time interval for any fields that are offered for averaging [s].

  • % time_end [type(time_type)] :: The end time of the valid interval for any offered field.

  • % ave_enabled [logical] :: True if averaging is enabled.

  • % axeszi [type( axes_grp )] :: A 1-D z-space axis at interfaces.

  • % axeszl [type( axes_grp )] :: A 1-D z-space axis at layer centers.

  • % axesnull [type( axes_grp )] :: An axis group for scalars.

  • % mask2dt [real(:,:),pointer] :: 2D mask array for cell-center points [nondim]

  • % mask2dbu [real(:,:),pointer] :: 2D mask array for cell-corner points [nondim]

  • % mask2dcu [real(:,:),pointer] :: 2D mask array for east-face points [nondim]

  • % mask2dcv [real(:,:),pointer] :: 2D mask array for north-face points [nondim]

  • % diags [type( diag_type )(:),allocatable] :: The list of diagnostics.

  • % next_free_diag_id [integer] :: The next unused diagnostic ID.

  • % missing_value [real] :: default missing value to be sent to ALL diagnostics registrations [various]

  • % num_diag_coords [integer] :: Number of diagnostic vertical coordinates (remapped)

  • % diag_remap_cs [type( diag_remap_ctrl )(:),allocatable] :: Control structure for each possible coordinate.

  • % diag_grid_temp [type( diag_grid_storage )] :: Stores the remapped diagnostic grid.

  • % diag_grid_overridden [logical] :: True if the diagnostic grids have been overriden.

  • % remap_axeszl [type( axes_grp )(:),allocatable] :: The 1-D z-space cell-centered axis for remapping.

  • % remap_axeszi [type( axes_grp )(:),allocatable] :: The 1-D z-space interface axis for remapping.

  • % h [real(:,:,:),pointer] :: The thicknesses needed for remapping [H ~> m or kg m-2].

  • % t [real(:,:,:),pointer] :: The temperatures needed for remapping [C ~> degC].

  • % s [real(:,:,:),pointer] :: The salinities needed for remapping [S ~> ppt].

  • % eqn_of_state [type( eos_type ),pointer] :: The equation of state type.

  • % tv [type( thermo_var_ptrs ),pointer] :: A sturcture with thermodynamic variables that are are used to convert thicknesses to vertical extents.

  • % g [type( ocean_grid_type ),pointer] :: The ocean grid type.

  • % gv [type( verticalgrid_type ),pointer] :: The model’s vertical ocean grid.

  • % us [type( unit_scale_type ),pointer] :: A dimensional unit scaling type.

  • % volume_cell_measure_dm_id [integer] :: The volume cell measure (special diagnostic) manager id.

  • % num_chksum_diags [integer] :: Number of checksum-only diagnostics.

  • % h_begin [real(:,:,:),allocatable] :: Layer thicknesses at the beginning of the timestep used for remapping of extensive variables [H ~> m or kg m-2].

Function/Subroutine Documentation

subroutine mom_diag_mediator/set_axes_info(G, GV, US, param_file, diag_cs, set_vertical)

Sets up diagnostics axes.

Parameters:
  • g :: [inout] Ocean grid structure

  • gv :: [in] ocean vertical grid structure

  • us :: [in] A dimensional unit scaling type

  • param_file :: [in] Parameter file structure

  • diag_cs :: [inout] Diagnostics control structure

  • set_vertical :: [in] If true or missing, set up vertical axes

Call to:

define_axes_group diag_grid_storage_init set_axes_info_dsamp

subroutine mom_diag_mediator/set_axes_info_dsamp(G, GV, param_file, diag_cs, id_zl_native, id_zi_native)
Parameters:
  • g :: [in] Ocean grid structure

  • gv :: [in] ocean vertical grid structure

  • param_file :: [in] Parameter file structure

  • diag_cs :: [inout] Diagnostics control structure

  • id_zl_native :: [in] ID of native layers

  • id_zi_native :: [in] ID of native interfaces

Call to:

define_axes_group_dsamp

Called from:

set_axes_info

subroutine mom_diag_mediator/set_masks_for_axes(G, diag_cs)

set_masks_for_axes sets up the 2d and 3d masks for diagnostics using the current grid recorded after calling diag_update_remap_grids()

Parameters:
  • g :: [in] The ocean grid type.

  • diag_cs :: A pointer to a type with many variables used for diagnostics

Call to:

set_masks_for_axes_dsamp

subroutine mom_diag_mediator/set_masks_for_axes_dsamp(G, diag_cs)
Parameters:
  • g :: [in] The ocean grid type.

  • diag_cs :: A pointer to a type with many variables used for diagnostics

Called from:

set_masks_for_axes

subroutine mom_diag_mediator/diag_register_area_ids(diag_cs, id_area_t, id_area_q)

Attaches the id of cell areas to axes groups for use with cell_measures.

Parameters:
  • diag_cs :: [inout] Diagnostics control structure

  • id_area_t :: [in] Diag_mediator id for area of h-cells

  • id_area_q :: [in] Diag_mediator id for area of q-cells

subroutine mom_diag_mediator/register_cell_measure(G, diag, Time)

Sets a handle inside diagnostics mediator to associate 3d cell measures.

Parameters:
  • g :: [in] Ocean grid structure

  • diag :: [inout] Regulates diagnostic output

  • time :: [in] Model time

Call to:

diag_associate_volume_cell_measure register_diag_field

subroutine mom_diag_mediator/diag_associate_volume_cell_measure(diag_cs, id_h_volume)

Attaches the id of cell volumes to axes groups for use with cell_measures.

Parameters:
  • diag_cs :: [inout] Diagnostics control structure

  • id_h_volume :: [in] Diag_manager id for volume of h-cells

Called from:

register_cell_measure

function mom_diag_mediator/diag_get_volume_cell_measure_dm_id(diag_cs) [integer]

Returns diag_manager id for cell measure of h-cells.

Parameters:

diag_cs :: [in] Diagnostics control structure

subroutine mom_diag_mediator/define_axes_group(diag_cs, handles, axes, nz, vertical_coordinate_number, x_cell_method, y_cell_method, v_cell_method, is_h_point, is_q_point, is_u_point, is_v_point, is_layer, is_interface, is_native, needs_remapping, needs_interpolating, xyave_axes)

Defines a group of “axes” from list of handles.

Parameters:
  • diag_cs :: [in] Diagnostics control structure

  • handles :: [in] A list of 1D axis handles

  • axes :: [out] The group of 1D axes

  • nz :: [in] Number of layers in this diagnostic grid

  • vertical_coordinate_number :: [in] Index number for vertical coordinate

  • x_cell_method :: [in] A x-direction cell method used to construct the “cell_methods” attribute in CF convention

  • y_cell_method :: [in] A y-direction cell method used to construct the “cell_methods” attribute in CF convention

  • v_cell_method :: [in] A vertical direction cell method used to construct the “cell_methods” attribute in CF convention

  • is_h_point :: [in] If true, indicates this axes group for h-point located fields

  • is_q_point :: [in] If true, indicates this axes group for q-point located fields

  • is_u_point :: [in] If true, indicates this axes group for u-point located fields

  • is_v_point :: [in] If true, indicates this axes group for v-point located fields

  • is_layer :: [in] If true, indicates that this axes group is for a layer vertically-located field.

  • is_interface :: [in] If true, indicates that this axes group is for an interface vertically-located field.

  • is_native :: [in] If true, indicates that this axes group is for a native model grid. False for any other grid.

  • needs_remapping :: [in] If true, indicates that this axes group is for a intensive layer-located field that must be remapped to these axes. Used for rank>2.

  • needs_interpolating :: [in] If true, indicates that this axes group is for a sampled interface-located field that must be interpolated to these axes. Used for rank>2.

  • xyave_axes :: The corresponding axes group for horizontally area-average diagnostics

Call to:

i2s

Called from:

mom_internal_tides::internal_tides_init set_axes_info

subroutine mom_diag_mediator/define_axes_group_dsamp(diag_cs, handles, axes, dl, nz, vertical_coordinate_number, x_cell_method, y_cell_method, v_cell_method, is_h_point, is_q_point, is_u_point, is_v_point, is_layer, is_interface, is_native, needs_remapping, needs_interpolating, xyave_axes)

Defines a group of downsampled “axes” from list of handles.

Parameters:
  • diag_cs :: [in] Diagnostics control structure

  • handles :: [in] A list of 1D axis handles

  • axes :: [out] The group of 1D axes

  • dl :: [in] Downsample level

  • nz :: [in] Number of layers in this diagnostic grid

  • vertical_coordinate_number :: [in] Index number for vertical coordinate

  • x_cell_method :: [in] A x-direction cell method used to construct the “cell_methods” attribute in CF convention

  • y_cell_method :: [in] A y-direction cell method used to construct the “cell_methods” attribute in CF convention

  • v_cell_method :: [in] A vertical direction cell method used to construct the “cell_methods” attribute in CF convention

  • is_h_point :: [in] If true, indicates this axes group for h-point located fields

  • is_q_point :: [in] If true, indicates this axes group for q-point located fields

  • is_u_point :: [in] If true, indicates this axes group for u-point located fields

  • is_v_point :: [in] If true, indicates this axes group for v-point located fields

  • is_layer :: [in] If true, indicates that this axes group is for a layer vertically-located field.

  • is_interface :: [in] If true, indicates that this axes group is for an interface vertically-located field.

  • is_native :: [in] If true, indicates that this axes group is for a native model grid. False for any other grid.

  • needs_remapping :: [in] If true, indicates that this axes group is for a intensive layer-located field that must be remapped to these axes. Used for rank>2.

  • needs_interpolating :: [in] If true, indicates that this axes group is for a sampled interface-located field that must be interpolated to these axes. Used for rank>2.

  • xyave_axes :: The corresponding axes group for horizontally area-average diagnostics

Call to:

i2s

Called from:

set_axes_info_dsamp

subroutine mom_diag_mediator/set_diag_mediator_grid(G, diag_cs)

Set up the array extents for doing diagnostics.

Parameters:
  • g :: [inout] The ocean’s grid structure

  • diag_cs :: [inout] Structure used to regulate diagnostic output

subroutine mom_diag_mediator/post_data_0d(diag_field_id, field, diag_cs, is_static)

Make a real scalar diagnostic available for averaging or output.

Parameters:
  • diag_field_id :: [in] The id for an output variable returned by a previous call to register_diag_field.

  • field :: [in] real value being offered for output or averaging in internally scaled arbitrary units [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • is_static :: [in] If true, this is a static field that is always offered.

subroutine mom_diag_mediator/post_data_1d_k(diag_field_id, field, diag_cs, is_static)

Make a real 1-d array diagnostic available for averaging or output.

Parameters:
  • diag_field_id :: [in] The id for an output variable returned by a previous call to register_diag_field.

  • field :: [in] 1-d array being offered for output or averaging in internally scaled arbitrary units [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • is_static :: [in] If true, this is a static field that is always offered.

subroutine mom_diag_mediator/post_data_2d(diag_field_id, field, diag_cs, is_static, mask)

Make a real 2-d array diagnostic available for averaging or output.

Parameters:
  • diag_field_id :: [in] The id for an output variable returned by a previous call to register_diag_field.

  • field :: [in] 2-d array being offered for output or averaging in internally scaled arbitrary units [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • is_static :: [in] If true, this is a static field that is always offered.

  • mask :: [in] If present, use this real array as the data mask [nondim]

subroutine mom_diag_mediator/post_data_2d_low(diag, field, diag_cs, is_static, mask)

Make a real 2-d array diagnostic available for averaging or output using a diag_type() instead of an integer id. instead of an integer id.

Parameters:
  • diag :: [in] A structure describing the diagnostic to post

  • field :: [in] 2-d array being offered for output or averaging in internally scaled arbitrary units [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • is_static :: [in] If true, this is a static field that is always offered.

  • mask :: [in] If present, use this real array as the data mask [nondim]

Call to:

downsample_field_2d msk

Called from:

mom_diag_mediator::post_data::post_data_2d

subroutine mom_diag_mediator/post_data_3d(diag_field_id, field, diag_cs, is_static, mask, alt_h)

Make a real 3-d array diagnostic available for averaging or output.

Parameters:
  • diag_field_id :: [in] The id for an output variable returned by a previous call to register_diag_field.

  • field :: [in] 3-d array being offered for output or averaging in internally scaled arbitrary units [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • is_static :: [in] If true, this is a static field that is always offered.

  • mask :: [in] If present, use this real array as the data mask [nondim]

  • alt_h :: [in] An alternate thickness to use for vertically

subroutine mom_diag_mediator/post_data_3d_low(diag, field, diag_cs, is_static, mask)

Make a real 3-d array diagnostic available for averaging or output using a diag_type() instead of an integer id. instead of an integer id.

Parameters:
  • diag :: [in] A structure describing the diagnostic to post

  • field :: [in] 3-d array being offered for output or averaging in internally scaled arbitrary units [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • is_static :: [in] If true, this is a static field that is always offered.

  • mask :: [in] If present, use this real array as the data mask [nondim]

Call to:

downsample_field_3d msk post_xy_average

Called from:

mom_diag_mediator::post_data::post_data_3d

subroutine mom_diag_mediator/post_product_u(id, u_a, u_b, G, nz, diag, mask, alt_h)

Calculate and write out diagnostics that are the product of two 3-d arrays at u-points.

Parameters:
  • id :: [in] The ID for this diagnostic

  • g :: [in] ocean grid structure

  • nz :: [in] The size of the arrays in the vertical

  • u_a :: [in] The first u-point array in arbitrary units [A]

  • u_b :: [in] The second u-point array in arbitrary units [B]

  • diag :: [in] regulates diagnostic output

  • mask :: [in] If present, use this real array as the data mask [nondim]

  • alt_h :: [in] An alternate thickness to use for vertically remapping this diagnostic [H ~> m or kg m-2]

subroutine mom_diag_mediator/post_product_sum_u(id, u_a, u_b, G, nz, diag)

Calculate and write out diagnostics that are the vertical sum of the product of two 3-d arrays at u-points.

Parameters:
  • id :: [in] The ID for this diagnostic

  • g :: [in] ocean grid structure

  • nz :: [in] The size of the arrays in the vertical

  • u_a :: [in] The first u-point array in arbitrary units [A]

  • u_b :: [in] The second u-point array in arbitrary units [B]

  • diag :: [in] regulates diagnostic output

subroutine mom_diag_mediator/post_product_v(id, v_a, v_b, G, nz, diag, mask, alt_h)

Calculate and write out diagnostics that are the product of two 3-d arrays at v-points.

Parameters:
  • id :: [in] The ID for this diagnostic

  • g :: [in] ocean grid structure

  • nz :: [in] The size of the arrays in the vertical

  • v_a :: [in] The first v-point array in arbitrary units [A]

  • v_b :: [in] The second v-point array in arbitrary units [B]

  • diag :: [in] regulates diagnostic output

  • mask :: [in] If present, use this real array as the data mask [nondim]

  • alt_h :: [in] An alternate thickness to use for vertically remapping this diagnostic [H ~> m or kg m-2]

subroutine mom_diag_mediator/post_product_sum_v(id, v_a, v_b, G, nz, diag)

Calculate and write out diagnostics that are the vertical sum of the product of two 3-d arrays at v-points.

Parameters:
  • id :: [in] The ID for this diagnostic

  • g :: [in] ocean grid structure

  • nz :: [in] The size of the arrays in the vertical

  • v_a :: [in] The first v-point array in arbitrary units [A]

  • v_b :: [in] The second v-point array in arbitrary units [B]

  • diag :: [in] regulates diagnostic output

subroutine mom_diag_mediator/post_xy_average(diag_cs, diag, field)

Post the horizontally area-averaged diagnostic.

Parameters:
  • diag :: [in] This diagnostic

  • field :: [in] Diagnostic field in arbitrary units [A ~> a]

  • diag_cs :: [in] Diagnostics mediator control structure

Called from:

post_data_3d_low

subroutine mom_diag_mediator/enable_averaging(time_int_in, time_end_in, diag_cs)

This subroutine enables the accumulation of time averages over the specified time interval.

Parameters:
  • time_int_in :: [in] The time interval [s] over which any values that are offered are valid.

  • time_end_in :: [in] The end time of the valid interval

  • diag_cs :: [inout] Structure used to regulate diagnostic output

Called from:

mom_barotropic::btstep

subroutine mom_diag_mediator/enable_averages(time_int, time_end, diag_CS, T_to_s)

Enable the accumulation of time averages over the specified time interval in time units.

Parameters:
  • time_int :: [in] The time interval over which any values that are offered are valid [T ~> s].

  • time_end :: [in] The end time of the valid interval.

  • diag_cs :: [inout] A structure that is used to regulate diagnostic output

  • t_to_s :: [in] A conversion factor for time_int to [s].

Called from:

mom_barotropic::btstep mom_forcing_type::forcing_diagnostics mom_forcing_type::mech_forcing_diags

subroutine mom_diag_mediator/disable_averaging(diag_cs)

Call this subroutine to avoid averaging any offered fields.

Parameters:

diag_cs :: [inout] Structure used to regulate diagnostic output

Called from:

mom_forcing_type::forcing_diagnostics mom_forcing_type::mech_forcing_diags

function mom_diag_mediator/query_averaging_enabled(diag_cs, time_int, time_end) [logical]

Call this subroutine to determine whether the averaging is currently enabled. .true. is returned if it is.

Parameters:
  • diag_cs :: [in] Structure used to regulate diagnostic output

  • time_int :: [out] Current setting of diagtime_int [s]

  • time_end :: [out] Current setting of diagtime_end

Called from:

mom_ale::ale_regrid mom_lateral_mixing_coeffs::calc_resoln_function mom_lateral_mixing_coeffs::calc_slope_functions mom_lateral_mixing_coeffs::calc_visbeck_coeffs_old mom_opacity::set_opacity mom_vert_friction::vertvisc mom_vert_friction::vertvisc_coef

function mom_diag_mediator/get_diag_time_end(diag_cs) [type(time_type)]

This function returns the valid end time for use with diagnostics that are handled outside of the MOM6 diagnostics infrastructure.

Parameters:

diag_cs :: [in] Structure used to regulate diagnostic output

Called from:

mom_generic_tracer::mom_generic_tracer_column_physics mom_generic_tracer::mom_generic_tracer_surface_state

function mom_diag_mediator/register_diag_field(module_name, field_name, axes_in, init_time, long_name, units, missing_value, range, mask_variant, standard_name, verbose, do_not_log, err_msg, interp_method, tile_count, cmor_field_name, cmor_long_name, cmor_units, cmor_standard_name, cell_methods, x_cell_method, y_cell_method, v_cell_method, conversion, v_extensive) [integer]

Returns the “diag_mediator” handle for a group (native, CMOR, z-coord, …) of diagnostics derived from one field.

Parameters:
  • module_name :: [in] Name of this module, usually “ocean_model” or “ice_shelf_model”

  • field_name :: [in] Name of the diagnostic field

  • axes_in :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • init_time :: [in] Time at which a field is first available?

  • long_name :: [in] Long name of a field.

  • units :: [in] Units of a field.

  • standard_name :: [in] Standardized name associated with a field

  • missing_value :: [in] A value that indicates missing values in output files, in unscaled arbitrary units [a]

  • range :: [in] Valid range of a variable (not used in MOM?) in arbitrary units [a]

  • mask_variant :: [in] If true a logical mask must be provided with post_data() calls (not used in MOM?) calls (not used in MOM?)

  • verbose :: [in] If true, FMS is verbose (not used in MOM?)

  • do_not_log :: [in] If true, do not log something (not used in MOM?)

  • err_msg :: [out] String into which an error message might be placed (not used in MOM?)

  • interp_method :: [in] If ‘none’ indicates the field should not be interpolated as a scalar

  • tile_count :: [in] no clue (not used in MOM?)

  • cmor_field_name :: [in] CMOR name of a field

  • cmor_long_name :: [in] CMOR long name of a field

  • cmor_units :: [in] CMOR units of a field

  • cmor_standard_name :: [in] CMOR standardized name associated with a field

  • cell_methods :: [in] String to append as cell_methods attribute. Use ‘’ to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction.

  • x_cell_method :: [in] Specifies the cell method for the x-direction. Use ‘’ have no method.

  • y_cell_method :: [in] Specifies the cell method for the y-direction. Use ‘’ have no method.

  • v_cell_method :: [in] Specifies the cell method for the vertical direction. Use ‘’ have no method.

  • conversion :: [in] A value to multiply data by before writing to files, often including factors to undo internal scaling and in units of [a A-1 ~> 1]

  • v_extensive :: [in] True for vertically extensive fields (vertically integrated). Default/absent for intensive.

Call to:

attach_cell_methods mom_diag_remap::diag_remap_set_active log_available_diag register_diag_field_expand_cmor

Called from:

mom_controlled_forcing::controlled_forcing_init mom_coriolisadv::coriolisadv_init mom_diapyc_energy_req::diapyc_energy_req_init mom_cfc_cap::initialize_cfc_cap mom_int_tide_input::int_tide_input_init mom_interface_filter::interface_filter_init mom_cvmix_kpp::kpp_init mom_stoch_eos::mom_stoch_eos_init ocean_register_diag mom_opacity::opacity_init mom_porous_barriers::porous_barriers_init register_cell_measure mom_offline_main::register_diags_offline_transport mom_set_diffusivity::set_diffusivity_init mom_stochastics::stochastics_init mom_tracer_hor_diff::tracer_hor_diff_init mom_zanna_bolton::zb2020_init

function mom_diag_mediator/register_diag_field_expand_cmor(dm_id, module_name, field_name, axes, init_time, long_name, units, missing_value, range, mask_variant, standard_name, verbose, do_not_log, err_msg, interp_method, tile_count, cmor_field_name, cmor_long_name, cmor_units, cmor_standard_name, cell_methods, x_cell_method, y_cell_method, v_cell_method, conversion, v_extensive) [logical]

Returns True if either the native or CMOr version of the diagnostic were registered. Updates ‘dm_id’ after calling register_diag_field_expand_axes() for both native and CMOR variants of the field. for both native and CMOR variants of the field.

Parameters:
  • dm_id :: [inout] The diag_mediator ID for this diagnostic group

  • module_name :: [in] Name of this module, usually “ocean_model” or “ice_shelf_model”

  • field_name :: [in] Name of the diagnostic field

  • axes :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • init_time :: [in] Time at which a field is first available?

  • long_name :: [in] Long name of a field.

  • units :: [in] Units of a field.

  • standard_name :: [in] Standardized name associated with a field

  • missing_value :: [in] A value that indicates missing values in output files, in unscaled arbitrary units [a]

  • range :: [in] Valid range of a variable (not used in MOM?) in arbitrary units [a]

  • mask_variant :: [in] If true a logical mask must be provided with post_data() calls (not used in MOM?) calls (not used in MOM?)

  • verbose :: [in] If true, FMS is verbose (not used in MOM?)

  • do_not_log :: [in] If true, do not log something (not used in MOM?)

  • err_msg :: [out] String into which an error message might be placed (not used in MOM?)

  • interp_method :: [in] If ‘none’ indicates the field should not be interpolated as a scalar

  • tile_count :: [in] no clue (not used in MOM?)

  • cmor_field_name :: [in] CMOR name of a field

  • cmor_long_name :: [in] CMOR long name of a field

  • cmor_units :: [in] CMOR units of a field

  • cmor_standard_name :: [in] CMOR standardized name associated with a field

  • cell_methods :: [in] String to append as cell_methods attribute. Use ‘’ to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction.

  • x_cell_method :: [in] Specifies the cell method for the x-direction. Use ‘’ have no method.

  • y_cell_method :: [in] Specifies the cell method for the y-direction. Use ‘’ have no method.

  • v_cell_method :: [in] Specifies the cell method for the vertical direction. Use ‘’ have no method.

  • conversion :: [in] A value to multiply data by before writing to files, often including factors to undo internal scaling and in units of [a A-1 ~> 1]

  • v_extensive :: [in] True for vertically extensive fields (vertically integrated). Default/absent for intensive.

Call to:

add_diag_to_list add_xyz_method attach_cell_methods register_diag_field_expand_axes

Called from:

register_diag_field

function mom_diag_mediator/register_diag_field_expand_axes(module_name, field_name, axes, init_time, long_name, units, missing_value, range, mask_variant, standard_name, verbose, do_not_log, err_msg, interp_method, tile_count) [integer]

Returns an FMS id from register_diag_field_fms (the diag_manager routine) after expanding axes (axes-group) into handles and conditionally adding an FMS area_id for cell_measures.

Parameters:
  • module_name :: [in] Name of this module, usually “ocean_model” or “ice_shelf_model”

  • field_name :: [in] Name of the diagnostic field

  • axes :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • init_time :: [in] Time at which a field is first available?

  • long_name :: [in] Long name of a field.

  • units :: [in] Units of a field.

  • standard_name :: [in] Standardized name associated with a field

  • missing_value :: [in] A value that indicates missing values in output files, in unscaled arbitrary units [a]

  • range :: [in] Valid range of a variable (not used in MOM?) in arbitrary units [a]

  • mask_variant :: [in] If true a logical mask must be provided with post_data() calls (not used in MOM?) calls (not used in MOM?)

  • verbose :: [in] If true, FMS is verbose (not used in MOM?)

  • do_not_log :: [in] If true, do not log something (not used in MOM?)

  • err_msg :: [out] String into which an error message might be placed (not used in MOM?)

  • interp_method :: [in] If ‘none’ indicates the field should not be interpolated as a scalar

  • tile_count :: [in] no clue (not used in MOM?)

Called from:

register_diag_field_expand_cmor

subroutine mom_diag_mediator/add_diag_to_list(diag_cs, dm_id, fms_id, this_diag, axes, module_name, field_name, msg)

Create a diagnostic type and attached to list.

Parameters:
  • diag_cs :: Diagnostics mediator control structure

  • dm_id :: [inout] The diag_mediator ID for this diagnostic group

  • fms_id :: [in] The FMS diag_manager ID for this diagnostic

  • this_diag :: This diagnostic

  • axes :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • module_name :: [in] Name of this module, usually “ocean_model” or “ice_shelf_model”

  • field_name :: [in] Name of diagnostic

  • msg :: [in] Message for errors

Call to:

alloc_diag_with_id get_new_diag_id

Called from:

register_diag_field_expand_cmor

subroutine mom_diag_mediator/add_xyz_method(diag, axes, x_cell_method, y_cell_method, v_cell_method, v_extensive)

Adds the encoded “cell_methods” for a diagnostics as a diag% property This allows access to the cell_method for a given diagnostics at the time of sending.

Parameters:
  • diag :: This diagnostic

  • axes :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • x_cell_method :: [in] Specifies the cell method for the x-direction. Use ‘’ have no method.

  • y_cell_method :: [in] Specifies the cell method for the y-direction. Use ‘’ have no method.

  • v_cell_method :: [in] Specifies the cell method for the vertical direction. Use ‘’ have no method.

  • v_extensive :: [in] True for vertically extensive fields (vertically integrated). Default/absent for intensive.

Called from:

register_diag_field_expand_cmor

subroutine mom_diag_mediator/attach_cell_methods(id, axes, ostring, cell_methods, x_cell_method, y_cell_method, v_cell_method, v_extensive)

Attaches “cell_methods” attribute to a variable based on defaults for axes_grp() or optional arguments. or optional arguments.

Parameters:
  • id :: [in] Handle to diagnostic

  • axes :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • ostring :: [out] The cell_methods strings that would appear in the file

  • cell_methods :: [in] String to append as cell_methods attribute. Use ‘’ to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction.

  • x_cell_method :: [in] Specifies the cell method for the x-direction. Use ‘’ have no method.

  • y_cell_method :: [in] Specifies the cell method for the y-direction. Use ‘’ have no method.

  • v_cell_method :: [in] Specifies the cell method for the vertical direction. Use ‘’ have no method.

  • v_extensive :: [in] True for vertically extensive fields (vertically integrated). Default/absent for intensive.

Called from:

register_diag_field register_diag_field_expand_cmor

function mom_diag_mediator/register_scalar_field(module_name, field_name, init_time, diag_cs, long_name, units, missing_value, range, standard_name, do_not_log, err_msg, interp_method, cmor_field_name, cmor_long_name, cmor_units, cmor_standard_name, conversion) [integer]
Return:

undefined :: An integer handle for a diagnostic array.

Parameters:
  • module_name :: [in] Name of this module, usually “ocean_model” or “ice_shelf_model”

  • field_name :: [in] Name of the diagnostic field

  • init_time :: [in] Time at which a field is first available?

  • diag_cs :: [inout] Structure used to regulate diagnostic output

  • long_name :: [in] Long name of a field.

  • units :: [in] Units of a field.

  • standard_name :: [in] Standardized name associated with a field

  • missing_value :: [in] A value that indicates missing values in output files, in unscaled arbitrary units [a]

  • range :: [in] Valid range of a variable (not used in MOM?) in arbitrary units [a]

  • do_not_log :: [in] If true, do not log something (not used in MOM?)

  • err_msg :: [out] String into which an error message might be placed (not used in MOM?)

  • interp_method :: [in] If ‘none’ indicates the field should not be interpolated as a scalar

  • cmor_field_name :: [in] CMOR name of a field

  • cmor_long_name :: [in] CMOR long name of a field

  • cmor_units :: [in] CMOR units of a field

  • cmor_standard_name :: [in] CMOR standardized name associated with a field

  • conversion :: [in] A value to multiply data by before writing to files, often including factors to undo internal scaling and in units of [a A-1 ~> 1]

Call to:

alloc_diag_with_id get_new_diag_id log_available_diag

function mom_diag_mediator/register_static_field(module_name, field_name, axes, long_name, units, missing_value, range, mask_variant, standard_name, do_not_log, interp_method, tile_count, cmor_field_name, cmor_long_name, cmor_units, cmor_standard_name, area, x_cell_method, y_cell_method, area_cell_method, conversion) [integer]

Registers a static diagnostic, returning an integer handle.

Return:

undefined :: An integer handle for a diagnostic array.

Parameters:
  • module_name :: [in] Name of this module, usually “ocean_model” or “ice_shelf_model”

  • field_name :: [in] Name of the diagnostic field

  • axes :: [in] Container w/ up to 3 integer handles that indicates axes for this field

  • long_name :: [in] Long name of a field.

  • units :: [in] Units of a field.

  • standard_name :: [in] Standardized name associated with a field

  • missing_value :: [in] A value that indicates missing values in output files, in unscaled arbitrary units [a]

  • range :: [in] Valid range of a variable (not used in MOM?) in arbitrary units [a]

  • mask_variant :: [in] If true a logical mask must be provided with post_data() calls (not used in MOM?) calls (not used in MOM?)

  • do_not_log :: [in] If true, do not log something (not used in MOM?)

  • interp_method :: [in] If ‘none’ indicates the field should not be interpolated as a scalar

  • tile_count :: [in] no clue (not used in MOM?)

  • cmor_field_name :: [in] CMOR name of a field

  • cmor_long_name :: [in] CMOR long name of a field

  • cmor_units :: [in] CMOR units of a field

  • cmor_standard_name :: [in] CMOR standardized name associated with a field

  • area :: [in] fms_id for area_t

  • x_cell_method :: [in] Specifies the cell method for the x-direction.

  • y_cell_method :: [in] Specifies the cell method for the y-direction.

  • area_cell_method :: [in] Specifies the cell method for area

  • conversion :: [in] A value to multiply data by before writing to files, often including factors to undo internal scaling and in units of [a A-1 ~> 1]

Call to:

alloc_diag_with_id get_new_diag_id log_available_diag

Called from:

mom_geothermal::geothermal_init

subroutine mom_diag_mediator/describe_option(opt_name, value, diag_CS)

Describe an option setting in the diagnostic files.

Parameters:
  • opt_name :: [in] The name of the option

  • value :: [in] A character string with the setting of the option.

  • diag_cs :: [in] Structure used to regulate diagnostic output

Called from:

log_available_diag

function mom_diag_mediator/ocean_register_diag(var_desc, G, diag_CS, day) [integer]

Registers a diagnostic using the information encapsulated in the vardesc type argument and returns an integer handle to this diagostic. That integer handle is negative if the diagnostic is unused.

Return:

undefined :: An integer handle to this diagnostic.

Parameters:
  • var_desc :: [in] The vardesc type describing the diagnostic

  • g :: [in] The ocean’s grid type

  • diag_cs :: [in] The diagnotic control structure

  • day :: [in] The current model time

Call to:

register_diag_field

subroutine mom_diag_mediator/diag_mediator_infrastructure_init(err_msg)
Parameters:

err_msg :: [out] An error message

subroutine mom_diag_mediator/diag_mediator_init(G, GV, US, nz, param_file, diag_cs, doc_file_dir)

diag_mediator_init initializes the MOM diag_mediator and opens the available diagnostics file, if appropriate.

Parameters:
  • g :: [inout] The ocean grid type.

  • gv :: [in] The ocean vertical grid structure

  • us :: [in] A dimensional unit scaling type

  • nz :: [in] The number of layers in the model’s native grid.

  • param_file :: [in] Parameter file structure

  • diag_cs :: [inout] A pointer to a type with many variables used for diagnostics

  • doc_file_dir :: [in] A directory in which to create the file

Call to:

mom_io::get_filename_appendix id_clock_diag_grid_updates id_clock_diag_mediator id_clock_diag_remap initialize_diag_type

subroutine mom_diag_mediator/diag_set_state_ptrs(h, tv, diag_cs)

Set pointers to the default state fields used to remap diagnostics.

Parameters:
  • h :: [in] the model thickness array [H ~> m or kg m-2]

  • tv :: [in] A sturcture with thermodynamic variables that are are used to convert thicknesses to vertical extents

  • diag_cs :: [inout] diag mediator control structure

subroutine mom_diag_mediator/diag_update_remap_grids(diag_cs, alt_h, alt_T, alt_S, update_intensive, update_extensive)

Build/update vertical grids for diagnostic remapping.

Parameters:
  • diag_cs :: [inout] Diagnostics control structure

  • alt_h :: [in] Used if remapped grids should be something other than the current thicknesses [H ~> m or kg m-2]

  • alt_t :: [in] Used if remapped grids should be something other than the current temperatures [C ~> degC]

  • alt_s :: [in] Used if remapped grids should be something other than the current salinity [S ~> ppt]

  • update_intensive :: [in] If true (default), update the grids used for intensive diagnostics

  • update_extensive :: [in] If true (not default), update the grids used for intensive diagnostics

Call to:

mom_error_handler::calltree_enter mom_error_handler::calltree_leave id_clock_diag_grid_updates

Called from:

mom_bulk_mixed_layer::bulkmixedlayer mom_mixed_layer_restrat::mixedlayer_restrat_bodner mom_mixed_layer_restrat::mixedlayer_restrat_om4 mom_dynamics_split_rk2::step_mom_dyn_split_rk2 mom_dynamics_split_rk2b::step_mom_dyn_split_rk2b mom_dynamics_unsplit::step_mom_dyn_unsplit mom_thickness_diffuse::thickness_diffuse

subroutine mom_diag_mediator/diag_masks_set(G, nz, diag_cs)

Sets up the 2d and 3d masks for native diagnostics.

Parameters:
  • g :: [in] The ocean grid type.

  • nz :: [in] The number of layers in the model’s native grid.

  • diag_cs :: A pointer to a type with many variables used for diagnostics

Call to:

downsample_diag_masks_set

subroutine mom_diag_mediator/diag_mediator_close_registration(diag_CS)
Parameters:

diag_cs :: [inout] Structure used to regulate diagnostic output

Call to:

mom_diag_remap::diag_remap_diag_registration_closed

Called from:

mom6 ocean_model_mod::ocean_model_init

subroutine mom_diag_mediator/axes_grp_end(axes)
Parameters:

axes :: [inout] Axes group to be destroyed

Called from:

diag_mediator_end

subroutine mom_diag_mediator/diag_mediator_end(time, diag_CS, end_diag_manager)
Parameters:
  • time :: [in] The current model time

  • diag_cs :: [inout] Structure used to regulate diagnostic output

  • end_diag_manager :: [in] If true, call diag_manager_end()

Call to:

axes_grp_end diag_grid_storage_end

Called from:

mom6 ocean_model_mod::ocean_model_end

function mom_diag_mediator/i2s(a, n_in) [character(len=15)]

Convert the first n elements (up to 3) of an integer array to an underscore delimited string.

Parameters:
  • a :: [in] The array of integers to translate

  • n_in :: [in] The number of elements to translate, by default all

Return:

undefined :: The returned string

Called from:

define_axes_group define_axes_group_dsamp

function mom_diag_mediator/get_new_diag_id(diag_cs) [integer]

Returns a new diagnostic id, it may be necessary to expand the diagnostics array.

Parameters:

diag_cs :: [inout] Diagnostics control structure

Call to:

initialize_diag_type

Called from:

add_diag_to_list register_scalar_field register_static_field

subroutine mom_diag_mediator/initialize_diag_type(diag)

Initializes a diag_type() (used after allocating new memory) (used after allocating new memory)

Parameters:

diag :: [inout] diag_type() to be initialized to be initialized

Called from:

diag_mediator_init get_new_diag_id

subroutine mom_diag_mediator/alloc_diag_with_id(diag_id, diag_cs, diag)

Make a new diagnostic. Either use memory which is in the array of ‘primary’ diagnostics, or if that is in use, insert it to the list of secondary diags.

Parameters:
  • diag_id :: [in] id for the diagnostic

  • diag_cs :: [inout] structure used to regulate diagnostic output

  • diag :: structure representing a diagnostic (inout)

Called from:

add_diag_to_list register_scalar_field register_static_field

subroutine mom_diag_mediator/log_available_diag(used, module_name, field_name, cell_methods_string, comment, diag_CS, long_name, units, standard_name, variants)

Log a diagnostic to the available diagnostics file.

Parameters:
  • used :: [in] Whether this diagnostic was in the diag_table or not

  • module_name :: [in] Name of the diagnostic module

  • field_name :: [in] Name of this diagnostic field

  • cell_methods_string :: [in] The spatial component of the CF cell_methods attribute

  • comment :: [in] A comment to append after [Used|Unused]

  • diag_cs :: [in] The diagnotics control structure

  • long_name :: [in] CF long name of diagnostic

  • units :: [in] Units for diagnostic

  • standard_name :: [in] CF standardized name of diagnostic

  • variants :: [in] Alternate modules and variable names for this diagnostic and derived diagnostics

Call to:

describe_option

Called from:

register_diag_field register_scalar_field register_static_field

subroutine mom_diag_mediator/log_chksum_diag(docunit, description, chksum)

Log the diagnostic chksum to the chksum diag file.

Parameters:
  • docunit :: [in] Handle of the log file

  • description :: [in] Name of the diagnostic module

  • chksum :: [in] chksum of the diagnostic

subroutine mom_diag_mediator/diag_grid_storage_init(grid_storage, G, GV, diag)

Allocates fields necessary to store diagnostic remapping fields.

Parameters:
  • grid_storage :: [inout] Structure containing a snapshot of the target grids

  • g :: [in] Horizontal grid

  • gv :: [in] ocean vertical grid structure

  • diag :: [in] Diagnostic control structure used as the contructor template for this routine

Called from:

set_axes_info

subroutine mom_diag_mediator/diag_copy_diag_to_storage(grid_storage, h_state, diag)

Copy from the main diagnostic arrays to the grid storage as well as the native thicknesses.

Parameters:
  • grid_storage :: [inout] Structure containing a snapshot of the target grids

  • h_state :: [in] Current model thicknesses [H ~> m or kg m-2]

  • diag :: [in] Diagnostic control structure used as the contructor

Called from:

mom::initialize_mom mom::step_mom

subroutine mom_diag_mediator/diag_copy_storage_to_diag(diag, grid_storage)

Copy from the stored diagnostic arrays to the main diagnostic grids.

Parameters:
  • diag :: [inout] Diagnostic control structure used as the contructor

  • grid_storage :: [in] Structure containing a snapshot of the target grids

Called from:

mom_diagnostics::calculate_diagnostic_fields mom_tracer_registry::post_tracer_diagnostics_at_sync mom_diagnostics::post_transport_diagnostics

subroutine mom_diag_mediator/diag_save_grids(diag)

Save the current diagnostic grids in the temporary structure within diag.

Parameters:

diag :: [inout] Diagnostic control structure used as the contructor

Called from:

mom_diagnostics::calculate_diagnostic_fields mom_tracer_registry::post_tracer_diagnostics_at_sync mom_diagnostics::post_transport_diagnostics

subroutine mom_diag_mediator/diag_restore_grids(diag)

Restore the diagnostic grids from the temporary structure within diag.

Parameters:

diag :: [inout] Diagnostic control structure used as the contructor

Called from:

mom_diagnostics::calculate_diagnostic_fields mom_tracer_registry::post_tracer_diagnostics_at_sync mom_diagnostics::post_transport_diagnostics

subroutine mom_diag_mediator/diag_grid_storage_end(grid_storage)

Deallocates the fields in the remapping fields container.

Parameters:

grid_storage :: [inout] Structure containing a snapshot of the target grids

Called from:

diag_mediator_end

subroutine mom_diag_mediator/downsample_diag_masks_set(G, nz, diag_cs)
Parameters:
  • g :: [in] The ocean grid type.

  • nz :: [in] The number of layers in the model’s native grid.

  • diag_cs :: A pointer to a type with many variables used for diagnostics

Called from:

diag_masks_set

subroutine mom_diag_mediator/downsample_diag_indices_get(fo1, fo2, dl, diag_cs, isv, iev, jsv, jev)

Get the diagnostics-compute indices (to be passed to send_data) based on the shape of the diag field (the same way they are deduced for non-downsampled fields)

Parameters:
  • fo1 :: [in] The size of the diag field in x

  • fo2 :: [in] The size of the diag field in y

  • dl :: [in] Integer downsample level

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • isv :: [out] i-start index for diagnostics

  • iev :: [out] i-end index for diagnostics

  • jsv :: [out] j-start index for diagnostics

  • jev :: [out] j-end index for diagnostics

Called from:

mom_diag_mediator::downsample_diag_field::downsample_diag_field_2d mom_diag_mediator::downsample_diag_field::downsample_diag_field_3d

subroutine mom_diag_mediator/downsample_diag_field_3d(locfield, locfield_dsamp, dl, diag_cs, diag, isv, iev, jsv, jev, mask)

This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-compurte indices for the downsampled array 3d interface.

Parameters:
  • locfield :: Input array pointer in arbitrary units [A ~> a]

  • locfield_dsamp :: [inout] Output (downsampled) array [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • diag :: [in] A structure describing the diagnostic to post

  • dl :: [in] Level of down sampling

  • isv :: [inout] i-start index for diagnostics

  • iev :: [inout] i-end index for diagnostics

  • jsv :: [inout] j-start index for diagnostics

  • jev :: [inout] j-end index for diagnostics

  • mask :: [in] If present, use this real array as the data mask [nondim]

subroutine mom_diag_mediator/downsample_diag_field_2d(locfield, locfield_dsamp, dl, diag_cs, diag, isv, iev, jsv, jev, mask)

This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-compurte indices for the downsampled array 2d interface.

Parameters:
  • locfield :: Input array pointer in arbitrary units [A ~> a]

  • locfield_dsamp :: [inout] Output (downsampled) array [A ~> a]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • diag :: [in] A structure describing the diagnostic to post

  • dl :: [in] Level of down sampling

  • isv :: [inout] i-start index for diagnostics

  • iev :: [inout] i-end index for diagnostics

  • jsv :: [inout] j-start index for diagnostics

  • jev :: [inout] j-end index for diagnostics

  • mask :: [in] If present, use this real array as the data mask [nondim].

subroutine mom_diag_mediator/downsample_field_3d(field_in, field_out, dl, method, mask, diag_cs, diag, isv_o, jsv_o, isv_d, iev_d, jsv_d, jev_d)

This subroutine allocates and computes a down sampled 3d array given an input array The down sample method is based on the “cell_methods” for the diagnostics as explained in the above table.

The down sample method could be deduced (before send_data call) from the diagx_cell_method, diagy_cell_method and diagv_cell_method

This is the summary of the down sample algoritm for a diagnostic field f:

\[f(Id,Jd) = \sum_{i,j} f(Id+i,Jd+j) * weight(Id+i,Jd+j) / [ \sum_{i,j} weight(Id+i,Jd+j)]\]

Here, i and j run from 0 to dl-1 (dl being the down sample level). Id,Jd are the down sampled (coarse grid) indices run over the coarsened compute grid, if and jf are the original (fine grid) indices.

Example   x_cell y_cell v_cell algorithm_id    implemented weight(if,jf)
---------------------------------------------------------------------------------------
theta     mean   mean   mean   MMM =222        G%areaT(if,jf)*h(if,jf)
u         point  mean   mean   PMM =022        dyCu(if,jf)*h(if,jf)*delta(if,Id)
v         mean   point  mean   MPM =202        dxCv(if,jf)*h(if,jf)*delta(jf,Jd)
?         point  sum    mean   PSM =012        h(if,jf)*delta(if,Id)
volcello  sum    sum    sum    SSS =111        1
T_dfxy_co sum    sum    point  SSP =110        1
umo       point  sum    sum    PSS =011        1*delta(if,Id)
vmo       sum    point  sum    SPS =101        1*delta(jf,Jd)
umo_2d    point  sum    point  PSP =010        1*delta(if,Id)
vmo_2d    sum    point  point  SPP =100        1*delta(jf,Jd)
?         point  mean   point  PMP =020        dyCu(if,jf)*delta(if,Id)
?         mean   point  point  MPP =200        dxCv(if,jf)*delta(jf,Jd)
w         mean   mean   point  MMP =220        G%areaT(if,jf)
h*theta   mean   mean   sum    MMS =221        G%areaT(if,jf)

delta is the Kronecker delta
Parameters:
  • field_in :: Original field to be downsampled in arbitrary units [A ~> a]

  • field_out :: Downsampled field in the same arbtrary units [A ~> a]

  • dl :: [in] Level of down sampling

  • method :: [in] Sampling method

  • mask :: Mask for field [nondim]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • diag :: [in] A structure describing the diagnostic to post

  • isv_o :: [in] Original i-start index

  • jsv_o :: [in] Original j-start index

  • isv_d :: [in] i-start index of down sampled data

  • iev_d :: [in] i-end index of down sampled data

  • jsv_d :: [in] j-start index of down sampled data

  • jev_d :: [in] j-end index of down sampled data

Called from:

post_data_3d_low

subroutine mom_diag_mediator/downsample_field_2d(field_in, field_out, dl, method, mask, diag_cs, diag, isv_o, jsv_o, isv_d, iev_d, jsv_d, jev_d)

This subroutine allocates and computes a down sampled 2d array given an input array The down sample method is based on the “cell_methods” for the diagnostics as explained in the above table.

Parameters:
  • field_in :: Original field to be downsampled in arbitrary units [A ~> a]

  • field_out :: Downsampled field in the same arbtrary units [A ~> a]

  • dl :: [in] Level of down sampling

  • method :: [in] Sampling method

  • mask :: Mask for field [nondim]

  • diag_cs :: [in] Structure used to regulate diagnostic output

  • diag :: [in] A structure describing the diagnostic to post

  • isv_o :: [in] Original i-start index

  • jsv_o :: [in] Original j-start index

  • isv_d :: [in] i-start index of down sampled data

  • iev_d :: [in] i-end index of down sampled data

  • jsv_d :: [in] j-start index of down sampled data

  • jev_d :: [in] j-end index of down sampled data

Called from:

post_data_2d_low

subroutine mom_diag_mediator/downsample_mask_2d(field_in, field_out, dl, isc_o, jsc_o, isd_o, jsd_o, isc_d, iec_d, jsc_d, jec_d, isd_d, ied_d, jsd_d, jed_d)

Allocate and compute the 2d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it’s closed (0)

Parameters:
  • isd_o :: [in] Original data domain i-start index

  • jsd_o :: [in] Original data domain j-start index

  • field_in :: [in] Original field to be down sampled in arbitrary units [A]

  • field_out :: Down sampled field mask [nondim]

  • dl :: [in] Level of down sampling

  • isc_o :: [in] Original i-start index

  • jsc_o :: [in] Original j-start index

  • isc_d :: [in] Computational i-start index of down sampled data

  • iec_d :: [in] Computational i-end index of down sampled data

  • jsc_d :: [in] Computational j-start index of down sampled data

  • jec_d :: [in] Computational j-end index of down sampled data

  • isd_d :: [in] Data domain i-start index of down sampled data

  • ied_d :: [in] Data domain i-end index of down sampled data

  • jsd_d :: [in] Data domain j-start index of down sampled data

  • jed_d :: [in] Data domain j-end index of down sampled data

subroutine mom_diag_mediator/downsample_mask_3d(field_in, field_out, dl, isc_o, jsc_o, isd_o, jsd_o, isc_d, iec_d, jsc_d, jec_d, isd_d, ied_d, jsd_d, jed_d)

Allocate and compute the 3d down sampled mask The masks are down sampled based on a minority rule, i.e., a coarse cell is open (1) if at least one of the sub-cells are open, otherwise it’s closed (0)

Parameters:
  • isd_o :: [in] Original data domain i-start index

  • jsd_o :: [in] Original data domain j-start index

  • field_in :: [in] Original field to be down sampled in arbitrary units [A]

  • field_out :: down sampled field mask [nondim]

  • dl :: [in] Level of down sampling

  • isc_o :: [in] Original i-start index

  • jsc_o :: [in] Original j-start index

  • isc_d :: [in] Computational i-start index of down sampled data

  • iec_d :: [in] Computational i-end index of down sampled data

  • jsc_d :: [in] Computational j-start index of down sampled data

  • jec_d :: [in] Computational j-end index of down sampled data

  • isd_d :: [in] Computational i-start index of down sampled data

  • ied_d :: [in] Computational i-end index of down sampled data

  • jsd_d :: [in] Computational j-start index of down sampled data

  • jed_d :: [in] Computational j-end index of down sampled data

function mom_diag_mediator/found_in_diagtable(diag, varName) [logical]

Fakes a register of a diagnostic to find out if an obsolete parameter appears in the diag_table.

Parameters:
  • diag :: [in] A structure used to control diagnostics.

  • varname :: [in] The obsolete diagnostic name

Called from:

mom_obsolete_diagnostics::diag_found