mom_grid_initialize module reference
Initializes horizontal grid.
Data Types
Global positioning system (aka container for information to describe the grid) |
Functions/Subroutines
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 performs a set of checksums on metrics on the grid for debugging. |
|
Sets the grid metrics from a mosaic file. |
|
Calculate the values of the metric terms for a Cartesian grid that might be used and save them in arrays. |
|
Calculate the values of the metric terms that might be used and save them in arrays. |
|
Calculate the values of the metric terms that might be used and save them in arrays. |
|
This function returns the grid spacing in the logical x direction in [L ~> m]. |
|
This function returns the grid spacing in the logical y direction in [L ~> m]. |
|
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). |
|
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. |
|
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. |
|
This function calculates and returns the integral of the inverse of dx/di to the point x, in radians [gridpoints]. |
|
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. |
|
This subroutine calculates and returns the integral of the inverse of dy/dj to the point y in radians [gridpoints]. |
|
Extrapolates missing metric data into all the halo regions. |
|
This function implements Adcroft's rule for reciprocals, namely that Adcroft_Inv(x) = 1/x for |x|>0 or 0 for x=0. |
|
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, privateThe longitudinal or x-direction length of the domain [degrees_E] or [km] or [m].% len_lat ::
real, privateThe latitudinal or y-direction length of the domain [degrees_N] or [km] or [m].% west_lon ::
real, privateThe western longitude of the domain or the equivalent starting value for the x-axis [degrees_E] or [km] or [m].% south_lat ::
real, privateThe southern latitude of the domain or the equivalent starting value for the y-axis [degrees_N] or [km] or [m].% rad_earth_l ::
real, privateThe radius of the Earth in rescaled units [L ~> m].% lat_enhance_factor ::
real, privateThe amount by which the meridional resolution is enhanced within LAT_EQ_ENHANCE of the equator [nondim].% lat_eq_enhance ::
real, privateThe latitude range to the north and south of the equator over which the resolution is enhanced [degrees_N].% isotropic ::
logical, privateIf 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, privateIf true, the grid is defined to have the equator at the nearest q- or h- grid point to (-LOWLAT*NJGLOBAL/LENLAT).% niglobal ::
integer, privateThe number of i-points in the global grid computational domain.% njglobal ::
integer, privateThe 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 ::
param_file[in] Parameter file structureus :: [in] A dimensional unit scaling type
- Call to:
mom_error_handler::calltree_entermom_error_handler::calltree_leavegrid_metrics_chksummom_dyn_horgrid::set_derived_dyn_horgridset_grid_metrics_cartesianset_grid_metrics_from_mosaicset_grid_metrics_mercatorset_grid_metrics_spherical- Called from:
mom_oda_driver_mod::init_odamom_ice_shelf::initialize_ice_shelfmom_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 ::
parent[in] A string identifying the callerg :: [in] The dynamic horizontal grid type
us :: [in] A dimensional unit scaling type
- Called from:
- 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 structureus :: [in] A dimensional unit scaling type
- Call to:
mom_error_handler::calltree_entermom_error_handler::calltree_leaveextrapolate_metric- Called from:
- 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 structureus :: [in] A dimensional unit scaling type
- Call to:
mom_error_handler::calltree_entermom_error_handler::calltree_leave- Called from:
- 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 structureus :: [in] A dimensional unit scaling type
- Call to:
mom_error_handler::calltree_entermom_error_handler::calltree_leave- Called from:
- 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 structureus :: [in] A dimensional unit scaling type
- Call to:
mom_error_handler::calltree_entermom_error_handler::calltree_leavedlds_dids_djdx_didy_djfind_rootint_di_dxint_dj_dy- Called from:
- 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:
- Called from:
- 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:
- Called from:
- 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:
- 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 ::
fnThe external function whose root is being sought [gridpoints]dy_df ::
dy_dfThe 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:
- 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:
- 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:
- 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:
- 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:
- 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 filledmissing ::
missing[in] The missing data fill value, 0 by default [A]
- Called from:
- 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:
- 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_reciprocalmom_error_handler::calltree_entermom_error_handler::calltree_leave- Called from:
mom_ice_shelf::initialize_ice_shelfmom_fixed_initialization::mom_initialize_fixed