mom_grid_initialize module reference

Initializes horizontal grid.

More…

Data Types

gps

Global positioning system (aka container for information to describe the grid)

Functions/Subroutines

set_grid_metrics()

set_grid_metrics is used to set the primary values in the model's horizontal grid. The bathymetry, land-sea mask and any restricted channel widths are not known yet, so these are set later.

grid_metrics_chksum()

grid_metrics_chksum performs a set of checksums on metrics on the grid for debugging.

set_grid_metrics_from_mosaic()

Sets the grid metrics from a mosaic file.

set_grid_metrics_cartesian()

Calculate the values of the metric terms for a Cartesian grid that might be used and save them in arrays.

set_grid_metrics_spherical()

Calculate the values of the metric terms that might be used and save them in arrays.

set_grid_metrics_mercator()

Calculate the values of the metric terms that might be used and save them in arrays.

ds_di()

This function returns the grid spacing in the logical x direction in [L ~> m].

ds_dj()

This function returns the grid spacing in the logical y direction in [L ~> m].

dl()

This function returns the contribution from the line integral along one of the four sides of a cell face to the area of a cell, in [radians2], assuming that the sides follow a linear path in latitude and longitude (i.e., on a Mercator grid).

find_root()

This subroutine finds and returns the value of y at which the monotonically increasing function fn takes the value fnval, also returning in ittmax the number of iterations of Newton's method that were used to polish the root.

dx_di()

This function calculates and returns the value of dx/di in [radian gridpoint-1], where x is the longitude in Radians, and i is the integral east-west grid index.

int_di_dx()

This function calculates and returns the integral of the inverse of dx/di to the point x, in radians [gridpoints].

dy_dj()

This subroutine calculates and returns the value of dy/dj in [radian gridpoint-1], where y is the latitude in Radians, and j is the integral north-south grid index.

int_dj_dy()

This subroutine calculates and returns the integral of the inverse of dy/dj to the point y in radians [gridpoints].

extrapolate_metric()

Extrapolates missing metric data into all the halo regions.

adcroft_reciprocal()

This function implements Adcroft's rule for reciprocals, namely that Adcroft_Inv(x) = 1/x for |x|>0 or 0 for x=0.

initialize_masks()

Initializes the grid masks and any metrics that come with masks already applied.

Detailed Description

The metric terms have the form Dzp, IDzp, or DXDYp, where z can be X or Y, and p can be q, u, v, or h. z describes the direction of the metric, while p describes the location. IDzp is the inverse of Dzp, while DXDYp is the product of DXp and DYp except that areaT is calculated analytically from the latitudes and longitudes of the surrounding q points.

On a sphere, a variety of grids can be implemented by defining analytic expressions for dx_di, dy_dj (where x and y are latitude and longitude, and i and j are grid indices) and the expressions for the integrals of their inverses in the four subroutines dy_dj, Int_dj_dy, dx_di, and Int_di_dx.

initialize_masks sets up land masks based on the depth field. The one argument is the minimum ocean depth. Depths that are less than this are interpreted as land points.

Type Documentation

type  mom_grid_initialize/gps

Global positioning system (aka container for information to describe the grid)

Type fields:
  • % len_lon :: real, private The longitudinal or x-direction length of the domain [degrees_E] or [km] or [m].

  • % len_lat :: real, private The latitudinal or y-direction length of the domain [degrees_N] or [km] or [m].

  • % west_lon :: real, private The western longitude of the domain or the equivalent starting value for the x-axis [degrees_E] or [km] or [m].

  • % south_lat :: real, private The southern latitude of the domain or the equivalent starting value for the y-axis [degrees_N] or [km] or [m].

  • % rad_earth_l :: real, private The radius of the Earth in rescaled units [L ~> m].

  • % lat_enhance_factor :: real, private The amount by which the meridional resolution is enhanced within LAT_EQ_ENHANCE of the equator [nondim].

  • % lat_eq_enhance :: real, private The latitude range to the north and south of the equator over which the resolution is enhanced [degrees_N].

  • % isotropic :: logical, private If true, an isotropic grid on a sphere (also known as a Mercator grid) is used. With an isotropic grid, the meridional extent of the domain (LENLAT), the zonal extent (LENLON), and the number of grid points in each direction are

  • % equator_reference :: logical, private If true, the grid is defined to have the equator at the nearest q- or h- grid point to (-LOWLAT*NJGLOBAL/LENLAT).

  • % niglobal :: integer, private The number of i-points in the global grid computational domain.

  • % njglobal :: integer, private The number of j-points in the global grid computational domain.

[source]

Function/Subroutine Documentation

subroutine mom_grid_initialize/set_grid_metrics(G, param_file, US)

set_grid_metrics is used to set the primary values in the model’s horizontal grid. The bathymetry, land-sea mask and any restricted channel widths are not known yet, so these are set later.

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

  • param_file :: param_file [in] Parameter file structure

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

Call to:

mom_error_handler::calltree_enter mom_error_handler::calltree_leave grid_metrics_chksum mom_dyn_horgrid::set_derived_dyn_horgrid set_grid_metrics_cartesian set_grid_metrics_from_mosaic set_grid_metrics_mercator set_grid_metrics_spherical

Called from:

mom_oda_driver_mod::init_oda mom_ice_shelf::initialize_ice_shelf mom_fixed_initialization::mom_initialize_fixed

[source]

subroutine mom_grid_initialize/grid_metrics_chksum(parent, G, US)

grid_metrics_chksum performs a set of checksums on metrics on the grid for debugging.

Parameters:
  • parent :: parent [in] A string identifying the caller

  • g :: [in] The dynamic horizontal grid type

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

Called from:

set_grid_metrics

[source]

subroutine mom_grid_initialize/set_grid_metrics_from_mosaic(G, param_file, US)

Sets the grid metrics from a mosaic file.

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

  • param_file :: param_file [in] Parameter file structure

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

Call to:

mom_error_handler::calltree_enter mom_error_handler::calltree_leave extrapolate_metric

Called from:

set_grid_metrics

[source]

subroutine mom_grid_initialize/set_grid_metrics_cartesian(G, param_file, US)

Calculate the values of the metric terms for a Cartesian grid that might be used and save them in arrays.

Within this subroutine, the x- and y- grid spacings and their inverses and the cell areas centered on h, q, u, and v points are calculated, as are the geographic locations of each of these 4 sets of points.

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

  • param_file :: param_file [in] Parameter file structure

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

Call to:

mom_error_handler::calltree_enter mom_error_handler::calltree_leave

Called from:

set_grid_metrics

[source]

subroutine mom_grid_initialize/set_grid_metrics_spherical(G, param_file, US)

Calculate the values of the metric terms that might be used and save them in arrays.

Within this subroutine, the x- and y- grid spacings and their inverses and the cell areas centered on h, q, u, and v points are calculated, as are the geographic locations of each of these 4 sets of points.

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

  • param_file :: param_file [in] Parameter file structure

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

Call to:

mom_error_handler::calltree_enter mom_error_handler::calltree_leave

Called from:

set_grid_metrics

[source]

subroutine mom_grid_initialize/set_grid_metrics_mercator(G, param_file, US)

Calculate the values of the metric terms that might be used and save them in arrays.

Within this subroutine, the x- and y- grid spacings and their inverses and the cell areas centered on h, q, u, and v points are calculated, as are the geographic locations of each of these 4 sets of points.

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

  • param_file :: param_file [in] Parameter file structure

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

Call to:

mom_error_handler::calltree_enter mom_error_handler::calltree_leave dl ds_di ds_dj dx_di dy_dj find_root int_di_dx int_dj_dy

Called from:

set_grid_metrics

[source]

function  mom_grid_initialize/ds_di(x, y, GP)

This function returns the grid spacing in the logical x direction in [L ~> m].

Parameters:
  • x :: x [in] The longitude in question [radians]

  • y :: y [in] The latitude in question [radians]

  • gp :: [in] A structure of grid parameters

Call to:

dx_di

Called from:

set_grid_metrics_mercator

[source]

function  mom_grid_initialize/ds_dj(x, y, GP)

This function returns the grid spacing in the logical y direction in [L ~> m].

Parameters:
  • x :: x [in] The longitude in question [radians]

  • y :: y [in] The latitude in question [radians]

  • gp :: [in] A structure of grid parameters

Call to:

dy_dj

Called from:

set_grid_metrics_mercator

[source]

function  mom_grid_initialize/dl(x1, x2, y1, y2)

This function returns the contribution from the line integral along one of the four sides of a cell face to the area of a cell, in [radians2], assuming that the sides follow a linear path in latitude and longitude (i.e., on a Mercator grid).

Parameters:
  • x1 :: x1 [in] Segment starting longitude [radians]

  • x2 :: x2 [in] Segment ending longitude [radians]

  • y1 :: y1 [in] Segment starting latitude [radians]

  • y2 :: y2 [in] Segment ending latitude [radians]

Called from:

set_grid_metrics_mercator

[source]

function  mom_grid_initialize/find_root(fn, dy_df, GP, fnval, y1, ymin, ymax, ittmax)

This subroutine finds and returns the value of y at which the monotonically increasing function fn takes the value fnval, also returning in ittmax the number of iterations of Newton’s method that were used to polish the root.

Return:

undefined :: The value of y where fn(y) = fnval that will be returned [radians]

Parameters:
  • fn :: fn The external function whose root is being sought [gridpoints]

  • dy_df :: dy_df The inverse of the derivative of that function [radian gridpoint-1]

  • gp :: [in] A structure of grid parameters

  • fnval :: fnval [in] The value of fn being sought [gridpoints]

  • y1 :: y1 [in] A first guess for y [radians]

  • ymin :: ymin [in] The minimum permitted value of y [radians]

  • ymax :: ymax [in] The maximum permitted value of y [radians]

  • ittmax :: ittmax [out] The number of iterations used to polish the root

Called from:

set_grid_metrics_mercator

[source]

function  mom_grid_initialize/dx_di(x, GP)

This function calculates and returns the value of dx/di in [radian gridpoint-1], where x is the longitude in Radians, and i is the integral east-west grid index.

Parameters:
  • x :: x [in] The longitude in question [radians]

  • gp :: [in] A structure of grid parameters

Called from:

ds_di set_grid_metrics_mercator

[source]

function  mom_grid_initialize/int_di_dx(x, GP)

This function calculates and returns the integral of the inverse of dx/di to the point x, in radians [gridpoints].

Parameters:
  • x :: x [in] The longitude in question [radians]

  • gp :: [in] A structure of grid parameters

Called from:

set_grid_metrics_mercator

[source]

function  mom_grid_initialize/dy_dj(y, GP)

This subroutine calculates and returns the value of dy/dj in [radian gridpoint-1], where y is the latitude in Radians, and j is the integral north-south grid index.

Parameters:
  • y :: y [in] The latitude in question [radians]

  • gp :: [in] A structure of grid parameters

Called from:

ds_dj set_grid_metrics_mercator

[source]

function  mom_grid_initialize/int_dj_dy(y, GP)

This subroutine calculates and returns the integral of the inverse of dy/dj to the point y in radians [gridpoints].

Parameters:
  • y :: y [in] The latitude in question [radians]

  • gp :: [in] A structure of grid parameters

Called from:

set_grid_metrics_mercator

[source]

subroutine mom_grid_initialize/extrapolate_metric(var, jh, missing)

Extrapolates missing metric data into all the halo regions.

Parameters:
  • var :: var [inout] The array in which to fill in halos in arbitrary units [A]

  • jh :: jh [in] The size of the halos to be filled

  • missing :: missing [in] The missing data fill value, 0 by default [A]

Called from:

set_grid_metrics_from_mosaic

[source]

function  mom_grid_initialize/adcroft_reciprocal(val)

This function implements Adcroft’s rule for reciprocals, namely that Adcroft_Inv(x) = 1/x for |x|>0 or 0 for x=0.

Parameters:

val :: val [in] The value being inverted in arbitrary units [A]

Return:

undefined :: The Adcroft reciprocal of val [A-1]

Called from:

initialize_masks

[source]

subroutine mom_grid_initialize/initialize_masks(G, PF, US, OBC_dir_u, OBC_dir_v, open_corner_OBCs, maskT)

Initializes the grid masks and any metrics that come with masks already applied.

Initialize_masks sets mask2dT, mask2dCu, mask2dCv, and mask2dBu to mask out flow over any points which are shallower than Dmask and permit an appropriate treatment of the boundary conditions. mask2dCu and mask2dCv are 0.0 at any points adjacent to a land point. mask2dBu is 0.0 at any land or boundary point. For points in the ocean interior or at open boundary condition points, mask2dCu, mask2dCv, and mask2dBu are all 1.0.

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

  • pf :: [in] Parameter file structure

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

  • obc_dir_u :: [in] Trinary values that indicate whether there

  • obc_dir_v :: [in] Trinary values that indicate whether there

  • open_corner_obcs :: [in] If present and true, the bay-like corner between two orthogonal open boundary segments is open, otherwise it is closed.

  • maskt :: [in] If present, this array is used to set the

Call to:

adcroft_reciprocal mom_error_handler::calltree_enter mom_error_handler::calltree_leave

Called from:

mom_ice_shelf::initialize_ice_shelf mom_fixed_initialization::mom_initialize_fixed

[source]

[source]