FMS  2024.03
Flexible Modeling System
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). More...
 
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). More...
 
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). More...
 
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). More...
 
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 More...
 
subroutine, public get_ocean_model_area_elements (domain, grid_file)
 Read Ocean area element data from netCDF file. More...
 
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. More...
 
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. More...
 
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)
 
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. More...
 
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. More...
 
subroutine put_side2_to_xgrid_ug (d, grid_id, x, xmap)
 
subroutine regen (xmap)
 Regenerate/Update the xmap. More...
 
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. More...
 
subroutine, public set_frac_area_ug (f, grid_id, xmap)
 Changes sub-grid portion areas and/or number. More...
 
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. More...
 
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. More...
 
integer function, public xgrid_count (xmap)
 Returns current size of exchange grid variables. More...
 
subroutine, public xgrid_init (remap_method)
 Initialize the xgrid_mod. More...
 

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]

Private 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()
 

◆ 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.

Private 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). More...
 
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). More...
 

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 
)
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.

◆ 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.

Private 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). More...
 
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). More...
 

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 
)
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.

◆ xgrid_mod::get_area_elements

interface xgrid_mod::get_area_elements

Definition at line 496 of file xgrid.F90.

Private Member Functions

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

◆ 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.

Private 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 
)
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_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.

◆ 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.

Private 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)
 

◆ xgrid_mod::get_nest_contact

interface xgrid_mod::get_nest_contact

Definition at line 500 of file xgrid.F90.

Private 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 More...
 

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 
)
private

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]

Private 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()
 

◆ 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]

Private 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

◆ size

integer size
private

xcell patterns

Definition at line 345 of file xgrid.F90.

◆ size_repro

integer size_repro
private

side 1 patterns for repro

Definition at line 347 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]

Private 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
 

◆ 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.

Private Member Functions

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

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 
)
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_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.

◆ 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.

Private 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)
 

◆ 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.

Private Member Functions

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

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 
)
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 set_frac_area_ug ( 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.

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.

Private 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. More...
 
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. More...
 

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 
)
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.

◆ xgrid_mod::stock_move_ug

interface xgrid_mod::stock_move_ug

Definition at line 488 of file xgrid.F90.

Private 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. More...
 

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 
)
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.

◆ 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]

Private 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.
 

◆ 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]

Private Attributes

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

◆ 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]

Private 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.
 

◆ 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]

Private 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
 
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
 

Member Data Documentation

◆ 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
private

of exchange grid cells for get_2_to_xgrid

Definition at line 417 of file xgrid.F90.

◆ size_put1

integer size_put1
private

of exchange grid cells for put_1_to_xgrid

Definition at line 416 of file xgrid.F90.

Function/Subroutine Documentation

◆ conservation_check_side1()

real(r8_kind) function, dimension(3) xgrid_mod::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) xgrid_mod::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) xgrid_mod::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) xgrid_mod::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_nest_contact_fms2_io()

integer function xgrid_mod::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 xgrid_mod::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 xgrid_mod::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_side2_from_xgrid()

subroutine xgrid_mod::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.

◆ grad_merid_latlon()

real(r8_kind) function, dimension(is:ie,js:je) xgrid_mod::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) xgrid_mod::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 xgrid_mod::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 xgrid_mod::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 xgrid_mod::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.

◆ put_side1_to_xgrid()

subroutine xgrid_mod::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_side2_to_xgrid()

subroutine xgrid_mod::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.

◆ regen()

subroutine xgrid_mod::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_frac_area_sg()

subroutine xgrid_mod::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 xgrid_mod::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.

◆ some()

subroutine, public xgrid_mod::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_move_3d()

subroutine xgrid_mod::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.

◆ xgrid_count()

integer function, public xgrid_mod::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_mod::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.