FMS  2024.03
Flexible Modeling System
grid2_mod

Routines for grid calculations, using FMS2 IO. More...

Data Types

interface  get_grid_cell_area
 Finds area of a grid cell. More...
 
interface  get_grid_cell_centers
 Gets grid cell centers. More...
 
interface  get_grid_cell_vertices
 Gets arrays of global grid cell boundaries for given model component and mosaic tile number. More...
 
interface  get_grid_comp_area
 Gets the area of a given component per grid cell. More...
 
interface  get_grid_size
 Gets the size of the grid for one or all tiles. More...
 

Functions/Subroutines

subroutine assign_component_mosaics
 Assign the component mosaic files if grid_spec is Version 3.
 
subroutine close_component_mosaics
 Close the component mosaic files for atm, lnd, and ocn.
 
subroutine, public define_cube_mosaic (component, domain, layout, halo, maskmap)
 given a model component, a layout, and (optionally) a halo size, returns a domain for current processor More...
 
integer function get_component_number (component)
 Get the component number of a model component (atm, lnd, ocn) More...
 
logical function, public get_great_circle_algorithm ()
 Determine if we are using the great circle algorithm. More...
 
 get_grid_cell_area_sg_r4
 
 get_grid_cell_area_sg_r8
 
 get_grid_cell_area_ug_r4
 
 get_grid_cell_area_ug_r8
 
 get_grid_cell_centers_1d_r4
 
 get_grid_cell_centers_1d_r8
 
 get_grid_cell_centers_2d_r4
 
 get_grid_cell_centers_2d_r8
 
 get_grid_cell_centers_ug_r4
 
 get_grid_cell_centers_ug_r8
 
 get_grid_cell_vertices_1d_r4
 
 get_grid_cell_vertices_1d_r8
 
 get_grid_cell_vertices_2d_r4
 
 get_grid_cell_vertices_2d_r8
 
 get_grid_cell_vertices_ug_r4
 
 get_grid_cell_vertices_ug_r8
 
 get_grid_comp_area_sg_r4
 
 get_grid_comp_area_sg_r8
 
 get_grid_comp_area_ug_r4
 
 get_grid_comp_area_ug_r8
 
subroutine, public get_grid_ntiles (component, ntiles)
 returns number of tiles for a given component More...
 
subroutine get_grid_size_for_all_tiles (component, nx, ny)
 returns size of the grid for each of the tiles More...
 
subroutine get_grid_size_for_all_tiles (component, nx, ny)
 returns size of the grid for each of the tiles More...
 
subroutine get_grid_size_for_one_tile (component, tile, nx, ny)
 returns size of the grid for one of the tiles More...
 
subroutine get_grid_size_for_one_tile (component, tile, nx, ny)
 returns size of the grid for one of the tiles More...
 
integer function get_grid_version (fileobj)
 Get the grid version from a file object. More...
 
subroutine, public grid_end
 Shutdown the grid2 module.
 
subroutine, public grid_init
 Initialize the grid2 module.
 
subroutine open_component_mosaics
 Open the component mosaic files for atm, lnd, and ocn.
 
subroutine open_grid_file (myfileobj, myfilename)
 Open a grid file. More...
 
subroutine open_mosaic_file (mymosaicfileobj, component)
 Open a mosaic file. More...
 
character(len=fms_path_len) function read_file_name (thisfileobj, filevar, level)
 Read a tile file name from a netcdf file. More...
 

Variables

integer, parameter bufsize = 1048576
 This is used to control memory usage in get_grid_comp_area We may change this to a namelist variable is needed.
 
logical great_circle_algorithm = .FALSE.
 
character(len= *), parameter grid_dir = 'INPUT/'
 root directory for all grid files
 
character(len= *), parameter grid_file = 'INPUT/grid_spec.nc'
 name of the grid spec file
 
logical grid_spec_exists = .TRUE.
 
integer grid_version = -1
 Value to indicate what type of grid file is being read, based on which variables are present.
 
type(fmsnetcdffile_tgridfileobj
 
integer, parameter max_name = 256
 max length of the variable names
 
logical module_is_initialized = .FALSE.
 
character(len= *), parameter module_name = 'grid2_mod'
 
type(fmsnetcdffile_t), dimension(3) mosaic_fileobj
 
integer, parameter version_geolon_t = 0
 indicates gelon_t variable is present in grid_file
 
integer, parameter version_gridfiles = 3
 indicates gridfiles variable is present in grid_file
 
integer, parameter version_ocn_mosaic_file = 2
 indicates ocn_mosaic_file variable is present in grid_file
 
integer, parameter version_x_t = 1
 indicates x_t variable is present in grid_file
 

Detailed Description

Routines for grid calculations, using FMS2 IO.


Data Type Documentation

◆ grid2_mod::get_grid_cell_area

interface grid2_mod::get_grid_cell_area

Finds area of a grid cell.

Definition at line 94 of file grid2.F90.

Private Member Functions

 get_grid_cell_area_sg_r4
 
 get_grid_cell_area_sg_r8
 
 get_grid_cell_area_ug_r4
 
 get_grid_cell_area_ug_r8
 

◆ grid2_mod::get_grid_cell_centers

interface grid2_mod::get_grid_cell_centers

Gets grid cell centers.

Definition at line 83 of file grid2.F90.

Private Member Functions

 get_grid_cell_centers_1d_r4
 
 get_grid_cell_centers_1d_r8
 
 get_grid_cell_centers_2d_r4
 
 get_grid_cell_centers_2d_r8
 
 get_grid_cell_centers_ug_r4
 
 get_grid_cell_centers_ug_r8
 

◆ grid2_mod::get_grid_cell_vertices

interface grid2_mod::get_grid_cell_vertices

Gets arrays of global grid cell boundaries for given model component and mosaic tile number.

Definition at line 72 of file grid2.F90.

Private Member Functions

 get_grid_cell_vertices_1d_r4
 
 get_grid_cell_vertices_1d_r8
 
 get_grid_cell_vertices_2d_r4
 
 get_grid_cell_vertices_2d_r8
 
 get_grid_cell_vertices_ug_r4
 
 get_grid_cell_vertices_ug_r8
 

◆ grid2_mod::get_grid_comp_area

interface grid2_mod::get_grid_comp_area

Gets the area of a given component per grid cell.

Definition at line 103 of file grid2.F90.

Private Member Functions

 get_grid_comp_area_sg_r4
 
 get_grid_comp_area_sg_r8
 
 get_grid_comp_area_ug_r4
 
 get_grid_comp_area_ug_r8
 

◆ grid2_mod::get_grid_size

interface grid2_mod::get_grid_size

Gets the size of the grid for one or all tiles.

Definition at line 64 of file grid2.F90.

Private Member Functions

subroutine get_grid_size_for_all_tiles (component, nx, ny)
 returns size of the grid for each of the tiles More...
 
subroutine get_grid_size_for_one_tile (component, tile, nx, ny)
 returns size of the grid for one of the tiles More...
 

Function/Subroutine Documentation

◆ define_cube_mosaic()

subroutine, public grid2_mod::define_cube_mosaic ( character(len=*), intent(in)  component,
type(domain2d), intent(inout)  domain,
integer, dimension(2), intent(in)  layout,
integer, intent(in), optional  halo,
logical, dimension(:,:,:), intent(in), optional  maskmap 
)

given a model component, a layout, and (optionally) a halo size, returns a domain for current processor

Parameters
[in]componentComponent model (atm, lnd, ocn)

Definition at line 354 of file grid2.F90.

◆ get_component_number()

integer function grid2_mod::get_component_number ( character(len=*), intent(in)  component)
private

Get the component number of a model component (atm, lnd, ocn)

Returns
Integer component number
Parameters
[in]componentComponent model (atm, lnd, ocn)

Definition at line 281 of file grid2.F90.

◆ get_great_circle_algorithm()

logical function, public grid2_mod::get_great_circle_algorithm

Determine if we are using the great circle algorithm.

Returns
Logical flag describing if we are using the great circlealgorithm

Definition at line 170 of file grid2.F90.

◆ get_grid_ntiles()

subroutine, public grid2_mod::get_grid_ntiles ( character(len=*)  component,
integer, intent(out)  ntiles 
)

returns number of tiles for a given component

Parameters
componentComponent model (atm, lnd, ocn)
[out]ntilesNumber of tiles

Definition at line 295 of file grid2.F90.

◆ get_grid_size_for_all_tiles() [1/2]

subroutine grid2_mod::get_grid_size_for_all_tiles ( character(len=*)  component,
integer, dimension(:), intent(inout)  nx,
integer, dimension(:), intent(inout)  ny 
)
private

returns size of the grid for each of the tiles

Parameters
componentComponent model (atm, lnd, ocn)
[in,out]nyGrid size in x and y

Definition at line 308 of file grid2.F90.

◆ get_grid_size_for_all_tiles() [2/2]

subroutine get_grid_size_for_all_tiles ( character(len=*)  component,
integer, dimension(:), intent(inout)  nx,
integer, dimension(:), intent(inout)  ny 
)
private

returns size of the grid for each of the tiles

Parameters
componentComponent model (atm, lnd, ocn)
[in,out]nyGrid size in x and y

Definition at line 308 of file grid2.F90.

◆ get_grid_size_for_one_tile() [1/2]

subroutine get_grid_size_for_one_tile ( character(len=*)  component,
integer, intent(in)  tile,
integer, intent(inout)  nx,
integer, intent(inout)  ny 
)
private

returns size of the grid for one of the tiles

Parameters
componentComponent model (atm, lnd, ocn)
[in]tileTile number
[in,out]nyGrid size in x and y

Definition at line 331 of file grid2.F90.

◆ get_grid_size_for_one_tile() [2/2]

subroutine grid2_mod::get_grid_size_for_one_tile ( character(len=*)  component,
integer, intent(in)  tile,
integer, intent(inout)  nx,
integer, intent(inout)  ny 
)
private

returns size of the grid for one of the tiles

Parameters
componentComponent model (atm, lnd, ocn)
[in]tileTile number
[in,out]nyGrid size in x and y

Definition at line 331 of file grid2.F90.

◆ get_grid_version()

integer function grid2_mod::get_grid_version ( type(fmsnetcdffile_t), intent(in)  fileobj)
private

Get the grid version from a file object.

Returns
An integer representation of the grid version
Parameters
[in]fileobjFile object of grid file

Definition at line 229 of file grid2.F90.

◆ open_grid_file()

subroutine grid2_mod::open_grid_file ( type(fmsnetcdffile_t), intent(out)  myfileobj,
character(len=*), intent(in)  myfilename 
)
private

Open a grid file.

Parameters
[out]myfileobjFile object of grid file
[in]myfilenameName of the grid file

Definition at line 189 of file grid2.F90.

◆ open_mosaic_file()

subroutine grid2_mod::open_mosaic_file ( type(fmsnetcdffile_t), intent(out)  mymosaicfileobj,
character(len=3), intent(in)  component 
)
private

Open a mosaic file.

Parameters
[out]mymosaicfileobjFile object returned
[in]componentComponent (atm, lnd, etc.)

Definition at line 198 of file grid2.F90.

◆ read_file_name()

character(len=fms_path_len) function grid2_mod::read_file_name ( type(fmsnetcdffile_t), intent(in)  thisfileobj,
character(len=*), intent(in)  filevar,
integer, intent(in)  level 
)
private

Read a tile file name from a netcdf file.

Returns
Name of the file as a string
Parameters
[in]thisfileobjFile object of file
[in]filevarVariable containing file names
[in]levelLevel of tile file

Definition at line 212 of file grid2.F90.