Grids

ClimaCore.Grids.AbstractGridType
Grids.AbstractGrid

Abstract supertype of grids. Subtypes define the following methods:

  • topology: the topology of the grid.
  • ClimaComms.context and ClimaComms.device (default to those of the topology).
  • Meshes.domain (defaults to that of the topology).
  • local_geometry_data: the DataLayout object containing the local geometry of the grid.
source
ClimaCore.Grids.FiniteDifferenceGridType
FiniteDifferenceGrid(topology::Topologies.IntervalTopology)
FiniteDifferenceGrid(device::ClimaComms.AbstractDevice, mesh::Meshes.IntervalMesh)

Construct a FiniteDifferenceGrid from an IntervalTopology, or from an IntervalMesh and a device.

The grid stores the topology, the global geometry, and the local geometry at cell centers and cell faces.

source
ClimaCore.Grids.ExtrudedFiniteDifferenceGridType
ExtrudedFiniteDifferenceGrid(
    horizontal_grid::AbstractSpectralElementGrid,
    vertical_grid::FiniteDifferenceGrid,
    hypsography::HypsographyAdaption = Flat();
    deep = false,
)

Construct an ExtrudedFiniteDifferenceGrid from the horizontal and vertical grids.

If the horizontal grid has a Geometry.SphericalGlobalGeometry, the extruded grid uses Geometry.DeepSphericalGlobalGeometry when deep = true and Geometry.ShallowSphericalGlobalGeometry otherwise.

source
ClimaCore.Grids.SpectralElementGrid1DType
SpectralElementGrid1D(
    topology::Topologies.IntervalTopology,
    quadrature_style::Quadratures.QuadratureStyle;
    VIJH = DataLayouts.VIJFH,
    discretization = nothing,
)

One-dimensional spectral element grid: within each element the space is represented as a polynomial. VIJH is the DataLayouts.VIJHWithF layout of the local geometry. discretization selects continuous (CG) or discontinuous (DG) Galerkin, and follows the quadrature when omitted; see SpectralElementGrid2D.

source
ClimaCore.Grids.SpectralElementGrid2DType
SpectralElementGrid2D <: AbstractSpectralElementGrid

Two-dimensional spectral element grid: within each element the space is represented as a polynomial. See the constructor for the keyword options.

source
ClimaCore.Grids.MultiPointGridType
MultiPointGrid{C, GG, LG} <: AbstractSpectralElementGrid

Horizontal grid of N arbitrary, disconnected (lat, long) locations on a sphere. There is no connectivity between columns and no spectral element basis, so DSS is not supported. Horizontal spectral-element derivative operators (Gradient, Divergence, Curl, and their weak forms) are accepted and evaluate to zero, as on a single-column FiniteDifferenceSpace.

This is the horizontal component of a multi-column extruded space (N independent columns at user-chosen sphere locations). Construct it with MultiPointGrid(points; radius, device).

Fields

  • context: The ClimaComms.SingletonCommsContext of the grid.
  • global_geometry: The Geometry.SphericalGlobalGeometry of the sphere.
  • local_geometry: A VIJFH{LG, 1, 1, 1, N} data layout, with each of the N locations represented by an element with one nodal point.

Every location has unit horizontal metric terms (∂x∂ξ = I, J = WJ = 1). The sphere radius is only used for the global geometry.

source
ClimaCore.Grids.LevelGridType
LevelGrid(full_grid::AbstractExtrudedFiniteDifferenceGrid, level)

Horizontal grid at a single vertical level of an extruded grid, as returned by level(grid, v): an integer level selects a cell center and a PlusHalf{Int} selects a cell face. It shares the topology, quadrature, DSS weights, and global geometry of full_grid, and its local geometry is the corresponding level of the local geometry of full_grid.

source
ClimaCore.Grids.ColumnIndexType
ColumnIndex(ij, h)

Index into a column of a field. Passing a ColumnIndex to getindex of a Field returns the field restricted to that column.

Fields

  • ij: Tuple of horizontal nodal indices within the element.
  • h: Horizontal element index.

Examples

colidx = ColumnIndex((1, 1), 1)
field[colidx]
source

Accessors

These accept a grid or a space built on it.

ClimaCore.Grids.vertical_topologyFunction
Grids.vertical_topology(grid::AbstractGrid)

Return the Topologies.IntervalTopology of the vertical part of grid: the topology of a finite difference grid, or that of the vertical grid of an extruded grid.

source
ClimaCore.Grids.quadrature_styleFunction
Grids.quadrature_style(grid::AbstractGrid)

Return the Quadratures.QuadratureStyle of the horizontal spectral element part of grid (e.g. Quadratures.GLL{4}()). Throw a MethodError if grid has no such horizontal part.

source
ClimaCore.Grids.global_geometryFunction
Grids.global_geometry(grid::AbstractGrid)

Return the Geometry.AbstractGlobalGeometry of grid, which relates its local coordinates to a global Cartesian frame: Geometry.CartesianGlobalGeometry for planar and interval domains, and a spherical global geometry (carrying the radius) for grids on a sphere.

source
ClimaCore.Grids.local_geometry_dataFunction
Grids.local_geometry_data(
    grid       :: AbstractGrid,
    staggering :: Union{Staggering, Nothing},
)

Return the DataLayout object containing the local geometry of grid at the given staggering.

If the grid is not staggered, staggering is nothing.

source
ClimaCore.Grids.dss_weightsFunction
Grids.dss_weights(grid::AbstractGrid, staggering::Union{Staggering, Nothing})

Return the direct stiffness summation (DSS) weights of grid at the given staggering: a DataLayout of the inverse multiplicity of each node, weighted by the node's metric Jacobian within each element, which Spaces.weighted_dss! applies to average shared nodes across element boundaries. Return nothing for discontinuous (DG) grids. Extruded grids reuse the weights of their horizontal grid. If the grid is not staggered, staggering should be set to nothing.

source
ClimaCore.Grids.set_mask!Function
set_mask!(fn, grid)
set_mask!(grid, data::DataLayouts.DataLayout)

Set the active-node mask of grid. With fn, the mask is fn(coord) evaluated at every coordinate of the horizontal grid; with data, the mask is copied from data. The mask maps are then rebuilt with DataLayouts.set_mask_maps!. Does nothing if the grid mask is a DataLayouts.NoMask.

source

Discretization

The Galerkin discretization of a spectral-element grid is a type parameter of the grid, set with the discretization keyword of the grid and space constructors (Choose CG or DG).

ClimaCore.Grids.DiscretizationType
Discretization

Supertype of the singleton types CG and DG, which distinguish the Galerkin discretization of a spectral-element grid. Select it with the discretization keyword of SpectralElementGrid1D / SpectralElementGrid2D (and the corresponding Spaces constructors); read it back with discretization. Omitting the keyword follows the quadrature: CG() when its nodes are shared across element boundaries (Quadratures.requires_dss, e.g. Quadratures.GLL) and DG() otherwise. Passing CG() explicitly with a quadrature that cannot represent a continuous space (e.g. Quadratures.GL) is an ArgumentError.

source
ClimaCore.Grids.CGType
CG()

The continuous-Galerkin Discretization: functions are single-valued at element boundaries, and element-local weak operators are completed by Spaces.weighted_dss!.

source
ClimaCore.Grids.DGType
DG()

The discontinuous-Galerkin Discretization: functions are element-local (multi-valued at element boundaries), Spaces.weighted_dss! is a no-op, and element coupling enters through interface numerical fluxes (see Operators.add_numerical_flux_interior!).

source
ClimaCore.Grids.discretizationFunction
Grids.discretization(grid)
Spaces.discretization(space)

Return the Discretization of grid (or of the grid of space): CG() or DG(), as given at grid construction. Grids with no horizontal spectral elements are CG(), since every node belongs to one element.

There is no fallback for AbstractGrid: a new grid type needs its own method, so that it cannot silently report a discretization it never chose.

source
ClimaCore.Grids.is_continuousFunction
Grids.is_continuous(grid)
Spaces.is_continuous(space)

Return true if fields on grid (or on the grid of space) are members of the continuous (CG) function space, i.e. Grids.discretization(grid) isa CG. Discontinuous (DG) grids skip Spaces.weighted_dss! and couple elements through numerical fluxes instead.

source

Hypsography

ClimaCore.Grids.hypsographyFunction
Grids.hypsography(grid::AbstractGrid)

Return the HypsographyAdaption of an extruded grid: Flat when the vertical coordinate is not adapted to surface topography, and a terrain-following adaption otherwise. Levels of an extruded grid (Grids.LevelGrid) return the hypsography of their full grid.

source