namespace mom_grid

Overview

Provides the ocean grid type. More…

namespace mom_grid {

// global functions

subroutine, public mom_grid_init(
    G G,
    param_file param_file,
    US US,
    HI HI,
    global_indexing global_indexing,
    bathymetry_at_vel bathymetry_at_vel
    );

subroutine, public rescale_grid_bathymetry(G G, m_in_new_units m_in_new_units);
subroutine, public set_derived_metrics(G G, US US);
logical function, public ispointincell(G G, i i, j j, x x, y y);
subroutine, public set_first_direction(G G, y_first y_first);
subroutine, public get_global_grid_size(G G, niglobal niglobal, njglobal njglobal);
subroutine, public mom_grid_end(G G);

} // namespace mom_grid

Detailed Documentation

Provides the ocean grid type.

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.

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, 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.

Global Functions

subroutine, public mom_grid_init(
    G G,
    param_file param_file,
    US US,
    HI HI,
    global_indexing global_indexing,
    bathymetry_at_vel bathymetry_at_vel
    )

MOM_grid_init initializes the ocean grid array sizes and grid memory.

Parameters:

g

The horizontal grid type

param_file

Parameter file handle

us

A dimensional unit scaling type

hi

A hor_index_type for array extents

global_indexing

If true use global index values instead of having the data domain on each processor start at 1.

bathymetry_at_vel

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.

subroutine, public rescale_grid_bathymetry(G G, m_in_new_units 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

The horizontal grid structure

m_in_new_units

The new internal representation of 1 m depth.

subroutine, public set_derived_metrics(G G, US US)

set_derived_metrics calculates metric terms that are derived from other metrics.

Parameters:

g

The horizontal grid structure

us

A dimensional unit scaling type

logical function, public ispointincell(G G, i i, j j, x x, y y)

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

Parameters:

g

Grid type

i

i index of cell to test

j

j index of cell to test

x

x coordinate of point

y

y coordinate of point

subroutine, public set_first_direction(G G, y_first y_first)

Store an integer indicating which direction to work on first.

Parameters:

g

The ocean’s grid structure

y_first

The first direction to store

subroutine, public get_global_grid_size(
    G G,
    niglobal niglobal,
    njglobal njglobal
    )

Return global shape of horizontal grid.

Parameters:

g

The horizontal grid type

niglobal

i-index global size of grid

njglobal

j-index global size of grid

subroutine, public mom_grid_end(G G)

Release memory used by the ocean_grid_type and related structures.

Parameters:

g

The horizontal grid type