cable_netcdf_decomp_util_mod Module

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



Variables

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

Derived Types

type, public ::  dim_spec_t

A derived type which associates a name with a dimension. The name component can be used to identify a dimension which is used for mapping a dimension in the in-memory array to one or more dimensions in the netCDF variable data. For example, the patch dimension which ranges from 1 to mp can be mapped to a (land, patch) coordinate which ranges from (1, 1) to (mland_global, max_veg_patches).

Components

Type Visibility Attributes Name Initial
character(len=64), public :: name

The name of the dimension.

integer, public :: size

The size of the dimension.


Functions

private function subscript(shape_spec, name)

Returns the subscript of the dimension matching name in the shape_spec array. If no such dimension exists, the function aborts.

Arguments

Type IntentOptional Attributes Name
type(dim_spec_t), intent(in) :: shape_spec(:)

The shape_spec array to search for the name.

character(len=*), intent(in) :: name

The name of the dimension to find the subscript of.

Return Value integer

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_spec, var_shape_spec, type) 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, using the provided land_x and land_y arrays to determine the mapping from land indexes to x and y indexes.

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.

type(dim_spec_t), intent(in) :: mem_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the in-memory array. mem_shape_spec must include a dimension with name 'land' which is used to map to the x and y dimensions.

type(dim_spec_t), intent(in) :: var_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the netCDF variable. var_shape_spec must include dimensions with names x and y which are used to map from the 'land' dimension described by mem_shape_spec.

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.

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_spec, var_shape_spec, type) 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, using the provided land_x and land_y arrays to determine the mapping from land indexes to x and y indexes, and using cstart and nap to determine the mapping from patch indexes to (land, patch) coordinates.

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.

type(dim_spec_t), intent(in) :: mem_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the in-memory array. mem_shape_spec must include a dimension with name 'patch' which is used to map to the x, y and patch dimensions.

type(dim_spec_t), intent(in) :: var_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the netCDF variable. var_shape_spec must include dimensions with names x, y and patch which are used to map from the 'land' dimension described by mem_shape_spec.

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.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_land_to_land(land_decomp_start, mem_shape_spec, var_shape_spec, type) 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 global 'land' dimension.

type(dim_spec_t), intent(in) :: mem_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the in-memory array. mem_shape_spec must include a dimension with name 'land' which is used to map to the global land dimension.

type(dim_spec_t), intent(in) :: var_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the netCDF variable. var_shape_spec must include a dimension with name land which is used to map from the 'land' dimension described by mem_shape_spec.

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.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_patch_to_land_patch(land_decomp_start, cstart, nap, mem_shape_spec, var_shape_spec, type) 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 'land' dimension and a '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 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.

type(dim_spec_t), intent(in) :: mem_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the in-memory array. mem_shape_spec must include a dimension with name 'patch' which is used to map to the global land and patch dimensions.

type(dim_spec_t), intent(in) :: var_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the netCDF variable. var_shape_spec must include dimensions with names land and patch which are used to map from the 'patch' dimension described by mem_shape_spec.

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.

Return Value class(cable_netcdf_decomp_t), allocatable

public function io_decomp_patch_to_patch(patch_decomp_start, mem_shape_spec, var_shape_spec, type) 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.

Read more…

Arguments

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

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

type(dim_spec_t), intent(in) :: mem_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the in-memory array. mem_shape_spec must include a dimension with name 'patch' which is used to map to the global patch dimensions.

type(dim_spec_t), intent(in) :: var_shape_spec(:)

An array of dim_spec_t describing the shape and dimension names of the netCDF variable. var_shape_spec must include a dimension with name patch which is used to map from the local 'patch' dimension described by mem_shape_spec.

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.

Return Value class(cable_netcdf_decomp_t), allocatable