CommonSpaces
ClimaCore.CommonSpaces — ModuleCommonSpacesCommonSpaces contains convenience constructors for common spaces, which builds off of CommonGrids and(when appropriate) requires an additional argument, staggering::Staggering to construct the desired space.
ClimaCore.CommonSpaces.ExtrudedCubedSphereSpace — FunctionExtrudedCubedSphereSpace(
::Type{<:AbstractFloat}; # defaults to Float64
z_elem::Integer,
z_min::Real,
z_max::Real,
radius::Real,
h_elem::Integer,
n_quad_points::Integer,
device::ClimaComms.AbstractDevice = ClimaComms.device(),
context::ClimaComms.AbstractCommsContext = ClimaComms.context(device),
stretch::Meshes.StretchingRule = Meshes.Uniform(),
hypsography_fun = (h_grid, z_grid) -> Grids.Flat(),
global_geometry::Geometry.AbstractGlobalGeometry = Geometry.ShallowSphericalGlobalGeometry{FT}(radius),
quad::Quadratures.QuadratureStyle = Quadratures.GLL{n_quad_points}(),
h_mesh = Meshes.EquiangularCubedSphere(Domains.SphereDomain{FT}(radius), h_elem),
h_topology::Topologies.AbstractDistributedTopology = Topologies.Topology2D(context, h_mesh),
horizontal_layout_type = DataLayouts.IJFH,
z_mesh::Meshes.IntervalMesh = DefaultZMesh(FT; z_min, z_max, z_elem, stretch),
enable_bubble::Bool = false
staggering::Staggering,
)Construct an Spaces.ExtrudedFiniteDifferenceSpace for a cubed sphere configuration, given:
FTthe floating-point type (defaults toFloat64) [Float32,Float64]z_elemthe number of z-pointsz_minthe domain minimum along the z-direction.z_maxthe domain maximum along the z-direction.radiusthe radius of the cubed sphereh_elemthe number of horizontal elements per side of every panel (6 panels in total)n_quad_pointsthe number of quadrature points per horizontal elementdevicetheClimaComms.devicecontexttheClimaComms.contextstretchthe meshMeshes.StretchingRule(defaults toMeshes.Uniform)hypsography_funa function or callable object (hypsography_fun(h_grid, z_grid) -> hypsography) for constructing the hypsography model.global_geometrythe global geometry (defaults toGeometry.CartesianGlobalGeometry)quadthe quadrature style (defaults toQuadratures.GLL{n_quad_points})h_meshthe horizontal mesh (defaults toMeshes.EquiangularCubedSphere)h_topologythe horizontal topology (defaults toTopologies.Topology2D)horizontal_layout_typethe horizontal DataLayout type (defaults toDataLayouts.IJFH). This parameter describes how data is arranged in memory. SeeGrids.SpectralElementGrid2Dfor its use.z_meshthe vertical mesh, defaults to anMeshes.IntervalMeshalongzwith givenstretchenable_bubbleenables the "bubble correction" for more accurate element areas when computing the spectral element space. SeeGrids.SpectralElementGrid2Dfor more information.staggeringvertical staggering, can be one of [Grids.CellFace,Grids.CellCenter]
Note that these arguments are all the same as CommonGrids.ExtrudedCubedSphereGrid, except for staggering.
Example usage
using ClimaCore.CommonSpaces
space = ExtrudedCubedSphereSpace(;
z_elem = 10,
z_min = 0,
z_max = 1,
radius = 10,
h_elem = 10,
n_quad_points = 4,
staggering = CellCenter()
)This will construct a cell-center space. If you wish to create a face centered space:
using ClimaCore.CommonSpaces
space = ExtrudedCubedSphereSpace(;
z_elem = 10,
z_min = 0,
z_max = 1,
radius = 10,
h_elem = 10,
n_quad_points = 4,
staggering = CellFace()
)alternatively, you can use the Spaces.face_space function.
ClimaCore.CommonSpaces.CubedSphereSpace — FunctionCubedSphereSpace(
::Type{<:AbstractFloat}; # defaults to Float64
radius::Real,
h_elem::Integer,
n_quad_points::Integer,
device::ClimaComms.AbstractDevice = ClimaComms.device(),
context::ClimaComms.AbstractCommsContext = ClimaComms.context(device),
quad::Quadratures.QuadratureStyle = Quadratures.GLL{n_quad_points}(),
h_mesh = Meshes.EquiangularCubedSphere(Domains.SphereDomain{FT}(radius), h_elem),
h_topology::Topologies.AbstractDistributedTopology = Topologies.Topology2D(context, h_mesh),
horizontal_layout_type = DataLayouts.IJFH,
)Construct a Spaces.SpectralElementSpace2D for a cubed sphere configuration, given:
FTthe floating-point type (defaults toFloat64) [Float32,Float64]radiusthe radius of the cubed sphereh_elemthe number of horizontal elements per side of every panel (6 panels in total)n_quad_pointsthe number of quadrature points per horizontal elementdevicetheClimaComms.devicecontexttheClimaComms.contextquadthe quadrature style (defaults toQuadratures.GLL{n_quad_points})h_meshthe horizontal mesh (defaults toMeshes.EquiangularCubedSphere)h_topologythe horizontal topology (defaults toTopologies.Topology2D)horizontal_layout_typethe horizontal DataLayout type (defaults toDataLayouts.IJFH). This parameter describes how data is arranged in memory. SeeGrids.SpectralElementGrid2Dfor its use.
Note that these arguments are all the same as CommonGrids.CubedSphereGrid.
Example usage
using ClimaCore.CommonSpaces
space = CubedSphereSpace(;
radius = 10,
n_quad_points = 4,
h_elem = 10,
)ClimaCore.CommonSpaces.ColumnSpace — FunctionColumnSpace(
::Type{<:AbstractFloat}; # defaults to Float64
z_elem::Integer,
z_min::Real,
z_max::Real,
device::ClimaComms.AbstractDevice = ClimaComms.device(),
context::ClimaComms.AbstractCommsContext = ClimaComms.context(device),
stretch::Meshes.StretchingRule = Meshes.Uniform(),
z_mesh::Meshes.IntervalMesh = DefaultZMesh(FT; z_min, z_max, z_elem, stretch),
)Construct a 1D Spaces.FiniteDifferenceSpace for a column configuration, given:
FTthe floating-point type (defaults toFloat64) [Float32,Float64]z_elemthe number of z-pointsz_minthe domain minimum along the z-direction.z_maxthe domain maximum along the z-direction.devicetheClimaComms.devicecontexttheClimaComms.contextstretchthe meshMeshes.StretchingRule(defaults toMeshes.Uniform)z_meshthe vertical mesh, defaults to anMeshes.IntervalMeshalongzwith givenstretchstaggeringvertical staggering, can be one of [Grids.CellFace,Grids.CellCenter]
Note that these arguments are all the same as CommonGrids.ColumnGrid, except for staggering.
Example usage
using ClimaCore.CommonSpaces
space = ColumnSpace(;
z_elem = 10,
z_min = 0,
z_max = 10,
staggering = CellCenter()
)ClimaCore.CommonSpaces.Box3DSpace — FunctionBox3DSpace(
::Type{<:AbstractFloat}; # defaults to Float64
z_elem::Integer,
x_min::Real,
x_max::Real,
y_min::Real,
y_max::Real,
z_min::Real,
z_max::Real,
periodic_x::Bool,
periodic_y::Bool,
n_quad_points::Integer,
x_elem::Integer,
y_elem::Integer,
device::ClimaComms.AbstractDevice = ClimaComms.device(),
context::ClimaComms.AbstractCommsContext = ClimaComms.context(device),
stretch::Meshes.StretchingRule = Meshes.Uniform(),
hypsography_fun = (h_grid, z_grid) -> Grids.Flat(),
global_geometry::Geometry.AbstractGlobalGeometry = Geometry.CartesianGlobalGeometry(),
quad::Quadratures.QuadratureStyle = Quadratures.GLL{n_quad_points}(),
horizontal_layout_type = DataLayouts.IJFH,
[h_topology::Topologies.AbstractDistributedTopology], # optional
[z_mesh::Meshes.IntervalMesh], # optional
enable_bubble::Bool = false,
staggering::Staggering
)Construct a Spaces.ExtrudedFiniteDifferenceSpace for a 3D box configuration, given:
z_elemthe number of z-pointsx_minthe domain minimum along the x-direction.x_maxthe domain maximum along the x-direction.y_minthe domain minimum along the y-direction.y_maxthe domain maximum along the y-direction.z_minthe domain minimum along the z-direction.z_maxthe domain maximum along the z-direction.periodic_xBool indicating to use periodic domain along x-directionperiodic_yBool indicating to use periodic domain along y-directionn_quad_pointsthe number of quadrature points per horizontal elementx_elemthe number of x-pointsy_elemthe number of y-pointsdevicetheClimaComms.devicecontexttheClimaComms.contextstretchthe meshMeshes.StretchingRule(defaults toMeshes.Uniform)hypsography_funa function or callable object (hypsography_fun(h_grid, z_grid) -> hypsography) for constructing the hypsography model.global_geometrythe global geometry (defaults toGeometry.CartesianGlobalGeometry)quadthe quadrature style (defaults toQuadratures.GLL{n_quad_points})h_topologythe horizontal topology (defaults toTopologies.Topology2D)z_meshthe vertical mesh, defaults to anMeshes.IntervalMeshalongzwith givenstretchenable_bubbleenables the "bubble correction" for more accurate element areas when computing the spectral element space. SeeGrids.SpectralElementGrid2Dfor more information.horizontal_layout_typethe horizontal DataLayout type (defaults toDataLayouts.IJFH). This parameter describes how data is arranged in memory. SeeGrids.SpectralElementGrid2Dfor its use.staggeringvertical staggering, can be one of [Grids.CellFace,Grids.CellCenter]
Note that these arguments are all the same as CommonGrids.Box3DGrid, except for staggering.
Example usage
using ClimaCore.CommonSpaces
space = Box3DSpace(;
z_elem = 10,
x_min = 0,
x_max = 1,
y_min = 0,
y_max = 1,
z_min = 0,
z_max = 10,
periodic_x = false,
periodic_y = false,
n_quad_points = 4,
x_elem = 3,
y_elem = 4,
staggering = CellCenter()
)ClimaCore.CommonSpaces.SliceXZSpace — FunctionSliceXZSpace(
::Type{<:AbstractFloat}; # defaults to Float64
z_elem::Integer,
x_min::Real,
x_max::Real,
z_min::Real,
z_max::Real,
periodic_x::Bool,
n_quad_points::Integer,
x_elem::Integer,
device::ClimaComms.AbstractDevice = ClimaComms.device(),
context::ClimaComms.AbstractCommsContext = ClimaComms.context(device),
stretch::Meshes.StretchingRule = Meshes.Uniform(),
hypsography_fun = (h_grid, z_grid) -> Grids.Flat(),
global_geometry::Geometry.AbstractGlobalGeometry = Geometry.CartesianGlobalGeometry(),
quad::Quadratures.QuadratureStyle = Quadratures.GLL{n_quad_points}(),
staggering::Staggering
)Construct a Spaces.ExtrudedFiniteDifferenceSpace for a 2D slice configuration, given:
FTthe floating-point type (defaults toFloat64) [Float32,Float64]z_elemthe number of z-pointsx_minthe domain minimum along the x-direction.x_maxthe domain maximum along the x-direction.z_minthe domain minimum along the z-direction.z_maxthe domain maximum along the z-direction.periodic_xBool indicating to use periodic domain along x-directionn_quad_pointsthe number of quadrature points per horizontal elementx_elemthe number of x-pointsdevicetheClimaComms.devicecontexttheClimaComms.contextstretchthe meshMeshes.StretchingRule(defaults toMeshes.Uniform)hypsography_funa function or callable object (hypsography_fun(h_grid, z_grid) -> hypsography) for constructing the hypsography model.global_geometrythe global geometry (defaults toGeometry.CartesianGlobalGeometry)quadthe quadrature style (defaults toQuadratures.GLL{n_quad_points})staggeringvertical staggering, can be one of [Grids.CellFace,Grids.CellCenter]
Note that these arguments are all the same as CommonGrids.SliceXZGrid, except for staggering.
Example usage
using ClimaCore.CommonSpaces
space = SliceXZSpace(;
z_elem = 10,
x_min = 0,
x_max = 1,
z_min = 0,
z_max = 1,
periodic_x = false,
n_quad_points = 4,
x_elem = 4,
staggering = CellCenter()
)ClimaCore.CommonSpaces.RectangleXYSpace — FunctionRectangleXYSpace(
::Type{<:AbstractFloat}; # defaults to Float64
x_min::Real,
x_max::Real,
y_min::Real,
y_max::Real,
periodic_x::Bool,
periodic_y::Bool,
n_quad_points::Integer,
x_elem::Integer, # number of horizontal elements
y_elem::Integer, # number of horizontal elements
device::ClimaComms.AbstractDevice = ClimaComms.device(),
context::ClimaComms.AbstractCommsContext = ClimaComms.context(device),
hypsography::Grids.HypsographyAdaption = Grids.Flat(),
global_geometry::Geometry.AbstractGlobalGeometry = Geometry.CartesianGlobalGeometry(),
quad::Quadratures.QuadratureStyle = Quadratures.GLL{n_quad_points}(),
)Construct a Spaces.SpectralElementSpace2D space for a 2D rectangular configuration, given:
x_minthe domain minimum along the x-direction.x_maxthe domain maximum along the x-direction.y_minthe domain minimum along the y-direction.y_maxthe domain maximum along the y-direction.periodic_xBool indicating to use periodic domain along x-directionperiodic_yBool indicating to use periodic domain along y-directionn_quad_pointsthe number of quadrature points per horizontal elementx_elemthe number of x-pointsy_elemthe number of y-pointsdevicetheClimaComms.devicecontexttheClimaComms.contexthypsography_funa function or callable object (hypsography_fun(h_grid, z_grid) -> hypsography) for constructing the hypsography model.global_geometrythe global geometry (defaults toGeometry.CartesianGlobalGeometry)quadthe quadrature style (defaults toQuadratures.GLL{n_quad_points})
Example usage
using ClimaCore.CommonSpaces
space = RectangleXYSpace(;
x_min = 0,
x_max = 1,
y_min = 0,
y_max = 1,
periodic_x = false,
periodic_y = false,
n_quad_points = 4,
x_elem = 3,
y_elem = 4,
)