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, private :: GPS
Global positioning system (aka container for information to describe the grid)
- Parameters
len_lon
The longitudinal or x-direction length of the domain [degrees_E] or [km] or [m].
len_lat
The latitudinal or y-direction length of the domain [degrees_N] or [km] or [m].
west_lon
The western longitude of the domain or the equivalent starting value for the x-axis [degrees_E] or [km] or [m].
south_lat
The southern latitude of the domain or the equivalent starting value for the y-axis [degrees_N] or [km] or [m].
Rad_Earth_L
The radius of the Earth in rescaled units [L ~> m]
Lat_enhance_factor
The amount by which the meridional resolution is enhanced within LAT_EQ_ENHANCE of the equator [nondim]
Lat_eq_enhance
The latitude range to the north and south of the equator over which the resolution is enhanced [degrees_N]
isotropic
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 _not_ independent. In MOM the meridional extent is determined to fit the zonal extent and the number of grid points, while grid is perfectly isotropic.
equator_reference
If true, the grid is defined to have the equator at the nearest q- or h- grid point to (-LOWLAT*NJGLOBAL/LENLAT).
niglobal
The number of i-points in the global grid computational domain
njglobal
The number of j-points in the global grid computational domain
Functions/Subroutine Documentation
- subroutine 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
Callees call graph
Text view
mom_grid_initialize::set_grid_metrics → mom_dyn_horgrid::set_derived_dyn_horgrid
mom_grid_initialize::set_grid_metrics → mom_error_handler::calltree_enter
mom_grid_initialize::set_grid_metrics → mom_error_handler::calltree_leave
mom_grid_initialize::set_grid_metrics → mom_error_handler::mom_error
mom_grid_initialize::set_grid_metrics → mom_file_parser::interface::get_param
mom_grid_initialize::set_grid_metrics → mom_file_parser::interface::log_version
mom_grid_initialize::set_grid_metrics → mom_grid_initialize::grid_metrics_chksum
mom_grid_initialize::set_grid_metrics → mom_grid_initialize::set_grid_metrics_cartesian
mom_grid_initialize::set_grid_metrics → mom_grid_initialize::set_grid_metrics_from_mosaic
mom_grid_initialize::set_grid_metrics → mom_grid_initialize::set_grid_metrics_mercator
mom_grid_initialize::set_grid_metrics → mom_grid_initialize::set_grid_metrics_spherical
- subroutine 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
Callees call graph
Text view
mom_grid_initialize::grid_metrics_chksum → mom_checksums::interface::bchksum
mom_grid_initialize::grid_metrics_chksum → mom_checksums::interface::bchksum_pair
mom_grid_initialize::grid_metrics_chksum → mom_checksums::interface::hchksum
mom_grid_initialize::grid_metrics_chksum → mom_checksums::interface::hchksum_pair
mom_grid_initialize::grid_metrics_chksum → mom_checksums::interface::uvchksum
Callers call graph
- subroutine 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
Callees call graph
Text view
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_coms_infra::interface::broadcast
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_coms_infra::root_pe
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_domain_infra::deallocate_mom_domain
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_domain_infra::interface::clone_mom_domain
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_domain_infra::interface::pass_var
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_domain_infra::interface::pass_vector
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_error_handler::calltree_enter
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_error_handler::calltree_leave
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_error_handler::mom_error
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_error_infra::is_root_pe
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_file_parser::interface::get_param
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_file_parser::interface::log_param
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_grid_initialize::extrapolate_metric
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_io::interface::mom_read_data
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_io_infra::interface::file_exists
mom_grid_initialize::set_grid_metrics_from_mosaic → mom_string_functions::slasher
Callers call graph
- subroutine 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
Callees call graph
Text view
mom_grid_initialize::set_grid_metrics_cartesian → mom_error_handler::calltree_enter
mom_grid_initialize::set_grid_metrics_cartesian → mom_error_handler::calltree_leave
mom_grid_initialize::set_grid_metrics_cartesian → mom_file_parser::interface::get_param
mom_grid_initialize::set_grid_metrics_cartesian → mom_file_parser::interface::log_param
Callers call graph
- subroutine 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
Callees call graph
Callers call graph
- subroutine 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
Callees call graph
Text view
mom_grid_initialize::set_grid_metrics_mercator → mom_domain_infra::interface::pass_var
mom_grid_initialize::set_grid_metrics_mercator → mom_error_handler::calltree_enter
mom_grid_initialize::set_grid_metrics_mercator → mom_error_handler::calltree_leave
mom_grid_initialize::set_grid_metrics_mercator → mom_file_parser::interface::get_param
mom_grid_initialize::set_grid_metrics_mercator → mom_grid_initialize::dl
mom_grid_initialize::set_grid_metrics_mercator → mom_grid_initialize::ds_di
mom_grid_initialize::set_grid_metrics_mercator → mom_grid_initialize::ds_dj
mom_grid_initialize::set_grid_metrics_mercator → mom_grid_initialize::find_root
mom_grid_initialize::set_grid_metrics_mercator → mom_grid_initialize::int_di_dx
mom_grid_initialize::set_grid_metrics_mercator → mom_grid_initialize::int_dj_dy
Callers call graph
- function ds_di(x, y, GP)
This function returns the grid spacing in the logical x direction in [L ~> m].
- Parameters
x [in]
The longitude in question [radians]
y [in]
The latitude in question [radians]
GP [in]
A structure of grid parameters
Callers call graph
- function ds_dj(x, y, GP)
This function returns the grid spacing in the logical y direction in [L ~> m].
- Parameters
x [in]
The longitude in question [radians]
y [in]
The latitude in question [radians]
GP [in]
A structure of grid parameters
Callers call graph
- function 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 [in]
Segment starting longitude [radians]
x2 [in]
Segment ending longitude [radians]
y1 [in]
Segment starting latitude [radians]
y2 [in]
Segment ending latitude [radians]
Callers call graph
- function 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.
- Parameters
find_root
The value of y where fn(y) = fnval that will be returned [radians]
fn
The external function whose root is being sought [gridpoints]
dy_df
The inverse of the derivative of that function [radian gridpoint-1]
GP [in]
A structure of grid parameters
fnval [in]
The value of fn being sought [gridpoints]
y1 [in]
A first guess for y [radians]
ymin [in]
The minimum permitted value of y [radians]
ymax [in]
The maximum permitted value of y [radians]
ittmax [out]
The number of iterations used to polish the root
Callees call graph
Callers call graph
- function 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 [in]
The longitude in question [radians]
GP [in]
A structure of grid parameters
- function 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 [in]
The longitude in question [radians]
GP [in]
A structure of grid parameters
Callers call graph
- function 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 [in]
The latitude in question [radians]
GP [in]
A structure of grid parameters
- function 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 [in]
The latitude in question [radians]
GP [in]
A structure of grid parameters
Callers call graph
- subroutine 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 in arbitrary units [A]
jh [in]
The size of the halos to be filled
missing [in]
The missing data fill value, 0 by default [A]
Callers call graph
- function Adcroft_reciprocal(val) result(I_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 [in]
The value being inverted in arbitrary units [A]
I_val
The Adcroft reciprocal of val [A-1]
Callers call graph
- subroutine 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 is an open boundary condition at zonal velocity faces and their orientation, with 0 for no OBC, a positive value for an Eastern OBC and a negative value for a Western OBC.
OBC_dir_v [in]
Trinary values that indicate whether there is an open boundary condition at zonal velocity faces and their orientation, with 0 for no OBC, a positive value for a Northern OBC and a negative value for a Southern OBC.
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 the mask at tracer points instead of using the bathymetry to determine the masks [nondim]
Callees call graph
Text view
mom_grid_initialize::initialize_masks → mom_domain_infra::interface::pass_var
mom_grid_initialize::initialize_masks → mom_domain_infra::interface::pass_vector
mom_grid_initialize::initialize_masks → mom_error_handler::calltree_enter
mom_grid_initialize::initialize_masks → mom_error_handler::calltree_leave
mom_grid_initialize::initialize_masks → mom_file_parser::interface::get_param
mom_grid_initialize::initialize_masks → mom_grid_initialize::adcroft_reciprocal