cable_netcdf_decomp_util_mod Module

Utilities for generating parallel I/O decompositions for grids used by CABLE.

Parallel I/O decompositions describe the mapping from the local in-memory layout of an array on the current process to the global layout of a netCDF variable on disk. For example, a common I/O decomposition in cable is the mapping of a 1-dimensional array of size mp to a netCDF variable with dimensions (x, y, patch) where x and y are the spatial coordinates of the land point corresponding to the patch index, and patch is the relative patch index on that land point. Please see the documentation of the individual decomposition generating functions in this module for more details on the specific mappings they generate.



Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: INDEX_NOT_FOUND = -1

Functions

private function patch_land_index(cstart, nap, patch_index)

Returns the land index corresponding to the given patch index, using cstart and nap to determine the mapping. If the patch index does not lie on any land point, the function aborts.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: cstart(:)

The starting patch index for each land point.

integer, intent(in) :: nap(:)

The number of active patches for each land point.

integer, intent(in) :: patch_index

The patch index to map to a land index.

Return Value integer

public function io_decomp_land_to_x_y(land_x, land_y, mem_shape, var_shape, type, var_x_index, var_y_index, index_map) result(decomp)

Returns a parallel I/O decomposition mapping from a memory layout with a 'land' dimension to a netCDF variable layout with 'x' and 'y' dimensions.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: land_x(:)

An array mapping land indexes to x (longitude) indexes.

integer, intent(in) :: land_y(:)

An array mapping land indexes to y (latitude) indexes.

integer, intent(in) :: mem_shape(:)

The shape of the in-memory array.

integer, intent(in) :: var_shape(:)

The shape of the netCDF variable.

integer, intent(in) :: type

The data type of the variable for which the decomposition is being created using CABLE_NETCDF_TYPE_* constants from cable_netcdf_mod.

integer, intent(in), optional :: var_x_index

The index of the 'x' dimension in var_shape. Defaults to 1 if not provided.

integer, intent(in), optional :: var_y_index

The index of the 'y' dimension in var_shape. Defaults to 2 if not provided.

integer, intent(in), optional :: index_map(:)

An optional mapping from the dimension indexes of var_shape to the dimension indexes of mem_shape. If not provided, it is assumed that the dimensions of var_shape map to the dimensions of mem_shape in order, with var_x_index and var_y_index indexes mapped to the first index of mem_shape.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_patch_to_x_y_patch(land_x, land_y, cstart, nap, mem_shape, var_shape, type, var_x_index, var_y_index, var_patch_index, index_map) result(decomp)

Returns a parallel I/O decomposition mapping from a memory layout with a 'patch' dimension to a netCDF variable layout with 'x', 'y', and 'patch' dimensions.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: land_x(:)

An array mapping land indexes to x (longitude) indexes.

integer, intent(in) :: land_y(:)

An array mapping land indexes to y (latitude) indexes.

integer, intent(in) :: cstart(:)

The starting patch index for each land point.

integer, intent(in) :: nap(:)

The number of active patches for each land point.

integer, intent(in) :: mem_shape(:)

The shape of the in-memory array.

integer, intent(in) :: var_shape(:)

The shape of the netCDF variable.

integer, intent(in) :: type

The data type of the variable for which the decomposition is being created using CABLE_NETCDF_TYPE_* constants from cable_netcdf_mod.

integer, intent(in), optional :: var_x_index

The index of the 'x' dimension in var_shape. Defaults to 1 if not provided.

integer, intent(in), optional :: var_y_index

The index of the 'y' dimension in var_shape. Defaults to 2 if not provided.

integer, intent(in), optional :: var_patch_index

The index of the 'patch' dimension in var_shape. Defaults to 3 if not provided.

integer, intent(in), optional :: index_map(:)

An optional mapping from the dimension indexes of var_shape to the dimension indexes of mem_shape. If not provided, it is assumed that the dimensions of var_shape map to the dimensions of mem_shape in order, with var_x_index, var_y_index and var_patch_index being mapped to the first index of mem_shape.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_land_to_land(land_decomp_start, mem_shape, var_shape, type, var_land_index, index_map) result(decomp)

Returns a parallel I/O decomposition mapping from a memory layout with a local 'land' dimension to a netCDF variable layout with a global 'land' dimension.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: land_decomp_start

The starting index of the first local 'land' index along the global 'land' dimension.

integer, intent(in) :: mem_shape(:)

The shape of the in-memory array.

integer, intent(in) :: var_shape(:)

The shape of the netCDF variable.

integer, intent(in) :: type

The data type of the variable for which the decomposition is being created using CABLE_NETCDF_TYPE_* constants from cable_netcdf_mod.

integer, intent(in), optional :: var_land_index

The index of the 'land' dimension in var_shape. Defaults to 1 if not provided.

integer, intent(in), optional :: index_map(:)

An optional mapping from the dimension indexes of var_shape to the dimension indexes of mem_shape. If not provided, it is assumed that the dimensions of var_shape map to the dimensions of mem_shape in order.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_patch_to_land_patch(land_decomp_start, cstart, nap, mem_shape, var_shape, type, var_land_index, var_patch_index, index_map) result(decomp)

Returns a parallel I/O decomposition mapping from a memory layout with a 'patch' dimension to a netCDF variable layout with a 'land' and 'patch' dimension.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: land_decomp_start

The starting index of the first local 'land' index along the global 'land' dimension.

integer, intent(in) :: cstart(:)

The starting patch index for each land point.

integer, intent(in) :: nap(:)

The number of active patches for each land point.

integer, intent(in) :: mem_shape(:)

The shape of the in-memory array.

integer, intent(in) :: var_shape(:)

The shape of the netCDF variable.

integer, intent(in) :: type

The data type of the variable for which the decomposition is being created using CABLE_NETCDF_TYPE_* constants from cable_netcdf_mod.

integer, intent(in), optional :: var_land_index

The index of the 'land' dimension in var_shape. Defaults to 1 if not provided.

integer, intent(in), optional :: var_patch_index

The index of the 'patch' dimension in var_shape. Defaults to 2 if not provided.

integer, intent(in), optional :: index_map(:)

An optional mapping from the dimension indexes of var_shape to the dimension indexes of mem_shape. If not provided, it is assumed that the dimensions of var_shape map to the dimensions of mem_shape in order, with var_land_index and var_patch_index being mapped to the first index of mem_shape.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_patch_to_patch(patch_decomp_start, mem_shape, var_shape, type, var_patch_index, index_map) result(decomp)

Returns a parallel I/O decomposition mapping from a memory layout with a local 'patch' dimension to a netCDF variable layout with a global 'patch' dimension.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: patch_decomp_start

The starting index of the first local 'patch' index along the global 'patch' dimension.

integer, intent(in) :: mem_shape(:)

The shape of the in-memory array.

integer, intent(in) :: var_shape(:)

The shape of the netCDF variable.

integer, intent(in) :: type

The data type of the variable for which the decomposition is being created using CABLE_NETCDF_TYPE_* constants from cable_netcdf_mod.

integer, intent(in), optional :: var_patch_index
integer, intent(in), optional :: index_map(:)

An optional mapping from the dimension indexes of var_shape to the dimension indexes of mem_shape. If not provided, it is assumed that the dimensions of var_shape map to the dimensions of mem_shape in order.

Return Value class(cable_netcdf_decomp_t), allocatable