mom_diag_remap module reference

provides runtime remapping of diagnostics to z star, sigma and rho vertical coordinates.

More…

Data Types

diag_remap_ctrl

Represents remapping of diagnostics to a particular vertical coordinate.

Functions/Subroutines

diag_remap_init()

Initialize a diagnostic remapping type with the given vertical coordinate.

diag_remap_end()

De-init a diagnostic remapping type.

diag_remap_diag_registration_closed()

Inform that all diagnostics have been registered.

diag_remap_set_active()

Indicate that this remapping type is actually used by the diag manager.

diag_remap_configure_axes()

Configure the vertical axes for a diagnostic remapping control structure.

diag_remap_get_axes_info()

Get layer and interface axes ids for this coordinate Needed when defining axes groups.

diag_remap_axes_configured()

Whether or not the axes for this vertical coordinated has been configured.

diag_remap_update()

Build/update target vertical grids for diagnostic remapping.

diag_remap_do_remap()

Remap diagnostic field to alternative vertical grid.

do_remap()

The internal routine to remap a diagnostic field to an alternative vertical grid.

diag_remap_calc_hmask()

Calculate masks for target grid.

vertically_reintegrate_diag_field()

Vertically re-grid an already vertically-integrated diagnostic field to alternative vertical grid.

vertically_reintegrate_field()

The internal routine to vertically re-grid an already vertically-integrated diagnostic field to an alternative vertical grid.

vertically_interpolate_diag_field()

Vertically interpolate diagnostic field to alternative vertical grid.

vertically_interpolate_field()

Internal routine to vertically interpolate a diagnostic field to an alternative vertical grid.

horizontally_average_diag_field()

Horizontally average a diagnostic field.

horizontally_average_field()

Horizontally average a diagnostic field.

Detailed Description

The diag_remap_ctrl() type represents a remapping of diagnostics to a particular vertical coordinate. The module is used by the diag mediator module in the following way:type represents a remapping of diagnostics to a particular vertical coordinate. The module is used by the diag mediator module in the following way: #. diag_remap_init() is called to initialize a is called to initialize a diag_remap_ctrl() instance.instance.

  1. diag_remap_configure_axes() is called to read the configuration file and set up the vertical coordinate / axes definitions.is called to read the configuration file and set up the vertical coordinate / axes definitions.

  2. diag_remap_get_axes_info() returns information needed for the diag mediator to define new axes for the remapped diagnostics.returns information needed for the diag mediator to define new axes for the remapped diagnostics.

  3. diag_remap_update() is called periodically (whenever h, T or S change) to either create or update the target remapping grids.is called periodically (whenever h, T or S change) to either create or update the target remapping grids.

  4. diag_remap_do_remap() is called from within a diag post() to do the remapping before the diagnostic is written out. is called from within a diag post() to do the remapping before the diagnostic is written out.

Type Documentation

type mom_diag_remap/diag_remap_ctrl

Represents remapping of diagnostics to a particular vertical coordinate.

Type fields:
  • % configured [logical,private] :: Whether vertical coordinate has been configured.

  • % initialized [logical,private] :: Whether remappping initialized.

  • % used [logical,private] :: Whether this coordinate actually gets used.

  • % vertical_coord [integer,private] :: The vertical coordinate that we remap to.

  • % vertical_coord_name [character (len=10),private] :: The coordinate name as understood by ALE.

  • % z_based_coord [logical,private] :: If true, this coordinate is based on remapping of geometric distances across layers (in [Z ~> m]) rather than layer thicknesses (in [H ~> m or kg m-2]). This distinction only matters in non-Boussinesq mode.

  • % diag_coord_name [character (len=16),private] :: A name for the purpose of run-time parameters.

  • % diag_module_suffix [character (len=8),private] :: The suffix for the module to appear in diag_table.

  • % remap_cs [type( remapping_cs ),private] :: Remapping control structure use for this axes.

  • % regrid_cs [type( regridding_cs ),private] :: Regridding control structure that defines the coordinates for this axes.

  • % nz [integer,private] :: Number of vertical levels used for remapping.

  • % h [real(:,:,:),allocatable, private] :: Remap grid thicknesses in [H ~> m or kg m-2] or vertical extents in [Z ~> m], depending on the setting of Z_based_coord.

  • % h_extensive [real(:,:,:),allocatable, private] :: Remap grid thicknesses in [H ~> m or kg m-2] or vertical extents in [Z ~> m] for remapping extensive variables.

  • % interface_axes_id [integer,private] :: Vertical axes id for remapping at interfaces.

  • % layer_axes_id [integer,private] :: Vertical axes id for remapping on layers.

  • % answer_date [integer,private] :: The vintage of the order of arithmetic and expressions to use for remapping. Values below 20190101 recover the answers from 2018, while higher values use more robust forms of the same remapping expressions.

Function/Subroutine Documentation

subroutine mom_diag_remap/diag_remap_init(remap_cs, coord_tuple, answer_date, GV)

Initialize a diagnostic remapping type with the given vertical coordinate.

Parameters:
  • remap_cs :: [inout] Diag remapping control structure

  • coord_tuple :: [in] A string in form of MODULE_SUFFIX PARAMETER_SUFFIX COORDINATE_NAME

  • answer_date :: [in] The vintage of the order of arithmetic and expressions to use for remapping. Values below 20190101 recover the answers from 2018, while higher values use more robust forms of the same remapping expressions.

  • gv :: [in] The ocean vertical grid structure, used here to evaluate whether the model is in non-Boussinesq mode.

Call to:

regrid_consts::coordinatemode mom_string_functions::extractword

subroutine mom_diag_remap/diag_remap_end(remap_cs)

De-init a diagnostic remapping type. Free allocated memory.

Parameters:

remap_cs :: [inout] Diag remapping control structure

Called from:

diag_remap_diag_registration_closed

subroutine mom_diag_remap/diag_remap_diag_registration_closed(remap_cs)

Inform that all diagnostics have been registered. If _set_active() has not been called on the remapping control structure will be disabled. This saves time in the case that a vertical coordinate was configured but no diagnostics which use the coordinate appeared in the diag_table.

Parameters:

remap_cs :: [inout] Diag remapping control structure

Call to:

diag_remap_end

Called from:

mom_diag_mediator::diag_mediator_close_registration

subroutine mom_diag_remap/diag_remap_set_active(remap_cs)

Indicate that this remapping type is actually used by the diag manager. If this is never called then the type will be disabled to save time. See further explanation with diag_remap_registration_closed.

Parameters:

remap_cs :: [inout] Diag remapping control structure

Called from:

mom_diag_mediator::register_diag_field

subroutine mom_diag_remap/diag_remap_configure_axes(remap_cs, GV, US, param_file)

Configure the vertical axes for a diagnostic remapping control structure. Reads a configuration parameters to determine coordinate generation.

Parameters:
  • remap_cs :: [inout] Diag remap control structure

  • gv :: [in] ocean vertical grid structure

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

  • param_file :: [in] Parameter file structure

Call to:

regrid_consts::coordinatemode mom_string_functions::lowercase

subroutine mom_diag_remap/diag_remap_get_axes_info(remap_cs, nz, id_layer, id_interface)

Get layer and interface axes ids for this coordinate Needed when defining axes groups.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • nz :: [out] Number of vertical levels for the coordinate

  • id_layer :: [out] 1D-axes id for layer points

  • id_interface :: [out] 1D-axes id for interface points

function mom_diag_remap/diag_remap_axes_configured(remap_cs) [logical]

Whether or not the axes for this vertical coordinated has been configured. Configuration is complete when diag_remap_configure_axes() has been successfully called. has been successfully called.

Parameters:

remap_cs :: [in] Diagnostic coordinate control structure

subroutine mom_diag_remap/diag_remap_update(remap_cs, G, GV, US, h, T, S, eqn_of_state, h_target)

Build/update target vertical grids for diagnostic remapping.

Parameters:
  • remap_cs :: [inout] Diagnostic coordinate control structure

  • g :: The ocean’s grid type

  • gv :: [in] ocean vertical grid structure

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

  • h :: [in] New thickness in [H ~> m or kg m-2] or [Z ~> m], depending

  • t :: [in] New temperatures [C ~> degC]

  • s :: [in] New salinities [S ~> ppt]

  • eqn_of_state :: [in] A pointer to the equation of state

  • h_target :: [inout] The new diagnostic thicknesses in [H ~> m or kg m-2]

Call to:

coord_rho::build_rho_column coord_sigma::build_sigma_column coord_zlike::build_zstar_column regrid_consts::coordinatemode mom_regridding::get_rho_cs mom_regridding::get_sigma_cs mom_regridding::get_zlike_cs mom_error_handler::mom_error

subroutine mom_diag_remap/diag_remap_do_remap(remap_cs, G, GV, US, h, staggered_in_x, staggered_in_y, mask, field, remapped_field)

Remap diagnostic field to alternative vertical grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • gv :: [in] ocean vertical grid structure

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

  • h :: [in] The current thicknesses [H ~> m or kg m-2] or [Z ~> m], depending on the value of remap_CSZ_based_coord

  • staggered_in_x :: [in] True is the x-axis location is at u or q points

  • staggered_in_y :: [in] True is the y-axis location is at v or q points

  • mask :: A mask for the field [nondim].

  • field :: [in] The diagnostic field to be remapped [A]

  • remapped_field :: [out] Field remapped to new coordinate [A]

Call to:

mom_error_handler::assert do_remap

subroutine mom_diag_remap/do_remap(remap_cs, G, GV, US, isdf, jsdf, h, staggered_in_x, staggered_in_y, field, remapped_field, mask)

The internal routine to remap a diagnostic field to an alternative vertical grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • gv :: [in] ocean vertical grid structure

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

  • isdf :: [in] The starting i-index in memory for field

  • jsdf :: [in] The starting j-index in memory for field

  • h :: [in] The current thicknesses [H ~> m or kg m-2] or [Z ~> m],

  • staggered_in_x :: [in] True is the x-axis location is at u or q points

  • staggered_in_y :: [in] True is the y-axis location is at v or q points

  • field :: [in] The diagnostic field to be remapped [A]

  • remapped_field :: [out] Field remapped to new coordinate [A]

  • mask :: [in] A mask for the field [nondim]

Call to:

mom_error_handler::assert

Called from:

diag_remap_do_remap

subroutine mom_diag_remap/diag_remap_calc_hmask(remap_cs, G, mask)

Calculate masks for target grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • mask :: [out] h-point mask for target grid [nondim]

Call to:

mom_error_handler::assert regrid_consts::coordinatemode

subroutine mom_diag_remap/vertically_reintegrate_diag_field(remap_cs, G, h, h_target, staggered_in_x, staggered_in_y, mask, field, reintegrated_field)

Vertically re-grid an already vertically-integrated diagnostic field to alternative vertical grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • h :: [in] The thicknesses of the source grid [H ~> m or kg m-2] or [Z ~> m]

  • h_target :: [in] The thicknesses of the target grid [H ~> m or kg m-2] or [Z ~> m]

  • staggered_in_x :: [in] True is the x-axis location is at u or q points

  • staggered_in_y :: [in] True is the y-axis location is at v or q points

  • mask :: A mask for the field [nondim]. Note that because this is a pointer it retains its declared indexing conventions.

  • field :: [in] The diagnostic field to be remapped [A]

  • reintegrated_field :: [out] Field argument remapped to alternative coordinate [A]

Call to:

mom_error_handler::assert vertically_reintegrate_field

subroutine mom_diag_remap/vertically_reintegrate_field(remap_cs, G, isdf, jsdf, h, h_target, staggered_in_x, staggered_in_y, field, reintegrated_field, mask)

The internal routine to vertically re-grid an already vertically-integrated diagnostic field to an alternative vertical grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • isdf :: [in] The starting i-index in memory for field

  • jsdf :: [in] The starting j-index in memory for field

  • h :: [in] The thicknesses of the source grid [H ~> m or kg m-2] or [Z ~> m]

  • h_target :: [in] The thicknesses of the target grid [H ~> m or kg m-2] or [Z ~> m]

  • staggered_in_x :: [in] True is the x-axis location is at u or q points

  • staggered_in_y :: [in] True is the y-axis location is at v or q points

  • field :: [in] The diagnostic field to be remapped [A]

  • reintegrated_field :: [out] Field argument remapped to alternative coordinate [A]

  • mask :: [in] A mask for the field [nondim]

Call to:

mom_error_handler::assert mom_remapping::reintegrate_column

Called from:

vertically_reintegrate_diag_field

subroutine mom_diag_remap/vertically_interpolate_diag_field(remap_cs, G, h, staggered_in_x, staggered_in_y, mask, field, interpolated_field)

Vertically interpolate diagnostic field to alternative vertical grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • h :: [in] The current thicknesses [H ~> m or kg m-2] or [Z ~> m], depending on the value of remap_csZ_based_coord

  • staggered_in_x :: [in] True is the x-axis location is at u or q points

  • staggered_in_y :: [in] True is the y-axis location is at v or q points

  • mask :: A mask for the field [nondim]. Note that because this is a pointer it retains its declared indexing conventions.

  • field :: [in] The diagnostic field to be remapped [A]

  • interpolated_field :: [inout] Field argument remapped to alternative coordinate [A]

Call to:

mom_error_handler::assert vertically_interpolate_field

subroutine mom_diag_remap/vertically_interpolate_field(remap_cs, G, isdf, jsdf, h, staggered_in_x, staggered_in_y, field, interpolated_field, mask)

Internal routine to vertically interpolate a diagnostic field to an alternative vertical grid.

Parameters:
  • remap_cs :: [in] Diagnostic coordinate control structure

  • g :: [in] Ocean grid structure

  • isdf :: [in] The starting i-index in memory for field

  • jsdf :: [in] The starting j-index in memory for field

  • h :: [in] The current thicknesses [H ~> m or kg m-2] or [Z ~> m],

  • staggered_in_x :: [in] True is the x-axis location is at u or q points

  • staggered_in_y :: [in] True is the y-axis location is at v or q points

  • field :: [in] The diagnostic field to be remapped [A]

  • interpolated_field :: [out] Field argument remapped to alternative coordinate [A]

  • mask :: [in] A mask for the field [nondim]

Call to:

mom_error_handler::assert mom_remapping::interpolate_column

Called from:

vertically_interpolate_diag_field

subroutine mom_diag_remap/horizontally_average_diag_field(G, GV, h, staggered_in_x, staggered_in_y, is_layer, is_extensive, field, averaged_field, averaged_mask)

Horizontally average a diagnostic field.

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

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

  • h :: [in] The current thicknesses [H ~> m or kg m-2]

  • staggered_in_x :: [in] True if the x-axis location is at u or q points

  • staggered_in_y :: [in] True if the y-axis location is at v or q points

  • is_layer :: [in] True if the z-axis location is at h points

  • is_extensive :: [in] True if the z-direction is spatially integrated (over layers)

  • field :: [in] The diagnostic field to be remapped [A]

  • averaged_field :: [out] Field argument horizontally averaged [A]

  • averaged_mask :: [out] Mask for horizontally averaged field [nondim]

Call to:

horizontally_average_field

subroutine mom_diag_remap/horizontally_average_field(G, GV, isdf, jsdf, h, staggered_in_x, staggered_in_y, is_layer, is_extensive, field, averaged_field, averaged_mask)

Horizontally average a diagnostic field.

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

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

  • isdf :: [in] The starting i-index in memory for field

  • jsdf :: [in] The starting j-index in memory for field

  • h :: [in] The current thicknesses [H ~> m or kg m-2]

  • staggered_in_x :: [in] True if the x-axis location is at u or q points

  • staggered_in_y :: [in] True if the y-axis location is at v or q points

  • is_layer :: [in] True if the z-axis location is at h points

  • is_extensive :: [in] True if the z-direction is spatially integrated (over layers)

  • field :: [in] The diagnostic field to be remapped [A]

  • averaged_field :: [out] Field argument horizontally averaged [A]

  • averaged_mask :: [out] Mask for horizontally averaged field [nondim]

Call to:

mom_error_handler::assert

Called from:

horizontally_average_diag_field