Grids
ClimaCore.Grids.AbstractGrid — Type
Grids.AbstractGridAbstract supertype of grids. Subtypes define the following methods:
topology: the topology of the grid.ClimaComms.contextandClimaComms.device(default to those of the topology).Meshes.domain(defaults to that of the topology).local_geometry_data: theDataLayoutobject containing the local geometry of the grid.
ClimaCore.Grids.CellFace — Type
CellFace()Cell-face staggering location.
ClimaCore.Grids.CellCenter — Type
CellCenter()Cell-center staggering location.
ClimaCore.Grids.ColumnGrid — Type
ColumnGrid(full_grid, indices)View of the column at indices of the extruded grid full_grid.
ClimaCore.Grids.FiniteDifferenceGrid — Type
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.
ClimaCore.Grids.ExtrudedFiniteDifferenceGrid — Type
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.
ClimaCore.Grids.SpectralElementGrid1D — Type
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.
ClimaCore.Grids.SpectralElementGrid2D — Type
SpectralElementGrid2D <: AbstractSpectralElementGridTwo-dimensional spectral element grid: within each element the space is represented as a polynomial. See the constructor for the keyword options.
ClimaCore.Grids.MultiPointGrid — Type
MultiPointGrid{C, GG, LG} <: AbstractSpectralElementGridHorizontal 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: TheClimaComms.SingletonCommsContextof the grid.global_geometry: TheGeometry.SphericalGlobalGeometryof the sphere.local_geometry: AVIJFH{LG, 1, 1, 1, N}data layout, with each of theNlocations 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.
ClimaCore.Grids.LevelGrid — Type
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.
ClimaCore.Grids.ColumnIndex — Type
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]Accessors
These accept a grid or a space built on it.
ClimaCore.Grids.topology — Function
Grids.topology(grid::AbstractGrid)Return the topology of grid.
ClimaCore.Grids.vertical_topology — Function
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.
ClimaCore.Grids.quadrature_style — Function
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.
ClimaCore.Grids.global_geometry — Function
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.
ClimaCore.Grids.local_geometry_data — Function
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.
ClimaCore.Grids.dss_weights — Function
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.
ClimaCore.Grids.get_mask — Function
get_mask(grid::AbstractGrid)Return the mask of grid; DataLayouts.NoMask() for grids without a mask.
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.
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.Discretization — Type
DiscretizationSupertype 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.
ClimaCore.Grids.CG — Type
CG()The continuous-Galerkin Discretization: functions are single-valued at element boundaries, and element-local weak operators are completed by Spaces.weighted_dss!.
ClimaCore.Grids.DG — Type
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!).
ClimaCore.Grids.discretization — Function
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.
ClimaCore.Grids.is_continuous — Function
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.
Hypsography
ClimaCore.Grids.Flat — Type
Flat()No surface hypsography.
ClimaCore.Grids.hypsography — Function
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.