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.

ds_dj()

This function returns the grid spacing in the logical y direction.

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, 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, where x is the longitude in Radians, and i is the integral north-south grid index.

int_di_dx()

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

dy_dj()

This subroutine calculates and returns the value of dy/dj, 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.

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] :: The longitudinal or x-direction length of the domain.

  • % len_lat [real] :: The latitudinal or y-direction length of the domain.

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

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

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

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

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

  • % isotropic [logical] :: 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] :: If true, the grid is defined to have the equator at the nearest q- or h- grid point to (-LOWLAT*NJGLOBAL/LENLAT).

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

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

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 :: [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

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 :: [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

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 :: [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

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 :: [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

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 :: [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

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 :: [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

function mom_grid_initialize/ds_di(x, y, GP) [real]

This function returns the grid spacing in the logical x direction.

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

  • y :: [in] The latitude in question

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

Call to

dx_di

Called from

set_grid_metrics_mercator

function mom_grid_initialize/ds_dj(x, y, GP) [real]

This function returns the grid spacing in the logical y direction.

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

  • y :: [in] The latitude in question

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

Call to

dy_dj

Called from

set_grid_metrics_mercator

function mom_grid_initialize/dl(x1, x2, y1, y2) [real]

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, assuming that the sides follow a linear path in latitude and longitude (i.e., on a Mercator grid).

Parameters
  • x1 :: [in] Segment starting longitude, in degrees E.

  • x2 :: [in] Segment ending longitude, in degrees E.

  • y1 :: [in] Segment ending latitude, in degrees N.

  • y2 :: [in] Segment ending latitude, in degrees N.

Called from

set_grid_metrics_mercator

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

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

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

  • dy_df :: The inverse of the derivative of that function

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

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

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

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

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

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

Called from

set_grid_metrics_mercator

function mom_grid_initialize/dx_di(x, GP) [real]

This function calculates and returns the value of dx/di, where x is the longitude in Radians, and i is the integral north-south grid index.

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

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

Called from

ds_di set_grid_metrics_mercator

function mom_grid_initialize/int_di_dx(x, GP) [real]

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

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

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

Called from

set_grid_metrics_mercator

function mom_grid_initialize/dy_dj(y, GP) [real]

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

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

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

Called from

ds_dj set_grid_metrics_mercator

function mom_grid_initialize/int_dj_dy(y, GP) [real]

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

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

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

Called from

set_grid_metrics_mercator

subroutine mom_grid_initialize/extrapolate_metric(var, jh, missing)

Extrapolates missing metric data into all the halo regions.

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

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

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

Called from

set_grid_metrics_from_mosaic

function mom_grid_initialize/adcroft_reciprocal(val) [real]

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 :: [in] The value being inverted.

Return

undefined :: The Adcroft reciprocal of val.

Called from

initialize_masks

subroutine mom_grid_initialize/initialize_masks(G, PF, US)

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

Call to

adcroft_reciprocal mom_error_handler::calltree_enter mom_error_handler::calltree_leave

Called from

mom_fixed_initialization::mom_initialize_fixed