mom_grid module reference

Provides the ocean grid type.

More…

Data Types

ocean_grid_type

Ocean grid type.

Functions/Subroutines

mom_grid_init()

MOM_grid_init initializes the ocean grid array sizes and grid memory.

rescale_grid_bathymetry()

rescale_grid_bathymetry permits a change in the internal units for the bathymetry on the grid, both rescaling the depths and recording the new internal units.

set_derived_metrics()

set_derived_metrics calculates metric terms that are derived from other metrics.

adcroft_reciprocal()

Adcroft_reciprocal(x) = 1/x for |x|>0 or 0 for x=0.

ispointincell()

Returns true if the coordinates (x,y) are within the h-cell (i,j)

set_first_direction()

Store an integer indicating which direction to work on first.

get_global_grid_size()

Return global shape of horizontal grid.

allocate_metrics()

Allocate memory used by the ocean_grid_type() and related structures.

mom_grid_end()

Release memory used by the ocean_grid_type() and related structures.

Detailed Description

Grid metrics and their inverses are labelled according to their staggered location on a Arakawa C (or B) grid.

  • Metrics centered on h- or T-points are labelled T, e.g. dxT is the distance across the cell in the x-direction.

  • Metrics centered on u-points are labelled Cu (C-grid u location). e.g. dyCu is the y-distance between two corners of a T-cell.

  • Metrics centered on v-points are labelled Cv (C-grid v location). e.g. dyCv is the y-distance between two -points.

  • Metrics centered on q-points are labelled Bu (B-grid u,v location). e.g. areaBu is the area centered on a q-point.

../../../_images/Grid_metrics.png

The labelling of distances (grid metrics) at various staggered

location on an T-cell and around a q-point.”

Areas centered at T-, u-, v- and q- points are areaT, areaCu, areaCv and areaBu respectively.

The reciprocal of metrics are pre-calculated and also stored in the ocean_grid_type() with a I prepended to the name. For example, with a I prepended to the name. For example, 1./areaT is called IareaT, and 1./dyCv is IdyCv.

Geographic latitude and longitude (or model coordinates if not on a sphere) are stored in geoLatT, geoLonT for T-points. u-, v- and q- point coordinates are follow same pattern of replacing T with Cu, Cv and Bu respectively.

Each location also has a 2D mask indicating whether the entire column is land or ocean. mask2dT is 1 if the column is wet or 0 if the T-cell is land. mask2dCu is 1 if both neighboring column are ocean, and 0 if either is land.

Type Documentation

type mom_grid/ocean_grid_type

Ocean grid type. See mom_grid() for details. for details.

Type fields
  • % domain [type(mom_domain_type),pointer] :: Ocean model domain.

  • % domain_aux [type(mom_domain_type),pointer] :: A non-symmetric auxiliary domain type.

  • % hi [type(hor_index_type)] :: Horizontal index ranges.

  • % hid2 [type(hor_index_type)] :: Horizontal index ranges for level-2-downsampling.

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

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

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

  • % jec [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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • % isd_global [integer] :: The value of isd in the global index space (decompoistion invariant).

  • % jsd_global [integer] :: The value of isd in the global index space (decompoistion invariant).

  • % idg_offset [integer] :: The offset between the corresponding global and local i-indices.

  • % jdg_offset [integer] :: The offset between the corresponding global and local j-indices.

  • % ke [integer] :: The number of layers in the vertical.

  • % symmetric [logical] :: True if symmetric memory is used.

  • % nonblocking_updates [logical] :: If true, non-blocking halo updates are allowed. The default is .false. (for now).

  • % first_direction [integer] :: An integer that indicates which direction is to be updated first in directionally split parts of the calculation. This can be altered during the course of the run via calls to set_first_direction.

  • % real (* df_dy [*) :: 0 for land points and 1 for ocean points on the h-grid [nondim].

  • % real :: The geographic latitude at q points in degrees of latitude or m.

  • % real :: The geographic longitude at q points in degrees of longitude or m.

  • % real :: dxT is delta x at h points [L ~> m].

  • % real :: 1/dxT [L-1 ~> m-1].

  • % real :: dyT is delta y at h points [L ~> m].

  • % real :: IdyT is 1/dyT [L-1 ~> m-1].

  • % real :: The area of an h-cell [L2 ~> m2].

  • % real :: 1/areaT [L-2 ~> m-2].

  • % real :: The sine of the angular rotation between the local model grid’s northward.

  • % real :: The cosine of the angular rotation between the local model grid’s northward.

  • % real :: 0 for boundary points and 1 for ocean points on the u grid [nondim].

  • % real :: The geographic latitude at u points in degrees of latitude or m.

  • % real :: The geographic longitude at u points in degrees of longitude or m.

  • % real :: dxCu is delta x at u points [L ~> m].

  • % real :: 1/dxCu [L-1 ~> m-1].

  • % real :: dyCu is delta y at u points [L ~> m].

  • % real :: 1/dyCu [L-1 ~> m-1].

  • % real :: The unblocked lengths of the u-faces of the h-cell [L ~> m].

  • % real :: The masked inverse areas of u-grid cells [L-2 ~> m-2].

  • % real :: The areas of the u-grid cells [L2 ~> m2].

  • % real :: 0 for boundary points and 1 for ocean points on the v grid [nondim].

  • % real :: The geographic latitude at v points in degrees of latitude or m.

  • % real :: The geographic longitude at v points in degrees of longitude or m.

  • % real :: dxCv is delta x at v points [L ~> m].

  • % real :: 1/dxCv [L-1 ~> m-1].

  • % real :: dyCv is delta y at v points [L ~> m].

  • % real :: 1/dyCv [L-1 ~> m-1].

  • % real :: The unblocked lengths of the v-faces of the h-cell [L ~> m].

  • % real :: The masked inverse areas of v-grid cells [L-2 ~> m-2].

  • % real :: The areas of the v-grid cells [L2 ~> m2].

  • % real :: 0 for boundary points and 1 for ocean points on the q grid [nondim].

  • % real :: The geographic latitude at q points in degrees of latitude or m.

  • % real :: The geographic longitude at q points in degrees of longitude or m.

  • % real :: dxBu is delta x at q points [L ~> m].

  • % real :: 1/dxBu [L-1 ~> m-1].

  • % real :: dyBu is delta y at q points [L ~> m].

  • % real :: 1/dyBu [L-1 ~> m-1].

  • % real :: areaBu is the area of a q-cell [L2 ~> m2]

  • % real :: IareaBu = 1/areaBu [L-2 ~> m-2].

  • % gridlatt [real(:),pointer] :: The latitude of T points for the purpose of labeling the output axes.

  • % gridlatb [real(:),pointer] :: The latitude of B points for the purpose of labeling the output axes.

  • % gridlont [real(:),pointer] :: The longitude of T points for the purpose of labeling the output axes.

  • % gridlonb [real(:),pointer] :: The longitude of B points for the purpose of labeling the output axes.

  • % x_axis_units [character (len=40)] :: The units that are used in labeling the x coordinate axes.

  • % y_axis_units [character (len=40)] :: The units that are used in labeling the y coordinate axes.

  • % real :: Ocean bottom depth at tracer points, in depth units [Z ~> m].

  • % z_ref [real] :: A reference value for all geometric height fields, such as bathyT [Z ~> m].

  • % bathymetry_at_vel [logical] :: If true, there are separate values for the basin depths at velocity points. Otherwise the effects of of topography are entirely determined from thickness points.

  • % real :: Topographic depths at u-points at which the flow is blocked [Z ~> m].

  • % real :: Topographic depths at u-points at which the flow is open at width dy_Cu [Z ~> m].

  • % real :: Topographic depths at v-points at which the flow is blocked [Z ~> m].

  • % real :: Topographic depths at v-points at which the flow is open at width dx_Cv [Z ~> m].

  • % real :: The Coriolis parameter at corner points [T-1 ~> s-1].

  • % real :: Derivative d/dx f (Coriolis parameter) at h-points [T-1 L-1 ~> s-1 m-1].

  • % real :: Derivative d/dy f (Coriolis parameter) at h-points [T-1 L-1 ~> s-1 m-1].

  • % areat_global [real] :: Global sum of h-cell area [m2].

  • % iareat_global [real] :: Global sum of inverse h-cell area (1/areaT_global) [m-2].

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

  • % nblocks [integer] :: The number of sub-PE blocks on this PE.

  • % block [type(hor_index_type)(:),pointer] :: Index ranges for each block.

  • % south_lat [real] :: The latitude (or y-coordinate) of the first v-line.

  • % west_lon [real] :: The longitude (or x-coordinate) of the first u-line.

  • % len_lat [real] :: The latitudinal (or y-coord) extent of physical domain.

  • % len_lon [real] :: The longitudinal (or x-coord) extent of physical domain.

  • % rad_earth [real] :: The radius of the planet [m].

  • % max_depth [real] :: The maximum depth of the ocean in depth units [Z ~> m].

Function/Subroutine Documentation

subroutine mom_grid/mom_grid_init(G, param_file, US, HI, global_indexing, bathymetry_at_vel)

MOM_grid_init initializes the ocean grid array sizes and grid memory.

Parameters
  • g :: [inout] The horizontal grid type

  • param_file :: [in] Parameter file handle

  • us :: A dimensional unit scaling type

  • hi :: [in] A hor_index_type for array extents

  • global_indexing :: [in] If true use global index values instead of having the data domain on each processor start at 1.

  • bathymetry_at_vel :: [in] If true, there are separate values for the ocean bottom depths at velocity points. Otherwise the effects of topography are entirely determined from thickness points.

Call to

allocate_metrics mom_hor_index::hor_index_init mom_error_handler::mom_error mom_error_handler::mom_mesg

Called from

mom_oda_driver_mod::init_oda mom_ice_shelf::initialize_ice_shelf

subroutine mom_grid/rescale_grid_bathymetry(G, m_in_new_units)

rescale_grid_bathymetry permits a change in the internal units for the bathymetry on the grid, both rescaling the depths and recording the new internal units.

Parameters
  • g :: [inout] The horizontal grid structure

  • m_in_new_units :: [in] The new internal representation of 1 m depth.

Call to

mom_error_handler::mom_error

subroutine mom_grid/set_derived_metrics(G, US)

set_derived_metrics calculates metric terms that are derived from other metrics.

Parameters
  • g :: [inout] The horizontal grid structure

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

Call to

adcroft_reciprocal

Called from

mom_transcribe_grid::copy_dyngrid_to_mom_grid

function mom_grid/adcroft_reciprocal(val) [real]

Adcroft_reciprocal(x) = 1/x for |x|>0 or 0 for x=0.

Parameters

val :: [in] The value being inverted.

Return

undefined :: The Adcroft reciprocal of val.

Called from

set_derived_metrics

function mom_grid/ispointincell(G, i, j, x, y) [logical]

Returns true if the coordinates (x,y) are within the h-cell (i,j)

Parameters
  • g :: [in] Grid type

  • i :: [in] i index of cell to test

  • j :: [in] j index of cell to test

  • x :: [in] x coordinate of point

  • y :: [in] y coordinate of point

subroutine mom_grid/set_first_direction(G, y_first)

Store an integer indicating which direction to work on first.

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

  • y_first :: [in] The first direction to store

subroutine mom_grid/get_global_grid_size(G, niglobal, njglobal)

Return global shape of horizontal grid.

Parameters
  • g :: [inout] The horizontal grid type

  • niglobal :: [out] i-index global size of grid

  • njglobal :: [out] j-index global size of grid

subroutine mom_grid/allocate_metrics(G)

Allocate memory used by the ocean_grid_type() and related structures. and related structures.

Parameters

g :: [inout] The horizontal grid type

Called from

mom_grid_init

subroutine mom_grid/mom_grid_end(G)

Release memory used by the ocean_grid_type() and related structures. and related structures.

Parameters

g :: [inout] The horizontal grid type