DataLayouts
ClimaCore.DataLayouts — ModuleClimaCore.DataLayoutsDefines the following DataLayouts (see individual docs for more info):
TODO: Add links to these datalayouts
IJKFVHIJFHIJHFIFHIHFDataFIJFIFVFVIJFHVIJHFVIFHVIHFIH1JH2IV1JH2
Notation:
i,jare horizontal node indices within an elementkis the vertical node index within an elementfis the field index (1 if field is scalar, >1 if it is a vector field)vis the vertical element index in a stackhis the element stack index
Data layout is specified by the order in which they appear, e.g. IJKFVH indexes the underlying array as [i,j,k,f,v,h]
Datalayouts that end with the field index
One of the fundamental features of datalayouts is to be able to store multiple variables in the same array, and then access those variables by name. As such, we occasionally must index into multiple variables when performing operations with a datalayout.
We can efficiently support linear indexing with datalayouts whose field index (f) is first or last. This is for the same reason as https://docs.julialang.org/en/v1/devdocs/subarrays/#Linear-indexing:
Linear indexing can be implemented efficiently when the entire array
has a single stride that separates successive elements, starting from
some offset.Therefore, we provide special handling for these datalayouts where possible to leverage efficient linear indexing.
Here are some references containing relevant discussions and efforts to leverage efficient linear indexing:
- https://github.com/CliMA/ClimaCore.jl/issues/1889
- https://github.com/JuliaLang/julia/issues/28126
- https://github.com/JuliaLang/julia/issues/32051
- https://github.com/maleadt/StaticCartesian.jl
- https://github.com/JuliaGPU/GPUArrays.jl/pull/454#issuecomment-1431575721
- https://github.com/JuliaGPU/GPUArrays.jl/pull/520
- https://github.com/JuliaGPU/GPUArrays.jl/pull/464
ClimaCore.DataLayouts.DataF — TypeDataF{S, A} <: Data0D{S}Backing DataLayout for 0D point data.
DataF{S}(ArrayType[, ones | zeros | rand])The ArrayType constructor returns a DataF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand).
ClimaCore.DataLayouts.IF — TypeIF{S, Ni, A} <: DataSlab1D{S, Ni}Backing DataLayout for 1D spectral element slab data.
Nodal element data (I) are contiguous for each S datatype struct field (F) for a single element slab.
A DataSlab1D view can be returned from other Data1D objects by calling slab(data, idx...).
IF{S}(ArrayType[, ones | zeros | rand]; Ni)The keyword constructor returns a IF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Niquadrature degrees of freedom in the horizontal direction
ClimaCore.DataLayouts.IJF — TypeIJF{S, Nij, A} <: DataSlab2D{S, Nij}Backing DataLayout for 2D spectral element slab data.
Nodal element data (I,J) are contiguous for each S datatype struct field (F) for a single element slab.
A DataSlab2D view can be returned from other Data2D objects by calling slab(data, idx...).
IJF{S}(ArrayType[, ones | zeros | rand]; Nij)The keyword constructor returns a IJF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nijquadrature degrees of freedom per horizontal direction
ClimaCore.DataLayouts.VF — TypeVF{S, A} <: DataColumn{S, Nv}Backing DataLayout for 1D FV column data.
Column level data (V) are contiguous for each S datatype struct field (F).
A DataColumn view can be returned from other Data1DX, Data2DX objects by calling column(data, idx...).
VF{S}(ArrayType[, ones | zeros | rand]; Nv)The keyword constructor returns a VF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nvnumber of vertical degrees of freedom
ClimaCore.DataLayouts.IFH — TypeIFH{S,Ni,Nh,A} <: Data1D{S, Ni}
IFH{S,Ni,Nh}(ArrayType)Backing DataLayout for 1D spectral element slabs.
Element nodal point (I) data is contiguous for each datatype S struct field (F), for each 1D mesh element (H).
The ArrayType-constructor makes a IFH 1D Spectral DataLayout given the backing ArrayType, quadrature degrees of freedom Ni, and the number of mesh elements Nh.
IFH{S}(ArrayType[, ones | zeros | rand]; Ni, Nh)The keyword constructor returns a IFH given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Niquadrature degrees of freedom in the horizontal directionNhnumber of mesh elements
ClimaCore.DataLayouts.IJFH — TypeIJFH{S, Nij, A} <: Data2D{S, Nij}
IJFH{S,Nij}(ArrayType, nelements)Backing DataLayout for 2D spectral element slabs.
Element nodal point (I,J) data is contiguous for each datatype S struct field (F), for each 2D mesh element slab (H).
The ArrayType-constructor constructs a IJFH 2D Spectral DataLayout given the backing ArrayType, quadrature degrees of freedom Nij × Nij, and the number of mesh elements nelements.
IJFH{S}(ArrayType[, Base.ones | zeros | rand]; Nij, Nh)The keyword constructor returns a IJFH given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nijquadrature degrees of freedom per horizontal directionNhnumber of mesh elements
ClimaCore.DataLayouts.VIFH — TypeVIFH{S, Nv, Ni, A} <: Data1DX{S, Nv, Ni}Backing DataLayout for 1D spectral element slab + extruded 1D FV column data.
Column levels (V) are contiguous for every element nodal point (I) for each datatype S struct field (F), for each 1D mesh element slab (H).
VIFH{S}(ArrayType[, ones | zeros | rand]; Nv, Ni, Nh)The keyword constructor returns a VIFH given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nvnumber of vertical degrees of freedomNiquadrature degrees of freedom in the horizontal directionNhnumber of horizontal elements
ClimaCore.DataLayouts.VIJFH — TypeVIJFH{S, Nij, A} <: Data2DX{S, Nij}Backing DataLayout for 2D spectral element slab + extruded 1D FV column data.
Column levels (V) are contiguous for every element nodal point (I, J) for each S datatype struct field (F), for each 2D mesh element slab (H).
VIJFH{S}(ArrayType[, ones | zeros | rand]; Nv, Nij, Nh)The keyword constructor returns a VIJFH given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nvnumber of vertical degrees of freedomNijquadrature degrees of freedom per horizontal directionNhnumber of horizontal elements
ClimaCore.DataLayouts.IHF — TypeIHF{S,Ni,Nh,A} <: Data1D{S, Ni}
IHF{S,Ni,Nh}(ArrayType)Backing DataLayout for 1D spectral element slabs.
Element nodal point (I) data is contiguous for each datatype S struct field (F), for each 1D mesh element (H).
The ArrayType-constructor makes a IHF 1D Spectral DataLayout given the backing ArrayType, quadrature degrees of freedom Ni, and the number of mesh elements Nh.
IHF{S}(ArrayType[, ones | zeros | rand]; Ni, Nh)The keyword constructor returns a IHF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Niquadrature degrees of freedom in the horizontal directionNhnumber of mesh elements
ClimaCore.DataLayouts.IJHF — TypeIJHF{S, Nij, A} <: Data2D{S, Nij}
IJHF{S,Nij}(ArrayType, nelements)Backing DataLayout for 2D spectral element slabs.
Element nodal point (I,J) data is contiguous for each datatype S struct field (F), for each 2D mesh element slab (H).
The ArrayType-constructor constructs a IJHF 2D Spectral DataLayout given the backing ArrayType, quadrature degrees of freedom Nij × Nij, and the number of mesh elements nelements.
IJHF{S}(ArrayType[, Base.ones | zeros | rand]; Nij, Nh)The keyword constructor returns a IJHF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nijquadrature degrees of freedom per horizontal directionNhnumber of mesh elements
ClimaCore.DataLayouts.VIHF — TypeVIHF{S, Nv, Ni, A} <: Data1DX{S, Nv, Ni}Backing DataLayout for 1D spectral element slab + extruded 1D FV column data.
Column levels (V) are contiguous for every element nodal point (I) for each datatype S struct field (F), for each 1D mesh element slab (H).
VIHF{S}(ArrayType[, ones | zeros | rand]; Nv, Ni, Nh)The keyword constructor returns a VIHF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nvnumber of vertical degrees of freedomNiquadrature degrees of freedom in the horizontal directionNhnumber of horizontal elements
ClimaCore.DataLayouts.VIJHF — TypeVIJHF{S, Nij, A} <: Data2DX{S, Nij}Backing DataLayout for 2D spectral element slab + extruded 1D FV column data.
Column levels (V) are contiguous for every element nodal point (I, J) for each S datatype struct field (F), for each 2D mesh element slab (H).
VIJHF{S}(ArrayType[, ones | zeros | rand]; Nv, Nij, Nh)The keyword constructor returns a VIJHF given the ArrayType and (optionally) an initialization method (one of Base.ones, Base.zeros, Random.rand) and the keywords:
Nvnumber of vertical degrees of freedomNijquadrature degrees of freedom per horizontal directionNhnumber of horizontal elements