FMS 2025.01-dev
Flexible Modeling System
Loading...
Searching...
No Matches
xgrid_mod

Implements exchange grids for coupled models running on multiple processors. More...

Data Types

type  comm_type
 Private type used for exchange grid communication. More...
 
interface  conservation_check
 Returns three numbers which are the global sum of a variable. More...
 
interface  conservation_check_ug
 For an unstructured grid, returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s). More...
 
interface  get_area_elements
 
interface  get_from_xgrid
 Sums data from exchange grid to model grid. More...
 
interface  get_from_xgrid_ug
 get_from_xgrid for unstructured grids. More...
 
interface  get_nest_contact
 
type  grid_box_type
 Type to hold pointers for grid boxes. More...
 
type  grid_type
 Private type to hold all data needed from given grid for an exchange grid. More...
 
type  overlap_type
 Private type for overlap exchange grid data. More...
 
interface  put_to_xgrid
 Scatters data from model grid onto exchange grid. More...
 
interface  put_to_xgrid_ug
 put_to_xgrid for unstructured grids. More...
 
interface  set_frac_area
 Sets sub-grid area and numbering in the given exchange grid. More...
 
interface  stock_move
 
interface  stock_move_ug
 
type  x1_type
 Private type for exchange grid data. More...
 
type  x2_type
 Private type for exchange grid data. More...
 
type  xcell_type
 Private type for cell indices and data in the exchange grid. More...
 
type  xmap_type
 Type for an exchange grid, holds pointers to included grids and any necessary data. More...
 

Functions/Subroutines

real(r8_kind) function, dimension(3) conservation_check_side1 (d, grid_id, xmap, remap_method)
 conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 
real(r8_kind) function, dimension(3) conservation_check_side2 (d, grid_id, xmap, remap_method)
 conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 
real(r8_kind) function, dimension(3) conservation_check_ug_side1 (d, grid_id, xmap, remap_method)
 conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 
real(r8_kind) function, dimension(3) conservation_check_ug_side2 (d, grid_id, xmap, remap_method)
 conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 
subroutine get_1_from_xgrid (d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize)
 
subroutine get_1_from_xgrid_repro (d_addrs, x_addrs, xmap, xsize, lsize)
 
subroutine get_1_from_xgrid_ug (d_addrs, x_addrs, xmap, isize, xsize, lsize)
 
subroutine get_1_from_xgrid_ug_repro (d_addrs, x_addrs, xmap, xsize, lsize)
 
subroutine get_2_from_xgrid (d, grid, x, xmap)
 
subroutine get_2_from_xgrid_ug (d, grid, x, xmap)
 
subroutine get_area_elements_fms2_io (fileobj, name, get_area_data)
 Read the area elements from NetCDF file.
 
subroutine get_grid_version1 (grid, grid_id, grid_file)
 read the center point of the grid from version 1 grid file. only the grid at the side 1 is needed, so we only read atm and land grid.
 
subroutine get_grid_version2 (grid, grid_id, grid_file)
 read the center point of the grid from version 1 grid file. only the grid at the side 1 is needed, so we only read atm and land grid
 
subroutine, public get_index_range (xmap, grid_index, is, ie, js, je, km)
 
integer function get_nest_contact_fms2_io (fileobj, tile_nest_out, tile_parent_out, is_nest_out, ie_nest_out, js_nest_out, je_nest_out, is_parent_out, ie_parent_out, js_parent_out, je_parent_out)
 currently we are assuming there is only one nest region
 
subroutine, public get_ocean_model_area_elements (domain, grid_file)
 Read Ocean area element data from netCDF file.
 
subroutine get_side1_from_xgrid (d, grid_id, x, xmap, complete)
 
subroutine get_side1_from_xgrid_ug (d, grid_id, x, xmap, complete)
 
subroutine get_side2_from_xgrid (d, grid_id, x, xmap)
 
subroutine get_side2_from_xgrid_ug (d, grid_id, x, xmap)
 
subroutine, public get_xmap_grid_area (id, xmap, area)
 This routine is used to get the grid area of component model with id.
 
real(r8_kind) function, dimension(is:ie, js:je) grad_merid_latlon (d, lat, is, ie, js, je, isd, jsd)
 This function is used to calculate the gradient along meridinal direction. Maybe need to setup a limit for the gradient. regular lat-lon grid are assumed.
 
real(r8_kind) function, dimension(is:ie, js:je) grad_zonal_latlon (d, lon, lat, is, ie, js, je, isd, jsd)
 This function is used to calculate the gradient along zonal direction. Maybe need to setup a limit for the gradient. The grid is assumeed to be regular lat-lon grid.
 
logical function in_box (i, j, is, ie, js, je)
 
logical function in_box_me (i, j, grid)
 
logical function in_box_nbr (i, j, grid, p)
 
logical function is_lat_lon (lon, lat)
 
subroutine load_xgrid (xmap, grid, grid_file, grid1_id, grid_id, tile1, tile2, use_higher_order)
 
subroutine put_1_to_xgrid_order_1 (d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize)
 
subroutine put_1_to_xgrid_order_2 (d_addrs, x_addrs, xmap, isize, jsize, xsize, lsize)
 
subroutine put_1_to_xgrid_ug_order_1 (d_addrs, x_addrs, xmap, dsize, xsize, lsize)
 
subroutine put_2_to_xgrid (d, grid, x, xmap)
 
subroutine put_2_to_xgrid_ug (d, grid, x, xmap)
 
subroutine put_side1_to_xgrid (d, grid_id, x, xmap, remap_method, complete)
 Scatters data to exchange grid.
 
subroutine put_side1_to_xgrid_ug (d, grid_id, x, xmap, complete)
 Currently only support first order.
 
subroutine put_side2_to_xgrid (d, grid_id, x, xmap)
 Scatters data to exchange grid.
 
subroutine put_side2_to_xgrid_ug (d, grid_id, x, xmap)
 
subroutine regen (xmap)
 Regenerate/Update the xmap.
 
subroutine set_comm_get1 (xmap)
 
subroutine set_comm_get1_repro (xmap)
 
subroutine set_comm_put1 (xmap)
 
subroutine set_frac_area_sg (f, grid_id, xmap)
 Changes sub-grid portion areas and/or number.
 
subroutine, public set_frac_area_ug (f, grid_id, xmap)
 Changes sub-grid portion areas and/or number.
 
subroutine, public setup_xmap (xmap, grid_ids, grid_domains, grid_file, atm_grid, lnd_ug_domain)
 Sets up exchange grid connectivity using grid specification file and processor domain decomposition.
 
subroutine, public some (xmap, some_arr, grid_id)
 Returns logical associating exchange grid cells with given side two grid.
 
subroutine, public stock_integrate_2d (integrate_data2d, xmap, delta_t, radius, res, ier)
 surface/time integral of a 2d array
 
subroutine stock_move_2d (from, to, grid_index, stock_data2d, xmap, delta_t, from_side, to_side, radius, verbose, ier)
 this version takes rank 2 data, it can be used to compute the flux on the atmos side note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.
 
subroutine stock_move_3d (from, to, grid_index, stock_data3d, xmap, delta_t, from_side, to_side, radius, verbose, ier)
 this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.
 
subroutine stock_move_ug_3d (from, to, grid_index, stock_ug_data3d, xmap, delta_t, from_side, to_side, radius, verbose, ier)
 this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.
 
subroutine, public stock_print (stck, time, comp_name, index, ref_value, radius, pelist)
 
integer function, public xgrid_count (xmap)
 Returns current size of exchange grid variables.
 
subroutine, public xgrid_init (remap_method)
 Initialize the xgrid_mod.
 

Variables

real(r8_kind), dimension(:,:), allocatable, public area_atm_model
 Area elements used inside each model.
 
real(r8_kind), dimension(:,:), allocatable, public area_atm_sphere
 Area elements based on a the spherical model used by the ICE layer.
 
real(r8_kind), dimension(:,:), allocatable area_lnd_model
 
real(r8_kind), dimension(:,:), allocatable area_lnd_sphere
 
real(r8_kind), dimension(:,:), allocatable, public area_ocn_model
 
real(r8_kind), dimension(:,:), allocatable, public area_ocn_sphere
 
logical debug_stocks = .false.
 
logical do_alltoall = .true.
 
logical do_alltoallv = .false.
 
character(len=64) interp_method = 'first_order'
 Exchange grid interpolation method. It has two options: "first_order", "second_order".
 
logical make_exchange_reproduce = .false.
 Set to .true. to make xgrid_mod reproduce answers on different numbers of PEs. This option has a considerable performance impact. exactly same on different # PEs.
 
integer, parameter max_fields = 80
 
logical monotonic_exchange = .false.
 
integer nsubset = 0
 Number of processors to read exchange grid information. Those processors that read the exchange grid information will send data to other processors to prepare for flux exchange. Default value is 0. When nsubset is 0, each processor will read part of the exchange grid information. The purpose of this namelist is to improve performance of setup_xmap when running on higher processor count and solve receiving size mismatch issue on high processor count. Try to set nsubset = mpp_npes/MPI_rank_per_node.
 
integer remapping_method
 xgrid nml
 
integer, parameter, public second_order = 2
 
logical use_mpp_io = .false.
 use_mpp_io Default = .false. When true, uses mpp_io for IO. When false, uses fms2_io for IO.
 
integer, parameter version1 = 1
 grid spec file
 
integer, parameter version2 = 2
 mosaic grid file
 
logical xgrid_clocks_on = .false.
 

Detailed Description

Implements exchange grids for coupled models running on multiple processors.

Author
Michael Winton, Zhi Liang

An exchange grid is formed from the union of the bounding lines of the two (logically rectangular) participating grids. The exchange grid is therefore the coarsest grid that is a refinement of both participating grids. Exchange grids are used for two purposes by coupled models:

  1. conservative interpolation of fields between models uses the exchange grid cell areas as weights and
  2. the surface flux calculation takes place on the exchange grid thereby using the finest scale data available. xgrid_mod uses a NetCDF grid specification file containing the grid cell overlaps in combination with the ftp://ftp.gfdl.gov/pub/vb/mpp/mpp_domains.F90 domain decomposition information to determine the grid and processor connectivities.

xgrid_mod - implements exchange grids. An exchange grid is the grid whose boundary set is the union of the boundaries of the participating grids. The exchange grid is the coarsest grid that is a refinement of each of the participating grids. Every exchange grid cell is a subarea of one and only one cell in each of the participating grids. The exchange grid has two purposes:

(1) The exchange cell areas are used as weights for conservative interpolation between model grids.

(2) Computation of surface fluxes takes place on it, thereby using the finest scale data obtainable.

The exchange cells are the 2D intersections between cells of the participating grids. They are computed elsewhere and are read here from a NetCDF grid file as a sequence of quintuples (i and j on each of two grids and the cell area).

Each processing element (PE) computes a subdomain of each of the participating grids as well as a subset of the exchange cells. The geographic regions corresponding to these subdomains will, in general, not be the same so communication must occur between the PEs. The scheme for doing this is as follows. A distinction is drawn between the participating grids. There is a single "side 1" grid and it does not have partitions (sub-grid surface types). There are one or more "side 2" grids and they may have more than 1 partition. In standard usage, the atmosphere grid is on side 1 and the land and sea ice grids are on side 2. The set of exchange cells computed on a PE corresponds to its side 2 geographic region(s). Communication between the PEs takes place on the side 1 grid. Note: this scheme does not generally allow reproduction of answers across varying PE counts. This is because, in the side 1 "get", exchange cells are first summed locally onto a side 1 grid, then these side 1 contributions are further summed after they have been communicated to their target PE. For the make_exchange_reproduce option, a special side 1 get is used. This get communicates individual exchange cells. The cells are summed in the order they appear in the grid spec. file.

xgrid_mod reads a NetCDF grid specification file to determine the grid and processor connectivities. The exchange grids are defined by a sequence of quintuples: the i/j indices of the intersecting cells of the two participating grids and their areal overlap. The names of the five fields are generated automatically from the three character ids of the participating grids. For example, if the side one grid id is "ATM" and the side two grid id is "OCN", xgrid_mod expects to find the following five fields in the grid specification file: I_ATM_ATMxOCN, J_ATM_ATMxOCN, I_OCN_ATMxOCN, J_OCN_ATMxOCN, and AREA_ATMxOCN. These fields may be generated by the make_xgrids utility.


Data Type Documentation

◆ xgrid_mod::comm_type

type xgrid_mod::comm_type

Private type used for exchange grid communication.

Definition at line 403 of file xgrid.F90.

Collaboration diagram for comm_type:
[legend]

Public Attributes

integer nrecv
 
integer nsend
 
type(overlap_type), dimension(:), pointer recv =>NULL()
 
integer recvsize
 
type(overlap_type), dimension(:), pointer send =>NULL()
 
integer sendsize
 
integer, dimension(:), pointer unpack_ind =>NULL()
 

Member Data Documentation

◆ nrecv

integer nrecv

Definition at line 404 of file xgrid.F90.

◆ nsend

integer nsend

Definition at line 404 of file xgrid.F90.

◆ recv

type(overlap_type), dimension(:), pointer recv =>NULL()

Definition at line 408 of file xgrid.F90.

◆ recvsize

integer recvsize

Definition at line 405 of file xgrid.F90.

◆ send

type(overlap_type), dimension(:), pointer send =>NULL()

Definition at line 407 of file xgrid.F90.

◆ sendsize

integer sendsize

Definition at line 405 of file xgrid.F90.

◆ unpack_ind

integer, dimension(:), pointer unpack_ind =>NULL()

Definition at line 406 of file xgrid.F90.

◆ xgrid_mod::conservation_check

interface xgrid_mod::conservation_check

Returns three numbers which are the global sum of a variable.

Returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s). Conservation_check must be called by all PEs to work properly.

Parameters
dreal(r8_kind) data
grid_id3 character grid ID
[in,out]xmapexchange grid
[out]globalsum of a variable on home model grid, after side grid interpolation and after reinterpolation


Example usage:

call conservation_check(d, grid_id, xmap,remap_order)

Definition at line 252 of file xgrid.F90.

Public Member Functions

real(r8_kind) function, dimension(3) conservation_check_side1 (d, grid_id, xmap, remap_method)
 conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 
real(r8_kind) function, dimension(3) conservation_check_side2 (d, grid_id, xmap, remap_method)
 conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 

Member Function/Subroutine Documentation

◆ conservation_check_side1()

real(r8_kind) function, dimension(3) conservation_check_side1 ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)

conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_side1
Parameters
[in]dmodel data to check
[in]grid_id3 character grid id
[in,out]xmapexchange grid

Definition at line 4110 of file xgrid.F90.

◆ conservation_check_side2()

real(r8_kind) function, dimension(3) conservation_check_side2 ( real(r8_kind), dimension(:,:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)

conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_side2
Parameters
[in]dmodel data to check
[in]grid_id3 character grid ID
[in,out]xmapexchange grid

Definition at line 4157 of file xgrid.F90.

◆ xgrid_mod::conservation_check_ug

interface xgrid_mod::conservation_check_ug

For an unstructured grid, returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Definition at line 261 of file xgrid.F90.

Public Member Functions

real(r8_kind) function, dimension(3) conservation_check_ug_side1 (d, grid_id, xmap, remap_method)
 conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 
real(r8_kind) function, dimension(3) conservation_check_ug_side2 (d, grid_id, xmap, remap_method)
 conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).
 

Member Function/Subroutine Documentation

◆ conservation_check_ug_side1()

real(r8_kind) function, dimension(3) conservation_check_ug_side1 ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)

conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_ug_side1
Parameters
[in]dmodel data to check
[in]grid_id3 character grid ID
[in,out]xmapexchange grid

Definition at line 4213 of file xgrid.F90.

◆ conservation_check_ug_side2()

real(r8_kind) function, dimension(3) conservation_check_ug_side2 ( real(r8_kind), dimension(:,:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)

conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_ug_side2
Parameters
[in]dmodel data to check
[in]grid_id3 character grid ID
[in,out]xmapexchange grid

Definition at line 4286 of file xgrid.F90.

◆ xgrid_mod::get_area_elements

interface xgrid_mod::get_area_elements

Definition at line 496 of file xgrid.F90.

Public Member Functions

subroutine get_area_elements_fms2_io (fileobj, name, get_area_data)
 Read the area elements from NetCDF file.
 

Member Function/Subroutine Documentation

◆ get_area_elements_fms2_io()

subroutine get_area_elements_fms2_io ( type(fmsnetcdfdomainfile_t), intent(in)  fileobj,
character(len=*), intent(in)  name,
real(r8_kind), dimension(:,:), intent(out)  get_area_data 
)

Read the area elements from NetCDF file.

Definition at line 1460 of file xgrid.F90.

◆ xgrid_mod::get_from_xgrid

interface xgrid_mod::get_from_xgrid

Sums data from exchange grid to model grid.


Example usage:

call get_from_xgrid(d, grid_id, x, xmap)

Definition at line 205 of file xgrid.F90.

Public Member Functions

subroutine get_side1_from_xgrid (d, grid_id, x, xmap, complete)
 
subroutine get_side2_from_xgrid (d, grid_id, x, xmap)
 

Member Function/Subroutine Documentation

◆ get_side1_from_xgrid()

subroutine get_side1_from_xgrid ( real(r8_kind), dimension(:,:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(inout)  xmap,
logical, intent(in), optional  complete 
)
Parameters
[out]drecieved xgrid data
[in]grid_id3 character grid ID
[in]xxgrid data
[in,out]xmapexchange grid

Definition at line 3364 of file xgrid.F90.

◆ get_side2_from_xgrid()

subroutine get_side2_from_xgrid ( real(r8_kind), dimension(:,:,:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(in)  xmap 
)
Parameters
[out]dreceived xgrid data
[in]grid_id3 character grid ID
[in]xxgrid data
[in]xmapexchange grid

Definition at line 3441 of file xgrid.F90.

◆ xgrid_mod::get_from_xgrid_ug

interface xgrid_mod::get_from_xgrid_ug

get_from_xgrid for unstructured grids.

Sums data from exchange grid to model grid.

Definition at line 223 of file xgrid.F90.

Public Member Functions

subroutine get_side1_from_xgrid_ug (d, grid_id, x, xmap, complete)
 
subroutine get_side2_from_xgrid_ug (d, grid_id, x, xmap)
 

Member Function/Subroutine Documentation

◆ get_side1_from_xgrid_ug()

subroutine get_side1_from_xgrid_ug ( real(r8_kind), dimension(:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(inout)  xmap,
logical, intent(in), optional  complete 
)

Definition at line 4848 of file xgrid.F90.

◆ get_side2_from_xgrid_ug()

subroutine get_side2_from_xgrid_ug ( real(r8_kind), dimension(:,:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(in)  xmap 
)

Definition at line 5037 of file xgrid.F90.

◆ xgrid_mod::get_nest_contact

interface xgrid_mod::get_nest_contact

Definition at line 500 of file xgrid.F90.

Public Member Functions

integer function get_nest_contact_fms2_io (fileobj, tile_nest_out, tile_parent_out, is_nest_out, ie_nest_out, js_nest_out, je_nest_out, is_parent_out, ie_parent_out, js_parent_out, je_parent_out)
 currently we are assuming there is only one nest region
 

Member Function/Subroutine Documentation

◆ get_nest_contact_fms2_io()

integer function get_nest_contact_fms2_io ( type(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(out)  tile_nest_out,
integer, intent(out)  tile_parent_out,
integer, intent(out)  is_nest_out,
integer, intent(out)  ie_nest_out,
integer, intent(out)  js_nest_out,
integer, intent(out)  je_nest_out,
integer, intent(out)  is_parent_out,
integer, intent(out)  ie_parent_out,
integer, intent(out)  js_parent_out,
integer, intent(out)  je_parent_out 
)

currently we are assuming there is only one nest region

Returns
integer get_nest_contact

Definition at line 2117 of file xgrid.F90.

◆ xgrid_mod::grid_box_type

type xgrid_mod::grid_box_type

Type to hold pointers for grid boxes.

Definition at line 288 of file xgrid.F90.

Collaboration diagram for grid_box_type:
[legend]

Public Attributes

real(r8_kind), dimension(:,:), pointer area => NULL()
 
real(r8_kind), dimension(:,:), pointer dx => NULL()
 
real(r8_kind), dimension(:,:), pointer dy => NULL()
 
real(r8_kind), dimension(:), pointer edge_e => NULL()
 
real(r8_kind), dimension(:), pointer edge_n => NULL()
 
real(r8_kind), dimension(:), pointer edge_s => NULL()
 
real(r8_kind), dimension(:), pointer edge_w => NULL()
 
real(r8_kind), dimension(:,:,:), pointer en1 => NULL()
 
real(r8_kind), dimension(:,:,:), pointer en2 => NULL()
 
real(r8_kind), dimension(:,:,:), pointer vlat => NULL()
 
real(r8_kind), dimension(:,:,:), pointer vlon => NULL()
 

Member Data Documentation

◆ area

real(r8_kind), dimension(:,:), pointer area => NULL()

Definition at line 291 of file xgrid.F90.

◆ dx

real(r8_kind), dimension(:,:), pointer dx => NULL()

Definition at line 289 of file xgrid.F90.

◆ dy

real(r8_kind), dimension(:,:), pointer dy => NULL()

Definition at line 290 of file xgrid.F90.

◆ edge_e

real(r8_kind), dimension(:), pointer edge_e => NULL()

Definition at line 293 of file xgrid.F90.

◆ edge_n

real(r8_kind), dimension(:), pointer edge_n => NULL()

Definition at line 295 of file xgrid.F90.

◆ edge_s

real(r8_kind), dimension(:), pointer edge_s => NULL()

Definition at line 294 of file xgrid.F90.

◆ edge_w

real(r8_kind), dimension(:), pointer edge_w => NULL()

Definition at line 292 of file xgrid.F90.

◆ en1

real(r8_kind), dimension(:,:,:), pointer en1 => NULL()

Definition at line 296 of file xgrid.F90.

◆ en2

real(r8_kind), dimension(:,:,:), pointer en2 => NULL()

Definition at line 297 of file xgrid.F90.

◆ vlat

real(r8_kind), dimension(:,:,:), pointer vlat => NULL()

Definition at line 299 of file xgrid.F90.

◆ vlon

real(r8_kind), dimension(:,:,:), pointer vlon => NULL()

Definition at line 298 of file xgrid.F90.

◆ xgrid_mod::grid_type

type xgrid_mod::grid_type

Private type to hold all data needed from given grid for an exchange grid.

Definition at line 304 of file xgrid.F90.

Collaboration diagram for grid_type:
[legend]

Public Attributes

real(r8_kind), dimension(:,:), pointer area =>NULL()
 cell area
 
real(r8_kind), dimension(:,:), pointer area_inv =>NULL()
 1 / area for normalization
 
type(grid_box_typebox
 used for second order remapping.
 
type(domain2ddomain
 used for conservation checks
 
type(domain2ddomain_with_halo
 used for second order remapping
 
integer first
 xgrid index range
 
integer first_get
 xgrid index range for get_2_from_xgrid
 
real(r8_kind), dimension(:,:,:), pointer frac_area =>NULL()
 partition fractions
 
integer, dimension(:), pointer ge =>NULL()
 
integer, pointer ge_me =>NULL()
 
real(r8_kind), dimension(:,:), pointer geolat =>NULL()
 geographical grid center
 
real(r8_kind), dimension(:,:), pointer geolon =>NULL()
 geographical grid center
 
integer, dimension(:), pointer gs =>NULL()
 
integer, pointer gs_me =>NULL()
 
character(len=3) id
 grid identifier
 
integer, dimension(:), pointer ie =>NULL()
 domain - i-range (pe index)
 
integer, pointer ie_me =>NULL()
 my domain - i-range
 
integer ied_me
 my data domain - i-range
 
integer im
 global domain range
 
integer, dimension(:), pointer is =>NULL()
 domain - i-range (pe index)
 
logical is_latlon
 indicate if the grid is lat-lon grid or not.
 
integer, pointer is_me =>NULL()
 my domain - i-range
 
logical is_ug
 
integer isd_me
 my data domain - i-range
 
integer, dimension(:), pointer je =>NULL()
 domain - j-range (pe index)
 
integer, pointer je_me =>NULL()
 my domain - j-range
 
integer jed_me
 my data domain - j-range
 
integer jm
 global domain range
 
integer, dimension(:), pointer js =>NULL()
 domain - j-range (pe index)
 
integer, pointer js_me =>NULL()
 my domain - j-range
 
integer jsd_me
 my data domain - j-range
 
integer km
 global domain range
 
integer, dimension(:), pointer l_index =>NULL()
 
integer last
 xgrid index range
 
integer last_get
 xgrid index range for get_2_from_xgrid
 
real(r8_kind), dimension(:), pointer lat =>NULL()
 center of global grids
 
integer, dimension(:), pointer le =>NULL()
 
integer, pointer le_me =>NULL()
 unstruct domain
 
real(r8_kind), dimension(:), pointer lon =>NULL()
 center of global grids
 
integer, dimension(:), pointer ls =>NULL()
 
integer, pointer ls_me =>NULL()
 unstruct domain
 
integer ni
 max of global size of all the tiles
 
integer nj
 max of global size of all the tiles
 
integer npes
 number of processor on this grid.
 
integer ntile
 number of tiles in mosaic
 
integer nxc_me
 compute domain size
 
integer nxd_me
 data domain size
 
integer nxl_me
 
integer nyc_me
 compute domain size
 
integer nyd_me
 data domain size
 
logical on_this_pe
 indicate the domain is defined on this pe
 
integer, dimension(:), pointer pelist
 pelist of the domain
 
integer root_pe
 indicate the root pe of the domain
 
integer size
 
integer size_repro
 
integer, dimension(:), pointer tile =>NULL()
 tile id ( pe index )
 
integer, pointer tile_me
 my tile id
 
type(domainugug_domain
 
type(xcell_type), dimension(:), pointer x =>NULL()
 xcell patterns
 
type(xcell_type), dimension(:), pointer x_repro =>NULL()
 side 1 patterns for repro
 

Member Data Documentation

◆ area

real(r8_kind), dimension(:,:), pointer area =>NULL()

cell area

Definition at line 339 of file xgrid.F90.

◆ area_inv

real(r8_kind), dimension(:,:), pointer area_inv =>NULL()

1 / area for normalization

Definition at line 340 of file xgrid.F90.

◆ box

type(grid_box_type) box

used for second order remapping.

Definition at line 352 of file xgrid.F90.

◆ domain

type(domain2d) domain

used for conservation checks

Definition at line 349 of file xgrid.F90.

◆ domain_with_halo

type(domain2d) domain_with_halo

used for second order remapping

Definition at line 350 of file xgrid.F90.

◆ first

integer first

xgrid index range

Definition at line 341 of file xgrid.F90.

◆ first_get

integer first_get

xgrid index range for get_2_from_xgrid

Definition at line 343 of file xgrid.F90.

◆ frac_area

real(r8_kind), dimension(:,:,:), pointer frac_area =>NULL()

partition fractions

Definition at line 338 of file xgrid.F90.

◆ ge

integer, dimension(:), pointer ge =>NULL()

Definition at line 360 of file xgrid.F90.

◆ ge_me

integer, pointer ge_me =>NULL()

Definition at line 359 of file xgrid.F90.

◆ geolat

real(r8_kind), dimension(:,:), pointer geolat =>NULL()

geographical grid center

Definition at line 337 of file xgrid.F90.

◆ geolon

real(r8_kind), dimension(:,:), pointer geolon =>NULL()

geographical grid center

Definition at line 336 of file xgrid.F90.

◆ gs

integer, dimension(:), pointer gs =>NULL()

Definition at line 360 of file xgrid.F90.

◆ gs_me

integer, pointer gs_me =>NULL()

Definition at line 359 of file xgrid.F90.

◆ id

character(len=3) id

grid identifier

Definition at line 305 of file xgrid.F90.

◆ ie

integer, dimension(:), pointer ie =>NULL()

domain - i-range (pe index)

Definition at line 315 of file xgrid.F90.

◆ ie_me

integer, pointer ie_me =>NULL()

my domain - i-range

Definition at line 319 of file xgrid.F90.

◆ ied_me

integer ied_me

my data domain - i-range

Definition at line 323 of file xgrid.F90.

◆ im

integer im

global domain range

Definition at line 331 of file xgrid.F90.

◆ is

integer, dimension(:), pointer is =>NULL()

domain - i-range (pe index)

Definition at line 314 of file xgrid.F90.

◆ is_latlon

logical is_latlon

indicate if the grid is lat-lon grid or not.

Definition at line 351 of file xgrid.F90.

◆ is_me

integer, pointer is_me =>NULL()

my domain - i-range

Definition at line 318 of file xgrid.F90.

◆ is_ug

logical is_ug

Definition at line 354 of file xgrid.F90.

◆ isd_me

integer isd_me

my data domain - i-range

Definition at line 322 of file xgrid.F90.

◆ je

integer, dimension(:), pointer je =>NULL()

domain - j-range (pe index)

Definition at line 317 of file xgrid.F90.

◆ je_me

integer, pointer je_me =>NULL()

my domain - j-range

Definition at line 321 of file xgrid.F90.

◆ jed_me

integer jed_me

my data domain - j-range

Definition at line 325 of file xgrid.F90.

◆ jm

integer jm

global domain range

Definition at line 332 of file xgrid.F90.

◆ js

integer, dimension(:), pointer js =>NULL()

domain - j-range (pe index)

Definition at line 316 of file xgrid.F90.

◆ js_me

integer, pointer js_me =>NULL()

my domain - j-range

Definition at line 320 of file xgrid.F90.

◆ jsd_me

integer jsd_me

my data domain - j-range

Definition at line 324 of file xgrid.F90.

◆ km

integer km

global domain range

Definition at line 333 of file xgrid.F90.

◆ l_index

integer, dimension(:), pointer l_index =>NULL()

Definition at line 361 of file xgrid.F90.

◆ last

integer last

xgrid index range

Definition at line 342 of file xgrid.F90.

◆ last_get

integer last_get

xgrid index range for get_2_from_xgrid

Definition at line 344 of file xgrid.F90.

◆ lat

real(r8_kind), dimension(:), pointer lat =>NULL()

center of global grids

Definition at line 335 of file xgrid.F90.

◆ le

integer, dimension(:), pointer le =>NULL()

Definition at line 358 of file xgrid.F90.

◆ le_me

integer, pointer le_me =>NULL()

unstruct domain

Definition at line 357 of file xgrid.F90.

◆ lon

real(r8_kind), dimension(:), pointer lon =>NULL()

center of global grids

Definition at line 334 of file xgrid.F90.

◆ ls

integer, dimension(:), pointer ls =>NULL()

Definition at line 358 of file xgrid.F90.

◆ ls_me

integer, pointer ls_me =>NULL()

unstruct domain

Definition at line 356 of file xgrid.F90.

◆ ni

integer ni

max of global size of all the tiles

Definition at line 311 of file xgrid.F90.

◆ nj

integer nj

max of global size of all the tiles

Definition at line 312 of file xgrid.F90.

◆ npes

integer npes

number of processor on this grid.

Definition at line 306 of file xgrid.F90.

◆ ntile

integer ntile

number of tiles in mosaic

Definition at line 310 of file xgrid.F90.

◆ nxc_me

integer nxc_me

compute domain size

Definition at line 328 of file xgrid.F90.

◆ nxd_me

integer nxd_me

data domain size

Definition at line 326 of file xgrid.F90.

◆ nxl_me

integer nxl_me

Definition at line 355 of file xgrid.F90.

◆ nyc_me

integer nyc_me

compute domain size

Definition at line 329 of file xgrid.F90.

◆ nyd_me

integer nyd_me

data domain size

Definition at line 327 of file xgrid.F90.

◆ on_this_pe

logical on_this_pe

indicate the domain is defined on this pe

Definition at line 307 of file xgrid.F90.

◆ pelist

integer, dimension(:), pointer pelist

pelist of the domain

Definition at line 309 of file xgrid.F90.

◆ root_pe

integer root_pe

indicate the root pe of the domain

Definition at line 308 of file xgrid.F90.

◆ size

integer size

xcell patterns

Definition at line 345 of file xgrid.F90.

◆ size_repro

integer size_repro

side 1 patterns for repro

Definition at line 347 of file xgrid.F90.

◆ tile

integer, dimension(:), pointer tile =>NULL()

tile id ( pe index )

Definition at line 313 of file xgrid.F90.

◆ tile_me

integer, pointer tile_me

my tile id

Definition at line 330 of file xgrid.F90.

◆ ug_domain

type(domainug) ug_domain

Definition at line 362 of file xgrid.F90.

◆ x

type(xcell_type), dimension(:), pointer x =>NULL()

xcell patterns

Definition at line 346 of file xgrid.F90.

◆ x_repro

type(xcell_type), dimension(:), pointer x_repro =>NULL()

side 1 patterns for repro

Definition at line 348 of file xgrid.F90.

◆ xgrid_mod::overlap_type

type xgrid_mod::overlap_type

Private type for overlap exchange grid data.

Definition at line 388 of file xgrid.F90.

Collaboration diagram for overlap_type:
[legend]

Public Attributes

integer buffer_pos
 
integer count
 
real(r8_kind), dimension(:), allocatable di
 
real(r8_kind), dimension(:), allocatable dj
 
integer, dimension(:), allocatable g
 
integer, dimension(:), allocatable i
 
integer, dimension(:), allocatable j
 
integer pe
 
integer, dimension(:), allocatable tile
 
integer, dimension(:), allocatable xloc
 

Member Data Documentation

◆ buffer_pos

integer buffer_pos

Definition at line 391 of file xgrid.F90.

◆ count

integer count

Definition at line 389 of file xgrid.F90.

◆ di

real(r8_kind), dimension(:), allocatable di

Definition at line 397 of file xgrid.F90.

◆ dj

real(r8_kind), dimension(:), allocatable dj

Definition at line 398 of file xgrid.F90.

◆ g

integer, dimension(:), allocatable g

Definition at line 394 of file xgrid.F90.

◆ i

integer, dimension(:), allocatable i

Definition at line 392 of file xgrid.F90.

◆ j

integer, dimension(:), allocatable j

Definition at line 393 of file xgrid.F90.

◆ pe

integer pe

Definition at line 390 of file xgrid.F90.

◆ tile

integer, dimension(:), allocatable tile

Definition at line 396 of file xgrid.F90.

◆ xloc

integer, dimension(:), allocatable xloc

Definition at line 395 of file xgrid.F90.

◆ xgrid_mod::put_to_xgrid

interface xgrid_mod::put_to_xgrid

Scatters data from model grid onto exchange grid.

Example usage:

call put_to_xgrid(d, grid_id, x, xmap, remap_order)

Definition at line 193 of file xgrid.F90.

Public Member Functions

subroutine put_side1_to_xgrid (d, grid_id, x, xmap, remap_method, complete)
 Scatters data to exchange grid.
 
subroutine put_side2_to_xgrid (d, grid_id, x, xmap)
 Scatters data to exchange grid.
 

Member Function/Subroutine Documentation

◆ put_side1_to_xgrid()

subroutine put_side1_to_xgrid ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method,
logical, intent(in), optional  complete 
)

Scatters data to exchange grid.

Parameters
[in]ddata to send
[in]grid_id3 character grid ID
[in,out]xxgrid data
[in,out]xmapexchange grid
[in]remap_methodexchange grid interpolation method can be FIRST_ORDER(=1) or SECOND_ORDER(=2)

Definition at line 3247 of file xgrid.F90.

◆ put_side2_to_xgrid()

subroutine put_side2_to_xgrid ( real(r8_kind), dimension(:,:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap 
)

Scatters data to exchange grid.

Parameters
[in]ddata to send
[in]grid_id3 character grid ID
[in,out]xxgrid data
[in,out]xmapexchange grid

Definition at line 3339 of file xgrid.F90.

◆ xgrid_mod::put_to_xgrid_ug

interface xgrid_mod::put_to_xgrid_ug

put_to_xgrid for unstructured grids.

Scatters data from unstructured grid onto exchange grid.

Definition at line 214 of file xgrid.F90.

Public Member Functions

subroutine put_side1_to_xgrid_ug (d, grid_id, x, xmap, complete)
 Currently only support first order.
 
subroutine put_side2_to_xgrid_ug (d, grid_id, x, xmap)
 

Member Function/Subroutine Documentation

◆ put_side1_to_xgrid_ug()

subroutine put_side1_to_xgrid_ug ( real(r8_kind), dimension(:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap,
logical, intent(in), optional  complete 
)

Currently only support first order.

Definition at line 4930 of file xgrid.F90.

◆ put_side2_to_xgrid_ug()

subroutine put_side2_to_xgrid_ug ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap 
)

Definition at line 5005 of file xgrid.F90.

◆ xgrid_mod::set_frac_area

interface xgrid_mod::set_frac_area

Sets sub-grid area and numbering in the given exchange grid.

Definition at line 230 of file xgrid.F90.

Public Member Functions

subroutine set_frac_area_sg (f, grid_id, xmap)
 Changes sub-grid portion areas and/or number.
 
subroutine set_frac_area_ug (f, grid_id, xmap)
 Changes sub-grid portion areas and/or number.
 

Member Function/Subroutine Documentation

◆ set_frac_area_sg()

subroutine set_frac_area_sg ( real(r8_kind), dimension(:,:,:), intent(in)  f,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap 
)

Changes sub-grid portion areas and/or number.

(re)sets the "fraction area" of the side 2 component grid cell. "fraction area" is a dynamic property of the component model (seaice or land) that needs to be updated after each timestep of that component in order for the exhange mechanism to work properly. The input is a 3d array of numbers between 0 and 1. It signifies the fraction of the component grid cell area which has a model-specific property. This property is used for some sub-grid scale parametrization in the component model. E.g., for the seaice component model, the quantity of seaice in each grid cell (i,j) is distibuted into N=gridkm partitions (ice categories) each parametrized with a weight (part_size) that add to 1. E.g., for 6+2 thickness (h) categories used in GFDL seaice models we have given hlim(1, ..., 8) = [1.0e-10, 0.1, 0.3, 0.7, 1.1, 1.5, 2.0, 2.5] (meters) Caterory n=1 : h <= hlim(1), essentially no ice Caterory n=2...7 : hlim(n-1) < h <= hlim(n) Caterory n=8 : hlim(n-1) < h , unlimimitted ice thickness E.g., if seaice in grid cell (i,j) is parameterized as 10 % open water, 0% category 1, 40% category 2 , 50% category 3 then we have f(i,j,1:km) = part_size(i,j,1:8) = [0.1, 0.0, 0.4, 0.5, 0.0, 0.0, 0.0, 0.0]

Parameters
[in]freal(r8_kind) 3D array
[in]grid_id3 character grid ID
[in,out]xmapexchange grid


Example usage:

call fms_xgrid_set_frac_area (ice%part_size(isc:iec,jsc:jec,:) , 'OCN', xmap_sfc)
Parameters
[in]ffraction area to be set
[in]grid_id3 character grid ID
[in,out]xmapexchange grid with given grid ID

Definition at line 3172 of file xgrid.F90.

◆ set_frac_area_ug()

subroutine set_frac_area_ug ( real(r8_kind), dimension(:,:), intent(in)  f,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap 
)

Changes sub-grid portion areas and/or number.

Parameters
[in]ffractional area to set
[in]grid_id3 character grid ID
[in,out]xmapexchange grid with given grid ID

Definition at line 3204 of file xgrid.F90.

◆ xgrid_mod::stock_move

interface xgrid_mod::stock_move

Definition at line 483 of file xgrid.F90.

Public Member Functions

subroutine stock_move_2d (from, to, grid_index, stock_data2d, xmap, delta_t, from_side, to_side, radius, verbose, ier)
 this version takes rank 2 data, it can be used to compute the flux on the atmos side note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.
 
subroutine stock_move_3d (from, to, grid_index, stock_data3d, xmap, delta_t, from_side, to_side, radius, verbose, ier)
 this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.
 

Member Function/Subroutine Documentation

◆ stock_move_2d()

subroutine stock_move_2d ( type(stock_type), intent(inout), optional  from,
type(stock_type), intent(inout), optional  to,
integer, intent(in), optional  grid_index,
real(r8_kind), dimension(:,:), intent(in)  stock_data2d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
integer, intent(in)  from_side,
integer, intent(in)  to_side,
real(r8_kind), intent(in)  radius,
character(len=*), intent(in)  verbose,
integer, intent(out)  ier 
)

this version takes rank 2 data, it can be used to compute the flux on the atmos side note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.

Parameters
[in]stock_data2ddata array is 2d
[in]from_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]to_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]radiusearth radius

Definition at line 4543 of file xgrid.F90.

◆ stock_move_3d()

subroutine stock_move_3d ( type(stock_type), intent(inout), optional  from,
type(stock_type), intent(inout), optional  to,
integer, intent(in)  grid_index,
real(r8_kind), dimension(:,:,:), intent(in)  stock_data3d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
integer, intent(in)  from_side,
integer, intent(in)  to_side,
real(r8_kind), intent(in)  radius,
character(len=*), intent(in), optional  verbose,
integer, intent(out)  ier 
)

this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.

Parameters
[in]grid_indexgrid index
[in]stock_data3ddata array is 3d
[in]from_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]to_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]radiusearth radius

Definition at line 4483 of file xgrid.F90.

◆ xgrid_mod::stock_move_ug

interface xgrid_mod::stock_move_ug

Definition at line 488 of file xgrid.F90.

Public Member Functions

subroutine stock_move_ug_3d (from, to, grid_index, stock_ug_data3d, xmap, delta_t, from_side, to_side, radius, verbose, ier)
 this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.
 

Member Function/Subroutine Documentation

◆ stock_move_ug_3d()

subroutine stock_move_ug_3d ( type(stock_type), intent(inout), optional  from,
type(stock_type), intent(inout), optional  to,
integer, intent(in)  grid_index,
real(r8_kind), dimension(:,:), intent(in)  stock_ug_data3d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
integer, intent(in)  from_side,
integer, intent(in)  to_side,
real(r8_kind), intent(in)  radius,
character(len=*), intent(in), optional  verbose,
integer, intent(out)  ier 
)

this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.

Parameters
[in]grid_indexgrid index
[in]stock_ug_data3ddata array is 3d
[in]from_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]to_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]radiusearth radius

Definition at line 4607 of file xgrid.F90.

◆ xgrid_mod::x1_type

type xgrid_mod::x1_type

Private type for exchange grid data.

Definition at line 368 of file xgrid.F90.

Collaboration diagram for x1_type:
[legend]

Public Attributes

real(r8_kind) area
 (= geographic area * frac_area)
 
real(r8_kind) di
 weight for the gradient of flux
 
real(r8_kind) dj
 weight for the gradient of flux
 
integer i
 
integer j
 
integer pos
 
integer tile
 tile index of side 1 mosaic.
 

Member Data Documentation

◆ area

real(r8_kind) area

(= geographic area * frac_area)

Definition at line 370 of file xgrid.F90.

◆ di

real(r8_kind) di

weight for the gradient of flux

Definition at line 372 of file xgrid.F90.

◆ dj

real(r8_kind) dj

weight for the gradient of flux

Definition at line 373 of file xgrid.F90.

◆ i

integer i

Definition at line 369 of file xgrid.F90.

◆ j

integer j

Definition at line 369 of file xgrid.F90.

◆ pos

integer pos

Definition at line 375 of file xgrid.F90.

◆ tile

integer tile

tile index of side 1 mosaic.

Definition at line 374 of file xgrid.F90.

◆ xgrid_mod::x2_type

type xgrid_mod::x2_type

Private type for exchange grid data.

Definition at line 380 of file xgrid.F90.

Collaboration diagram for x2_type:
[legend]

Public Attributes

real(r8_kind) area
 geographic area of exchange cell
 
integer i
 
integer j
 
integer k
 
integer l
 
integer pos
 

Member Data Documentation

◆ area

real(r8_kind) area

geographic area of exchange cell

Definition at line 382 of file xgrid.F90.

◆ i

integer i

Definition at line 381 of file xgrid.F90.

◆ j

integer j

Definition at line 381 of file xgrid.F90.

◆ k

integer k

Definition at line 381 of file xgrid.F90.

◆ l

integer l

Definition at line 381 of file xgrid.F90.

◆ pos

integer pos

Definition at line 381 of file xgrid.F90.

◆ xgrid_mod::xcell_type

type xgrid_mod::xcell_type

Private type for cell indices and data in the exchange grid.

Definition at line 269 of file xgrid.F90.

Collaboration diagram for xcell_type:
[legend]

Public Attributes

real(r8_kind) area
 geographic area of exchange cell
 
real(r8_kind) di
 Weight for the gradient of flux.
 
real(r8_kind) dj
 Weight for the gradient of flux.
 
integer i1
 indices of cell in model arrays on both sides
 
integer i2
 indices of cell in model arrays on both sides
 
integer j1
 indices of cell in model arrays on both sides
 
integer j2
 indices of cell in model arrays on both sides
 
integer l1
 
integer l2
 
integer pe
 other side pe that has this cell
 
integer recv_pos
 position in the receive buffer.
 
real(r8_kind) scale
 
integer tile
 tile index of side 1 mosaic.
 

Member Data Documentation

◆ area

real(r8_kind) area

geographic area of exchange cell

Definition at line 278 of file xgrid.F90.

◆ di

real(r8_kind) di

Weight for the gradient of flux.

Definition at line 281 of file xgrid.F90.

◆ dj

real(r8_kind) dj

Weight for the gradient of flux.

Definition at line 282 of file xgrid.F90.

◆ i1

integer i1

indices of cell in model arrays on both sides

Definition at line 270 of file xgrid.F90.

◆ i2

integer i2

indices of cell in model arrays on both sides

Definition at line 272 of file xgrid.F90.

◆ j1

integer j1

indices of cell in model arrays on both sides

Definition at line 271 of file xgrid.F90.

◆ j2

integer j2

indices of cell in model arrays on both sides

Definition at line 273 of file xgrid.F90.

◆ l1

integer l1

Definition at line 274 of file xgrid.F90.

◆ l2

integer l2

Definition at line 274 of file xgrid.F90.

◆ pe

integer pe

other side pe that has this cell

Definition at line 276 of file xgrid.F90.

◆ recv_pos

integer recv_pos

position in the receive buffer.

Definition at line 275 of file xgrid.F90.

◆ scale

real(r8_kind) scale

Definition at line 283 of file xgrid.F90.

◆ tile

integer tile

tile index of side 1 mosaic.

Definition at line 277 of file xgrid.F90.

◆ xgrid_mod::xmap_type

type xgrid_mod::xmap_type

Type for an exchange grid, holds pointers to included grids and any necessary data.

Definition at line 413 of file xgrid.F90.

Collaboration diagram for xmap_type:
[legend]

Public Attributes

type(comm_type), pointer get1 =>NULL()
 for get_1_from_xgrid
 
type(comm_type), pointer get1_repro =>NULL()
 for get_1_from_xgrid_repro
 
type(grid_type), dimension(:), pointer grids =>NULL()
 1st grid is side 1; rest on side 2
 
integer, dimension(:), pointer ind_get1 =>NULL()
 indx for side1 get and side2 put.
 
integer, dimension(:), pointer ind_put1 =>NULL()
 indx for side1 put and side 2get.
 
integer me
 
integer npes
 
type(comm_type), pointer put1 =>NULL()
 for put_1_to_xgrid
 
integer, dimension(:), pointer recv_count_repro =>NULL()
 
integer recv_count_repro_tot
 sum(recv_count_repro)
 
integer root_pe
 
integer, dimension(:), pointer send_count_repro =>NULL()
 
integer send_count_repro_tot
 sum(send_count_repro)
 
integer size_get2
 
integer size_put1
 
integer version
 version of xgrids. version=VERSION! is for grid_spec file and version=VERSION2 is for mosaic grid.
 
type(x1_type), dimension(:), pointer x1 =>NULL()
 side 1 info
 
type(x1_type), dimension(:), pointer x1_put =>NULL()
 side 1 info
 
type(x2_type), dimension(:), pointer x2 =>NULL()
 side 2 info
 
type(x2_type), dimension(:), pointer x2_get =>NULL()
 side 2 info
 
logical, dimension(:), pointer your1my2 =>NULL()
 true if side 1 domain on indexed pe overlaps side 2 domain on this pe
 
logical, dimension(:), pointer your2my1 =>NULL()
 true if a side 2 domain on indexed pe overlaps side 1 domain on this pe
 
integer, dimension(:), pointer your2my1_size =>NULL()
 number of exchange grid of a side 2 domain on indexed pe overlaps side 1 domain on this pe
 

Private Attributes

integer size
 

Member Data Documentation

◆ get1

type(comm_type), pointer get1 =>NULL()

for get_1_from_xgrid

Definition at line 449 of file xgrid.F90.

◆ get1_repro

type(comm_type), pointer get1_repro =>NULL()

for get_1_from_xgrid_repro

Definition at line 450 of file xgrid.F90.

◆ grids

type (grid_type), dimension(:), pointer grids =>NULL()

1st grid is side 1; rest on side 2

Definition at line 430 of file xgrid.F90.

◆ ind_get1

integer, dimension(:), pointer ind_get1 =>NULL()

indx for side1 get and side2 put.

Definition at line 446 of file xgrid.F90.

◆ ind_put1

integer, dimension(:), pointer ind_put1 =>NULL()

indx for side1 put and side 2get.

Definition at line 447 of file xgrid.F90.

◆ me

integer me

Definition at line 418 of file xgrid.F90.

◆ npes

integer npes

Definition at line 418 of file xgrid.F90.

◆ put1

type(comm_type), pointer put1 =>NULL()

for put_1_to_xgrid

Definition at line 448 of file xgrid.F90.

◆ recv_count_repro

integer, dimension(:), pointer recv_count_repro =>NULL()

Definition at line 441 of file xgrid.F90.

◆ recv_count_repro_tot

integer recv_count_repro_tot

sum(recv_count_repro)

Definition at line 443 of file xgrid.F90.

◆ root_pe

integer root_pe

Definition at line 418 of file xgrid.F90.

◆ send_count_repro

integer, dimension(:), pointer send_count_repro =>NULL()

Definition at line 440 of file xgrid.F90.

◆ send_count_repro_tot

integer send_count_repro_tot

sum(send_count_repro)

Definition at line 442 of file xgrid.F90.

◆ size

integer size
private

of exchange grid cells with area > 0 on this pe

Definition at line 415 of file xgrid.F90.

◆ size_get2

integer size_get2

of exchange grid cells for get_2_to_xgrid

Definition at line 417 of file xgrid.F90.

◆ size_put1

integer size_put1

of exchange grid cells for put_1_to_xgrid

Definition at line 416 of file xgrid.F90.

◆ version

integer version

version of xgrids. version=VERSION! is for grid_spec file and version=VERSION2 is for mosaic grid.

Definition at line 444 of file xgrid.F90.

◆ x1

type(x1_type), dimension(:), pointer x1 =>NULL()

side 1 info

Definition at line 435 of file xgrid.F90.

◆ x1_put

type(x1_type), dimension(:), pointer x1_put =>NULL()

side 1 info

Definition at line 436 of file xgrid.F90.

◆ x2

type(x2_type), dimension(:), pointer x2 =>NULL()

side 2 info

Definition at line 437 of file xgrid.F90.

◆ x2_get

type(x2_type), dimension(:), pointer x2_get =>NULL()

side 2 info

Definition at line 438 of file xgrid.F90.

◆ your1my2

logical, dimension(:), pointer your1my2 =>NULL()

true if side 1 domain on indexed pe overlaps side 2 domain on this pe

Definition at line 419 of file xgrid.F90.

◆ your2my1

logical, dimension(:), pointer your2my1 =>NULL()

true if a side 2 domain on indexed pe overlaps side 1 domain on this pe

Definition at line 422 of file xgrid.F90.

◆ your2my1_size

integer, dimension(:), pointer your2my1_size =>NULL()

number of exchange grid of a side 2 domain on indexed pe overlaps side 1 domain on this pe

Definition at line 425 of file xgrid.F90.

Function/Subroutine Documentation

◆ conservation_check_side1()

real(r8_kind) function, dimension(3) conservation_check_side1 ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)
private

conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_side1
Parameters
[in]dmodel data to check
[in]grid_id3 character grid id
[in,out]xmapexchange grid

Definition at line 4110 of file xgrid.F90.

◆ conservation_check_side2()

real(r8_kind) function, dimension(3) conservation_check_side2 ( real(r8_kind), dimension(:,:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)
private

conservation_check - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_side2
Parameters
[in]dmodel data to check
[in]grid_id3 character grid ID
[in,out]xmapexchange grid

Definition at line 4157 of file xgrid.F90.

◆ conservation_check_ug_side1()

real(r8_kind) function, dimension(3) conservation_check_ug_side1 ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)
private

conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_ug_side1
Parameters
[in]dmodel data to check
[in]grid_id3 character grid ID
[in,out]xmapexchange grid

Definition at line 4213 of file xgrid.F90.

◆ conservation_check_ug_side2()

real(r8_kind) function, dimension(3) conservation_check_ug_side2 ( real(r8_kind), dimension(:,:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method 
)
private

conservation_check_ug - returns three numbers which are the global sum of a variable (1) on its home model grid, (2) after interpolation to the other side grid(s), and (3) after re_interpolation back onto its home side grid(s).

Returns
real(r8_kind) conservation_check_ug_side2
Parameters
[in]dmodel data to check
[in]grid_id3 character grid ID
[in,out]xmapexchange grid

Definition at line 4286 of file xgrid.F90.

◆ get_1_from_xgrid()

subroutine get_1_from_xgrid ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  isize,
integer, intent(in)  jsize,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 3876 of file xgrid.F90.

◆ get_1_from_xgrid_repro()

subroutine get_1_from_xgrid_repro ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 4008 of file xgrid.F90.

◆ get_1_from_xgrid_ug()

subroutine get_1_from_xgrid_ug ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  isize,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 5169 of file xgrid.F90.

◆ get_1_from_xgrid_ug_repro()

subroutine get_1_from_xgrid_ug_repro ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 5299 of file xgrid.F90.

◆ get_2_from_xgrid()

subroutine get_2_from_xgrid ( real(r8_kind), dimension(grid%is_me:grid%ie_me, grid%js_me:grid%je_me, grid%km), intent(out)  d,
type (grid_type), intent(in)  grid,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(in)  xmap 
)
private

Definition at line 3520 of file xgrid.F90.

◆ get_2_from_xgrid_ug()

subroutine get_2_from_xgrid_ug ( real(r8_kind), dimension(grid%ls_me:grid%le_me, grid%km), intent(out)  d,
type (grid_type), intent(in)  grid,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(in)  xmap 
)
private

Definition at line 5395 of file xgrid.F90.

◆ get_area_elements_fms2_io()

subroutine get_area_elements_fms2_io ( type(fmsnetcdfdomainfile_t), intent(in)  fileobj,
character(len=*), intent(in)  name,
real(r8_kind), dimension(:,:), intent(out)  get_area_data 
)
private

Read the area elements from NetCDF file.

Definition at line 1460 of file xgrid.F90.

◆ get_grid_version1()

subroutine get_grid_version1 ( type(grid_type), intent(inout)  grid,
character(len=3), intent(in)  grid_id,
character(len=*), intent(in)  grid_file 
)
private

read the center point of the grid from version 1 grid file. only the grid at the side 1 is needed, so we only read atm and land grid.

Definition at line 1304 of file xgrid.F90.

◆ get_grid_version2()

subroutine get_grid_version2 ( type(grid_type), intent(inout)  grid,
character(len=3), intent(in)  grid_id,
character(len=*), intent(in)  grid_file 
)
private

read the center point of the grid from version 1 grid file. only the grid at the side 1 is needed, so we only read atm and land grid

Definition at line 1372 of file xgrid.F90.

◆ get_index_range()

subroutine, public get_index_range ( type(xmap_type), intent(in)  xmap,
integer, intent(in)  grid_index,
integer, intent(out)  is,
integer, intent(out)  ie,
integer, intent(out)  js,
integer, intent(out)  je,
integer, intent(out)  km 
)

Definition at line 4464 of file xgrid.F90.

◆ get_nest_contact_fms2_io()

integer function get_nest_contact_fms2_io ( type(fmsnetcdffile_t), intent(in)  fileobj,
integer, intent(out)  tile_nest_out,
integer, intent(out)  tile_parent_out,
integer, intent(out)  is_nest_out,
integer, intent(out)  ie_nest_out,
integer, intent(out)  js_nest_out,
integer, intent(out)  je_nest_out,
integer, intent(out)  is_parent_out,
integer, intent(out)  ie_parent_out,
integer, intent(out)  js_parent_out,
integer, intent(out)  je_parent_out 
)
private

currently we are assuming there is only one nest region

Returns
integer get_nest_contact

Definition at line 2117 of file xgrid.F90.

◆ get_ocean_model_area_elements()

subroutine, public get_ocean_model_area_elements ( type(domain2d), intent(in)  domain,
character(len=*), intent(in)  grid_file 
)

Read Ocean area element data from netCDF file.

If available in the NetCDF file, this routine will read the AREA_OCN_MODEL field and load the data into global AREA_OCN_MODEL. If not available, then the array AREA_OCN_MODEL will be left unallocated. Must be called by all PEs.

Definition at line 1483 of file xgrid.F90.

◆ get_side1_from_xgrid()

subroutine get_side1_from_xgrid ( real(r8_kind), dimension(:,:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(inout)  xmap,
logical, intent(in), optional  complete 
)
private
Parameters
[out]drecieved xgrid data
[in]grid_id3 character grid ID
[in]xxgrid data
[in,out]xmapexchange grid

Definition at line 3364 of file xgrid.F90.

◆ get_side1_from_xgrid_ug()

subroutine get_side1_from_xgrid_ug ( real(r8_kind), dimension(:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(inout)  xmap,
logical, intent(in), optional  complete 
)
private

Definition at line 4848 of file xgrid.F90.

◆ get_side2_from_xgrid()

subroutine get_side2_from_xgrid ( real(r8_kind), dimension(:,:,:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(in)  xmap 
)
private
Parameters
[out]dreceived xgrid data
[in]grid_id3 character grid ID
[in]xxgrid data
[in]xmapexchange grid

Definition at line 3441 of file xgrid.F90.

◆ get_side2_from_xgrid_ug()

subroutine get_side2_from_xgrid_ug ( real(r8_kind), dimension(:,:), intent(out)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(in)  x,
type (xmap_type), intent(in)  xmap 
)
private

Definition at line 5037 of file xgrid.F90.

◆ get_xmap_grid_area()

subroutine, public get_xmap_grid_area ( character(len=3), intent(in)  id,
type (xmap_type), intent(inout)  xmap,
real(r8_kind), dimension(:,:), intent(out)  area 
)

This routine is used to get the grid area of component model with id.

Definition at line 4366 of file xgrid.F90.

◆ grad_merid_latlon()

real(r8_kind) function, dimension(is:ie,js:je) grad_merid_latlon ( real(r8_kind), dimension(isd:,jsd:), intent(in)  d,
real(r8_kind), dimension(:), intent(in)  lat,
integer, intent(in)  is,
integer, intent(in)  ie,
integer, intent(in)  js,
integer, intent(in)  je,
integer, intent(in)  isd,
integer, intent(in)  jsd 
)
private

This function is used to calculate the gradient along meridinal direction. Maybe need to setup a limit for the gradient. regular lat-lon grid are assumed.

Returns
grad_merid_latlon

Definition at line 4434 of file xgrid.F90.

◆ grad_zonal_latlon()

real(r8_kind) function, dimension(is:ie,js:je) grad_zonal_latlon ( real(r8_kind), dimension(isd:,jsd:), intent(in)  d,
real(r8_kind), dimension(:), intent(in)  lon,
real(r8_kind), dimension(:), intent(in)  lat,
integer, intent(in)  is,
integer, intent(in)  ie,
integer, intent(in)  js,
integer, intent(in)  je,
integer, intent(in)  isd,
integer, intent(in)  jsd 
)
private

This function is used to calculate the gradient along zonal direction. Maybe need to setup a limit for the gradient. The grid is assumeed to be regular lat-lon grid.

Returns
real(r8_kind) grad_zonal_latlon

Definition at line 4394 of file xgrid.F90.

◆ in_box()

logical function in_box ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  is,
integer, intent(in)  ie,
integer, intent(in)  js,
integer, intent(in)  je 
)
private
Returns
logical in_box

Definition at line 511 of file xgrid.F90.

◆ in_box_me()

logical function in_box_me ( integer, intent(in)  i,
integer, intent(in)  j,
type (grid_type), intent(in)  grid 
)
private
Returns
logical in_box_me

Definition at line 5423 of file xgrid.F90.

◆ in_box_nbr()

logical function in_box_nbr ( integer, intent(in)  i,
integer, intent(in)  j,
type (grid_type), intent(in)  grid,
integer, intent(in)  p 
)
private
Returns
logical in_box_nbr

Definition at line 5439 of file xgrid.F90.

◆ is_lat_lon()

logical function is_lat_lon ( real(r8_kind), dimension(:,:), intent(in)  lon,
real(r8_kind), dimension(:,:), intent(in)  lat 
)
private
Returns
logical is_lat_lon

Definition at line 4800 of file xgrid.F90.

◆ load_xgrid()

subroutine load_xgrid ( type(xmap_type), intent(inout)  xmap,
type(grid_type), intent(inout)  grid,
character(len=*), intent(in)  grid_file,
character(len=3), intent(in)  grid1_id,
character(len=3), intent(in)  grid_id,
integer, intent(in)  tile1,
integer, intent(in)  tile2,
logical, intent(in)  use_higher_order 
)
private

Definition at line 593 of file xgrid.F90.

◆ put_1_to_xgrid_order_1()

subroutine put_1_to_xgrid_order_1 ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  isize,
integer, intent(in)  jsize,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 3549 of file xgrid.F90.

◆ put_1_to_xgrid_order_2()

subroutine put_1_to_xgrid_order_2 ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  isize,
integer, intent(in)  jsize,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 3638 of file xgrid.F90.

◆ put_1_to_xgrid_ug_order_1()

subroutine put_1_to_xgrid_ug_order_1 ( integer(i8_kind), dimension(:), intent(in)  d_addrs,
integer(i8_kind), dimension(:), intent(in)  x_addrs,
type (xmap_type), intent(inout)  xmap,
integer, intent(in)  dsize,
integer, intent(in)  xsize,
integer, intent(in)  lsize 
)
private

Definition at line 5064 of file xgrid.F90.

◆ put_2_to_xgrid()

subroutine put_2_to_xgrid ( real(r8_kind), dimension(grid%is_me:grid%ie_me, grid%js_me:grid%je_me, grid%km), intent(in)  d,
type (grid_type), intent(in)  grid,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(in)  xmap 
)
private

Definition at line 3501 of file xgrid.F90.

◆ put_2_to_xgrid_ug()

subroutine put_2_to_xgrid_ug ( real(r8_kind), dimension(grid%ls_me:grid%le_me, grid%km), intent(in)  d,
type (grid_type), intent(in)  grid,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(in)  xmap 
)
private

Definition at line 5152 of file xgrid.F90.

◆ put_side1_to_xgrid()

subroutine put_side1_to_xgrid ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap,
integer, intent(in), optional  remap_method,
logical, intent(in), optional  complete 
)
private

Scatters data to exchange grid.

Parameters
[in]ddata to send
[in]grid_id3 character grid ID
[in,out]xxgrid data
[in,out]xmapexchange grid
[in]remap_methodexchange grid interpolation method can be FIRST_ORDER(=1) or SECOND_ORDER(=2)

Definition at line 3247 of file xgrid.F90.

◆ put_side1_to_xgrid_ug()

subroutine put_side1_to_xgrid_ug ( real(r8_kind), dimension(:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap,
logical, intent(in), optional  complete 
)
private

Currently only support first order.

Definition at line 4930 of file xgrid.F90.

◆ put_side2_to_xgrid()

subroutine put_side2_to_xgrid ( real(r8_kind), dimension(:,:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap 
)
private

Scatters data to exchange grid.

Parameters
[in]ddata to send
[in]grid_id3 character grid ID
[in,out]xxgrid data
[in,out]xmapexchange grid

Definition at line 3339 of file xgrid.F90.

◆ put_side2_to_xgrid_ug()

subroutine put_side2_to_xgrid_ug ( real(r8_kind), dimension(:,:), intent(in)  d,
character(len=3), intent(in)  grid_id,
real(r8_kind), dimension(:), intent(inout)  x,
type (xmap_type), intent(inout)  xmap 
)
private

Definition at line 5005 of file xgrid.F90.

◆ regen()

subroutine regen ( type (xmap_type), intent(inout)  xmap)
private

Regenerate/Update the xmap.

This subroutine basically regenerates the exchange grid via updating the xmap. Practically xmap is the object specifying the exchange grid and has all the relevant information of Xgrid. Particularly note that regenerating the xmap/Xgrid accounts for dynamical changes of the subgrid parametrization of the side 2 components (land and ice-ocean). E.g., for when side 2 is the ice , the xgrid is regenrated so that OCN grid cells that are partially or totally open water contribute to (are side2 parent of) the Xgrid and conversely OCN grid cells that are totally ice covered do not contribute to (are kicked out of) the Xgrid. This makes xmap a dynamical object and a powerful tool for flux exchange calculations.

Things to keep in mind about xmap/xgrid: xgrid contains two sides: side1: This is the side where 2d arrays are put to and get from the Xgrid side2: This is the side where 3d arrays are put to and get from the Xgrid. This was designed to enable exchange along sub-grid-scale (3rd dimension) for component models that have subgrid scale parametrization (e.g., seaice categories and land tiles).

Parameters
[in,out]xmapexchange grid

Definition at line 2939 of file xgrid.F90.

◆ set_comm_get1()

subroutine set_comm_get1 ( type (xmap_type), intent(inout)  xmap)
private

Definition at line 2324 of file xgrid.F90.

◆ set_comm_get1_repro()

subroutine set_comm_get1_repro ( type (xmap_type), intent(inout)  xmap)
private

Definition at line 2217 of file xgrid.F90.

◆ set_comm_put1()

subroutine set_comm_put1 ( type (xmap_type), intent(inout)  xmap)
private

Definition at line 2627 of file xgrid.F90.

◆ set_frac_area_sg()

subroutine set_frac_area_sg ( real(r8_kind), dimension(:,:,:), intent(in)  f,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap 
)
private

Changes sub-grid portion areas and/or number.

(re)sets the "fraction area" of the side 2 component grid cell. "fraction area" is a dynamic property of the component model (seaice or land) that needs to be updated after each timestep of that component in order for the exhange mechanism to work properly. The input is a 3d array of numbers between 0 and 1. It signifies the fraction of the component grid cell area which has a model-specific property. This property is used for some sub-grid scale parametrization in the component model. E.g., for the seaice component model, the quantity of seaice in each grid cell (i,j) is distibuted into N=gridkm partitions (ice categories) each parametrized with a weight (part_size) that add to 1. E.g., for 6+2 thickness (h) categories used in GFDL seaice models we have given hlim(1, ..., 8) = [1.0e-10, 0.1, 0.3, 0.7, 1.1, 1.5, 2.0, 2.5] (meters) Caterory n=1 : h <= hlim(1), essentially no ice Caterory n=2...7 : hlim(n-1) < h <= hlim(n) Caterory n=8 : hlim(n-1) < h , unlimimitted ice thickness E.g., if seaice in grid cell (i,j) is parameterized as 10 % open water, 0% category 1, 40% category 2 , 50% category 3 then we have f(i,j,1:km) = part_size(i,j,1:8) = [0.1, 0.0, 0.4, 0.5, 0.0, 0.0, 0.0, 0.0]

Parameters
[in]freal(r8_kind) 3D array
[in]grid_id3 character grid ID
[in,out]xmapexchange grid


Example usage:

call fms_xgrid_set_frac_area (ice%part_size(isc:iec,jsc:jec,:) , 'OCN', xmap_sfc)
Parameters
[in]ffraction area to be set
[in]grid_id3 character grid ID
[in,out]xmapexchange grid with given grid ID

Definition at line 3172 of file xgrid.F90.

◆ set_frac_area_ug()

subroutine, public set_frac_area_ug ( real(r8_kind), dimension(:,:), intent(in)  f,
character(len=3), intent(in)  grid_id,
type (xmap_type), intent(inout)  xmap 
)

Changes sub-grid portion areas and/or number.

Parameters
[in]ffractional area to set
[in]grid_id3 character grid ID
[in,out]xmapexchange grid with given grid ID

Definition at line 3204 of file xgrid.F90.

◆ setup_xmap()

subroutine, public setup_xmap ( type(xmap_type), intent(inout)  xmap,
character(len=3), dimension(:), intent(in)  grid_ids,
type(domain2d), dimension(:), intent(in)  grid_domains,
character(len=*), intent(in)  grid_file,
type(grid_box_type), intent(in), optional  atm_grid,
type(domainug), intent(in), optional  lnd_ug_domain 
)

Sets up exchange grid connectivity using grid specification file and processor domain decomposition.

Definition at line 1516 of file xgrid.F90.

◆ some()

subroutine, public some ( type (xmap_type), intent(in)  xmap,
logical, dimension(:), intent(out)  some_arr,
character(len=3), intent(in), optional  grid_id 
)

Returns logical associating exchange grid cells with given side two grid.

Parameters
[out]some_arrlogical associating exchange grid cells with given side 2 grid.

Definition at line 3467 of file xgrid.F90.

◆ stock_integrate_2d()

subroutine, public stock_integrate_2d ( real(r8_kind), dimension(:,:), intent(in)  integrate_data2d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
real(r8_kind), intent(in)  radius,
real(r8_kind), intent(out)  res,
integer, intent(out)  ier 
)

surface/time integral of a 2d array

Parameters
[in]integrate_data2ddata array is 2d
[in]radiusearth radius

Definition at line 4669 of file xgrid.F90.

◆ stock_move_2d()

subroutine stock_move_2d ( type(stock_type), intent(inout), optional  from,
type(stock_type), intent(inout), optional  to,
integer, intent(in), optional  grid_index,
real(r8_kind), dimension(:,:), intent(in)  stock_data2d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
integer, intent(in)  from_side,
integer, intent(in)  to_side,
real(r8_kind), intent(in)  radius,
character(len=*), intent(in)  verbose,
integer, intent(out)  ier 
)
private

this version takes rank 2 data, it can be used to compute the flux on the atmos side note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.

Parameters
[in]stock_data2ddata array is 2d
[in]from_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]to_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]radiusearth radius

Definition at line 4543 of file xgrid.F90.

◆ stock_move_3d()

subroutine stock_move_3d ( type(stock_type), intent(inout), optional  from,
type(stock_type), intent(inout), optional  to,
integer, intent(in)  grid_index,
real(r8_kind), dimension(:,:,:), intent(in)  stock_data3d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
integer, intent(in)  from_side,
integer, intent(in)  to_side,
real(r8_kind), intent(in)  radius,
character(len=*), intent(in), optional  verbose,
integer, intent(out)  ier 
)
private

this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.

Parameters
[in]grid_indexgrid index
[in]stock_data3ddata array is 3d
[in]from_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]to_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]radiusearth radius

Definition at line 4483 of file xgrid.F90.

◆ stock_move_ug_3d()

subroutine stock_move_ug_3d ( type(stock_type), intent(inout), optional  from,
type(stock_type), intent(inout), optional  to,
integer, intent(in)  grid_index,
real(r8_kind), dimension(:,:), intent(in)  stock_ug_data3d,
type(xmap_type), intent(in)  xmap,
real(r8_kind), intent(in)  delta_t,
integer, intent(in)  from_side,
integer, intent(in)  to_side,
real(r8_kind), intent(in)  radius,
character(len=*), intent(in), optional  verbose,
integer, intent(out)  ier 
)
private

this version takes rank 3 data, it can be used to compute the flux on anything but the first grid, which typically is on the atmos side. note that "from" and "to" are optional, the stocks will be subtracted, resp. added, only if these are present.

Parameters
[in]grid_indexgrid index
[in]stock_ug_data3ddata array is 3d
[in]from_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]to_sideISTOCK_TOP, ISTOCK_BOTTOM, or ISTOCK_SIDE
[in]radiusearth radius

Definition at line 4607 of file xgrid.F90.

◆ stock_print()

subroutine, public stock_print ( type(stock_type), intent(in)  stck,
type(time_type), intent(in)  time,
character(len=*)  comp_name,
integer, intent(in)  index,
real(r8_kind), intent(in)  ref_value,
real(r8_kind), intent(in)  radius,
integer, dimension(:), intent(in), optional  pelist 
)
Parameters
[in]indexto map stock element (water, heat, ..) to a name
[in]ref_valuethe stock value returned by the component per PE

Definition at line 4699 of file xgrid.F90.

◆ xgrid_count()

integer function, public xgrid_count ( type (xmap_type), intent(inout)  xmap)

Returns current size of exchange grid variables.

Returns
size of given exchange grid's variable

Definition at line 3238 of file xgrid.F90.

◆ xgrid_init()

subroutine, public xgrid_init ( integer, intent(out)  remap_method)

Initialize the xgrid_mod.

Initialization routine for the xgrid module. It reads the xgrid_nml, writes the version information and xgrid_nml to the log file.

Parameters
[out]remap_methodexchange grid interpolation method. It has four possible values: FIRST_ORDER (=1), SECOND_ORDER(=2).

Definition at line 522 of file xgrid.F90.

Variable Documentation

◆ area_atm_model

real(r8_kind), dimension(:,:), allocatable, public area_atm_model

Area elements used inside each model.

Definition at line 179 of file xgrid.F90.

◆ area_atm_sphere

real(r8_kind), dimension(:,:), allocatable, public area_atm_sphere

Area elements based on a the spherical model used by the ICE layer.

Definition at line 181 of file xgrid.F90.

◆ area_lnd_model

real(r8_kind), dimension(:,:), allocatable area_lnd_model
private

Definition at line 179 of file xgrid.F90.

◆ area_lnd_sphere

real(r8_kind), dimension(:,:), allocatable area_lnd_sphere
private

Definition at line 181 of file xgrid.F90.

◆ area_ocn_model

real(r8_kind), dimension(:,:), allocatable, public area_ocn_model

Definition at line 179 of file xgrid.F90.

◆ area_ocn_sphere

real(r8_kind), dimension(:,:), allocatable, public area_ocn_sphere

Definition at line 181 of file xgrid.F90.

◆ debug_stocks

logical debug_stocks = .false.
private

Definition at line 157 of file xgrid.F90.

◆ do_alltoall

logical do_alltoall = .true.
private

Definition at line 167 of file xgrid.F90.

◆ do_alltoallv

logical do_alltoallv = .false.
private

Definition at line 168 of file xgrid.F90.

◆ interp_method

character(len=64) interp_method = 'first_order'
private

Exchange grid interpolation method. It has two options: "first_order", "second_order".

Definition at line 155 of file xgrid.F90.

◆ make_exchange_reproduce

logical make_exchange_reproduce = .false.
private

Set to .true. to make xgrid_mod reproduce answers on different numbers of PEs. This option has a considerable performance impact. exactly same on different # PEs.

Definition at line 152 of file xgrid.F90.

◆ max_fields

integer, parameter max_fields = 80
private

Definition at line 150 of file xgrid.F90.

◆ monotonic_exchange

logical monotonic_exchange = .false.
private

Definition at line 159 of file xgrid.F90.

◆ nsubset

integer nsubset = 0
private

Number of processors to read exchange grid information. Those processors that read the exchange grid information will send data to other processors to prepare for flux exchange. Default value is 0. When nsubset is 0, each processor will read part of the exchange grid information. The purpose of this namelist is to improve performance of setup_xmap when running on higher processor count and solve receiving size mismatch issue on high processor count. Try to set nsubset = mpp_npes/MPI_rank_per_node.

Definition at line 160 of file xgrid.F90.

◆ remapping_method

integer remapping_method
private

xgrid nml

Definition at line 176 of file xgrid.F90.

◆ second_order

integer, parameter, public second_order = 2

Definition at line 147 of file xgrid.F90.

◆ use_mpp_io

logical use_mpp_io = .false.
private

use_mpp_io Default = .false. When true, uses mpp_io for IO. When false, uses fms2_io for IO.

Definition at line 169 of file xgrid.F90.

◆ version1

integer, parameter version1 = 1
private

grid spec file

Definition at line 148 of file xgrid.F90.

◆ version2

integer, parameter version2 = 2
private

mosaic grid file

Definition at line 149 of file xgrid.F90.

◆ xgrid_clocks_on

logical xgrid_clocks_on = .false.
private

Definition at line 158 of file xgrid.F90.