MOM6
|
Initializes horizontal grid.
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.
Data Types | |
type | gps |
Global positioning system (aka container for information to describe the grid) More... | |
Functions/Subroutines | |
subroutine, public | 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. More... | |
subroutine | grid_metrics_chksum (parent, G, US) |
grid_metrics_chksum performs a set of checksums on metrics on the grid for debugging. More... | |
subroutine | set_grid_metrics_from_mosaic (G, param_file, US) |
Sets the grid metrics from a mosaic file. More... | |
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. More... | |
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. More... | |
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. More... | |
real function | ds_di (x, y, GP) |
This function returns the grid spacing in the logical x direction. More... | |
real function | ds_dj (x, y, GP) |
This function returns the grid spacing in the logical y direction. More... | |
real 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, assuming that the sides follow a linear path in latitude and longitude (i.e., on a Mercator grid). More... | |
real 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. More... | |
real function | dx_di (x, GP) |
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. More... | |
real 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. More... | |
real function | dy_dj (y, GP) |
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. More... | |
real 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. More... | |
subroutine | extrapolate_metric (var, jh, missing) |
Extrapolates missing metric data into all the halo regions. More... | |
real function, public | 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. More... | |
subroutine, public | initialize_masks (G, PF, US) |
Initializes the grid masks and any metrics that come with masks already applied. More... | |
real function, public mom_grid_initialize::adcroft_reciprocal | ( | real, intent(in) | val | ) |
This function implements Adcroft's rule for reciprocals, namely that Adcroft_Inv(x) = 1/x for |x|>0 or 0 for x=0.
[in] | val | The value being inverted. |
Definition at line 1219 of file MOM_grid_initialize.F90.
Referenced by initialize_masks().
|
private |
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).
[in] | x1 | Segment starting longitude, in degrees E. |
[in] | x2 | Segment ending longitude, in degrees E. |
[in] | y1 | Segment ending latitude, in degrees N. |
[in] | y2 | Segment ending latitude, in degrees N. |
Definition at line 956 of file MOM_grid_initialize.F90.
Referenced by set_grid_metrics_mercator().
|
private |
This function returns the grid spacing in the logical x direction.
[in] | x | The longitude in question |
[in] | y | The latitude in question |
[in] | gp | A structure of grid parameters |
Definition at line 926 of file MOM_grid_initialize.F90.
References dx_di().
Referenced by set_grid_metrics_mercator().
|
private |
This function returns the grid spacing in the logical y direction.
[in] | x | The longitude in question |
[in] | y | The latitude in question |
[in] | gp | A structure of grid parameters |
Definition at line 940 of file MOM_grid_initialize.F90.
References dy_dj().
Referenced by set_grid_metrics_mercator().
|
private |
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.
[in] | x | The longitude in question |
[in] | gp | A structure of grid parameters |
Definition at line 1091 of file MOM_grid_initialize.F90.
Referenced by ds_di(), and set_grid_metrics_mercator().
|
private |
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.
[in] | y | The latitude in question |
[in] | gp | A structure of grid parameters |
Definition at line 1113 of file MOM_grid_initialize.F90.
Referenced by ds_dj(), and set_grid_metrics_mercator().
|
private |
Extrapolates missing metric data into all the halo regions.
[in,out] | var | The array in which to fill in halos |
[in] | jh | The size of the halos to be filled |
[in] | missing | The missing data fill value, 0 by default. |
Definition at line 1185 of file MOM_grid_initialize.F90.
Referenced by set_grid_metrics_from_mosaic().
|
private |
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.
fn | The external function whose root is being sought | |
dy_df | The inverse of the derivative of that function | |
[in] | gp | A structure of grid parameters |
[in] | fnval | The value of fn being sought |
[in] | y1 | A first guess for y |
[in] | ymin | The minimum permitted value of y |
[in] | ymax | The maximum permitted value of y |
[out] | ittmax | The number of iterations used to polish the root |
Definition at line 979 of file MOM_grid_initialize.F90.
Referenced by set_grid_metrics_mercator().
|
private |
grid_metrics_chksum performs a set of checksums on metrics on the grid for debugging.
[in] | parent | A string identifying the caller |
[in] | g | The dynamic horizontal grid type |
[in] | us | A dimensional unit scaling type |
Definition at line 116 of file MOM_grid_initialize.F90.
Referenced by set_grid_metrics().
subroutine, public mom_grid_initialize::initialize_masks | ( | type(dyn_horgrid_type), intent(inout) | G, |
type(param_file_type), intent(in) | PF, | ||
type(unit_scale_type), intent(in), optional | 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 Dmin 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.
[in,out] | g | The dynamic horizontal grid type |
[in] | pf | Parameter file structure |
[in] | us | A dimensional unit scaling type |
Definition at line 1235 of file MOM_grid_initialize.F90.
References adcroft_reciprocal(), mom_error_handler::calltree_enter(), and mom_error_handler::calltree_leave().
Referenced by mom_fixed_initialization::mom_initialize_fixed().
|
private |
This function calculates and returns the integral of the inverse of dx/di to the point x, in radians.
[in] | x | The longitude in question |
[in] | gp | A structure of grid parameters |
Definition at line 1102 of file MOM_grid_initialize.F90.
Referenced by set_grid_metrics_mercator().
|
private |
This subroutine calculates and returns the integral of the inverse of dy/dj to the point y, in radians.
[in] | y | The latitude in question |
[in] | gp | A structure of grid parameters |
Definition at line 1142 of file MOM_grid_initialize.F90.
Referenced by set_grid_metrics_mercator().
subroutine, public mom_grid_initialize::set_grid_metrics | ( | type(dyn_horgrid_type), intent(inout) | G, |
type(param_file_type), intent(in) | param_file, | ||
type(unit_scale_type), intent(in), optional | 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.
[in,out] | g | The dynamic horizontal grid type |
[in] | param_file | Parameter file structure |
[in] | us | A dimensional unit scaling type |
Definition at line 63 of file MOM_grid_initialize.F90.
References 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(), and set_grid_metrics_spherical().
Referenced by mom_oda_driver_mod::init_oda(), mom_ice_shelf::initialize_ice_shelf(), and mom_fixed_initialization::mom_initialize_fixed().
|
private |
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.
[in,out] | g | The dynamic horizontal grid type |
[in] | param_file | Parameter file structure |
[in] | us | A dimensional unit scaling type |
Definition at line 418 of file MOM_grid_initialize.F90.
References mom_error_handler::calltree_enter(), and mom_error_handler::calltree_leave().
Referenced by set_grid_metrics().
|
private |
Sets the grid metrics from a mosaic file.
[in,out] | g | The dynamic horizontal grid type |
[in] | param_file | Parameter file structure |
[in] | us | A dimensional unit scaling type |
Definition at line 166 of file MOM_grid_initialize.F90.
References mom_error_handler::calltree_enter(), mom_error_handler::calltree_leave(), and extrapolate_metric().
Referenced by set_grid_metrics().
|
private |
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.
[in,out] | g | The dynamic horizontal grid type |
[in] | param_file | Parameter file structure |
[in] | us | A dimensional unit scaling type |
Definition at line 695 of file MOM_grid_initialize.F90.
References mom_error_handler::calltree_enter(), mom_error_handler::calltree_leave(), dl(), ds_di(), ds_dj(), dx_di(), dy_dj(), find_root(), int_di_dx(), and int_dj_dy().
Referenced by set_grid_metrics().
|
private |
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.
[in,out] | g | The dynamic horizontal grid type |
[in] | param_file | Parameter file structure |
[in] | us | A dimensional unit scaling type |
Definition at line 556 of file MOM_grid_initialize.F90.
References mom_error_handler::calltree_enter(), and mom_error_handler::calltree_leave().
Referenced by set_grid_metrics().