diff --git a/NEWS.md b/NEWS.md index d490f0cb91..c886128214 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ ClimaCore.jl Release Notes Main ------- +- ![][badge-šŸ’„breaking] support for many deprecated methods have been dropped PR [#1632](https://github.com/CliMA/ClimaCore.jl/pull/1632). - ![][badge-šŸ¤–precisionĪ”]![][badge-šŸš€performance] Slight performance improvement by replacing `rdiv` with `rmul`. PR ([#1496](https://github.com/CliMA/ClimaCore.jl/pull/1496)) Machine-precision differences are expected. v0.12.1 diff --git a/benchmarks/3d/se_kernels.jl b/benchmarks/3d/se_kernels.jl index c384be4efe..4e8a613981 100644 --- a/benchmarks/3d/se_kernels.jl +++ b/benchmarks/3d/se_kernels.jl @@ -81,7 +81,7 @@ function initialize_mwe(device, ::Type{FT}) where {FT} z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_mesh = Meshes.IntervalMesh(z_domain, nelems = z_elem) z_topology = Topologies.IntervalTopology(context, z_mesh) diff --git a/benchmarks/3d/vector_laplacian.jl b/benchmarks/3d/vector_laplacian.jl index 6018466936..0ebe5adcc0 100644 --- a/benchmarks/3d/vector_laplacian.jl +++ b/benchmarks/3d/vector_laplacian.jl @@ -11,21 +11,19 @@ using ClimaCore: Quadratures using CUDA, BenchmarkTools +context = ClimaComms.context() hdomain = Domains.SphereDomain(6.37122e6) hmesh = Meshes.EquiangularCubedSphere(hdomain, 30) -htopology = Topologies.Topology2D(hmesh) +htopology = Topologies.Topology2D(context, hmesh) hspace = Spaces.SpectralElementSpace2D(htopology, Quadratures.GLL{4}()) vdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(10e3); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain; nelems = 45) -vtopology = Topologies.IntervalTopology( - ClimaComms.SingletonCommsContext(ClimaComms.device()), - vmesh, -) +vtopology = Topologies.IntervalTopology(context, vmesh) vspace = Spaces.CenterFiniteDifferenceSpace(vtopology) cspace = Spaces.ExtrudedFiniteDifferenceSpace(hspace, vspace) diff --git a/benchmarks/bickleyjet/core_vs_ref.jl b/benchmarks/bickleyjet/core_vs_ref.jl index b6e8bb4745..3c84bbdf68 100644 --- a/benchmarks/bickleyjet/core_vs_ref.jl +++ b/benchmarks/bickleyjet/core_vs_ref.jl @@ -30,7 +30,8 @@ for Nq in Nqs volume!(dydt, y0, (parameters,), 0.0) # TODO: move this to volume! dydt_data = Fields.field_values(dydt) - dydt_data .= RecursiveApply.rdiv.(dydt_data, space.local_geometry.WJ) + dydt_data .= + RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ) # setup reference X = coordinates(Val(Nq), n1, n2) @@ -83,7 +84,8 @@ for Nq in Nqs add_face!(dydt, y0, (parameters,), 0.0) # TODO: move this to volume! dydt_data = Fields.field_values(dydt) - dydt_data .= RecursiveApply.rdiv.(dydt_data, space.local_geometry.WJ) + dydt_data .= + RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ) fill!(dydt_ref, 0.0) add_face_ref!(dydt_ref, y0_ref, (n1, n2, parameters, Val(Nq)), 0.0) diff --git a/docs/src/lib/ClimaCoreTempestRemap.md b/docs/src/lib/ClimaCoreTempestRemap.md index 88399fc6bb..f3820cc266 100644 --- a/docs/src/lib/ClimaCoreTempestRemap.md +++ b/docs/src/lib/ClimaCoreTempestRemap.md @@ -95,7 +95,7 @@ end # write out our cubed sphere mesh meshfile_cc = "mesh_cubedsphere.g" -write_exodus(meshfile_cc, Spaces.horizontal_space(cspace).topology) +write_exodus(meshfile_cc, Spaces.topology(Spaces.horizontal_space(cspace))) # write out RLL mesh nlat = 90 diff --git a/docs/tutorials/introduction.jl b/docs/tutorials/introduction.jl index 411166908d..f2164fcfce 100644 --- a/docs/tutorials/introduction.jl +++ b/docs/tutorials/introduction.jl @@ -27,7 +27,7 @@ using ClimaComms, column_domain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.ZPoint(0.0) .. ClimaCore.Geometry.ZPoint(10.0), - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) #---------------------------------------------------------------------------- diff --git a/examples/bickleyjet/bickleyjet_dg.jl b/examples/bickleyjet/bickleyjet_dg.jl index e5e80436e5..3e7978ff30 100644 --- a/examples/bickleyjet/bickleyjet_dg.jl +++ b/examples/bickleyjet/bickleyjet_dg.jl @@ -206,7 +206,8 @@ function rhs!(dydt, y, (parameters, numflux), t) # 6. Solve for final result dydt_data = Fields.field_values(dydt) - dydt_data .= RecursiveApply.rdiv.(dydt_data, space.local_geometry.WJ) + dydt_data .= + RecursiveApply.rdiv.(dydt_data, Spaces.local_geometry_data(space).WJ) M = Quadratures.cutoff_filter_matrix( Float64, Spaces.quadrature_style(space), diff --git a/examples/common_spaces.jl b/examples/common_spaces.jl index 81a93ca4ef..c20786224b 100644 --- a/examples/common_spaces.jl +++ b/examples/common_spaces.jl @@ -66,7 +66,7 @@ function make_hybrid_spaces(h_space, z_max, z_elem; z_stretch) z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_mesh = Meshes.IntervalMesh(z_domain, z_stretch; nelems = z_elem) z_topology = Topologies.IntervalTopology(z_mesh) diff --git a/examples/hybrid/box/bubble_3d_invariant_rhoe.jl b/examples/hybrid/box/bubble_3d_invariant_rhoe.jl index 8559239df1..0ff941e476 100644 --- a/examples/hybrid/box/bubble_3d_invariant_rhoe.jl +++ b/examples/hybrid/box/bubble_3d_invariant_rhoe.jl @@ -133,7 +133,7 @@ function hvspace_3D( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) verttopo = Topologies.IntervalTopology( diff --git a/examples/hybrid/plane/isothermal_channel.jl b/examples/hybrid/plane/isothermal_channel.jl index 5c987c37cf..d7d8106f2e 100644 --- a/examples/hybrid/plane/isothermal_channel.jl +++ b/examples/hybrid/plane/isothermal_channel.jl @@ -55,7 +55,7 @@ function hvspace_2D( horztopology = Topologies.IntervalTopology(horzmesh) quad = Quadratures.GLL{npoly + 1}() horzspace = Spaces.SpectralElementSpace1D(horztopology, quad) - z_surface = warp_fn.(Fields.coordinate_field(horzspace)) + z_surface = Geometry.ZPoint.(warp_fn.(Fields.coordinate_field(horzspace))) hv_face_space = Spaces.ExtrudedFiniteDifferenceSpace( horzspace, vert_face_space, diff --git a/examples/hybrid/sphere/nonhydrostatic_gravity_wave.jl b/examples/hybrid/sphere/nonhydrostatic_gravity_wave.jl index 02bf96e567..9e36c3167f 100644 --- a/examples/hybrid/sphere/nonhydrostatic_gravity_wave.jl +++ b/examples/hybrid/sphere/nonhydrostatic_gravity_wave.jl @@ -55,7 +55,7 @@ function sphere_3D( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) diff --git a/lib/ClimaCoreMakie/test/runtests.jl b/lib/ClimaCoreMakie/test/runtests.jl index 6301b879d8..364790e146 100644 --- a/lib/ClimaCoreMakie/test/runtests.jl +++ b/lib/ClimaCoreMakie/test/runtests.jl @@ -11,13 +11,11 @@ OUTPUT_DIR = mkpath(get(ENV, "CI_OUTPUT_DIR", tempname())) @testset "spectral element 2D cubed-sphere" begin R = 6.37122e6 + context = ClimaComms.SingletonCommsContext() domain = ClimaCore.Domains.SphereDomain(R) mesh = ClimaCore.Meshes.EquiangularCubedSphere(domain, 6) - grid_topology = ClimaCore.Topologies.Topology2D( - ClimaComms.SingletonCommsContext(), - mesh, - ) + grid_topology = ClimaCore.Topologies.Topology2D(context, mesh) quad = ClimaCore.Quadratures.GLL{5}() space = ClimaCore.Spaces.SpectralElementSpace2D(grid_topology, quad) coords = ClimaCore.Fields.coordinate_field(space) @@ -75,6 +73,7 @@ end @testset "extruded" begin + context = ClimaComms.context() domain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.XPoint(-1000.0), ClimaCore.Geometry.XPoint(1000.0), @@ -87,16 +86,17 @@ end horz_coords = ClimaCore.Fields.coordinate_field(horz_space) z_surface = map(horz_coords) do coord - 100 * exp(-(coord.x / 100)^2) + Geometry.ZPoint(100 * exp(-(coord.x / 100)^2)) end vert_domain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.ZPoint(0.0), ClimaCore.Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vert_mesh = ClimaCore.Meshes.IntervalMesh(vert_domain, nelems = 36) - vert_center_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(vert_mesh) + vtopology = Topologies.IntervalTopology(context, vert_mesh) + vert_center_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(vtopology) vert_face_space = ClimaCore.Spaces.FaceFiniteDifferenceSpace(vert_center_space) diff --git a/lib/ClimaCorePlots/test/runtests.jl b/lib/ClimaCorePlots/test/runtests.jl index 53eed69487..46f3b04e8b 100644 --- a/lib/ClimaCorePlots/test/runtests.jl +++ b/lib/ClimaCorePlots/test/runtests.jl @@ -13,7 +13,7 @@ OUTPUT_DIR = mkpath(get(ENV, "CI_OUTPUT_DIR", tempname())) @testset "spectral element 1D" begin domain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.XPoint(0.0) .. ClimaCore.Geometry.XPoint(Ļ€), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = ClimaCore.Meshes.IntervalMesh(domain; nelems = 5) grid_topology = ClimaCore.Topologies.IntervalTopology(mesh) @@ -109,7 +109,7 @@ end vertdomain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.ZPoint{FT}(0), ClimaCore.Geometry.ZPoint{FT}(1000); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain, nelems = velem) vert_center_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(vertmesh) @@ -197,7 +197,7 @@ end vertdomain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.ZPoint{FT}(0), ClimaCore.Geometry.ZPoint{FT}(1000); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain, nelems = velem) vert_center_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(vertmesh) @@ -246,7 +246,7 @@ end vertdomain = ClimaCore.Domains.IntervalDomain( ClimaCore.Geometry.ZPoint{FT}(0), ClimaCore.Geometry.ZPoint{FT}(1000); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain, nelems = velem) vert_center_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(vertmesh) diff --git a/lib/ClimaCoreTempestRemap/src/onlineremap.jl b/lib/ClimaCoreTempestRemap/src/onlineremap.jl index 7414b68a24..4ea8abb2fd 100644 --- a/lib/ClimaCoreTempestRemap/src/onlineremap.jl +++ b/lib/ClimaCoreTempestRemap/src/onlineremap.jl @@ -244,7 +244,8 @@ function generate_map( if target_space_distr != nothing # Create map from unique (TempestRemap convention) to local element indices - target_local_elem_gidx = target_space_distr.topology.local_elem_gidx # gidx = local_elem_gidx[lidx] + target_local_elem_gidx = + Spaces.topology(target_space_distr).local_elem_gidx # gidx = local_elem_gidx[lidx] target_global_elem_lidx = Dict{Int, Int}() # inverse of local_elem_gidx: lidx = global_elem_lidx[gidx] for (lidx, gidx) in enumerate(target_local_elem_gidx) target_global_elem_lidx[gidx] = lidx diff --git a/lib/ClimaCoreTempestRemap/test/netcdf.jl b/lib/ClimaCoreTempestRemap/test/netcdf.jl index 218936ff91..780ac521e1 100644 --- a/lib/ClimaCoreTempestRemap/test/netcdf.jl +++ b/lib/ClimaCoreTempestRemap/test/netcdf.jl @@ -98,7 +98,7 @@ end vdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(50.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = nlevels) vspace = Spaces.CenterFiniteDifferenceSpace(vmesh) @@ -181,7 +181,7 @@ end vdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(50.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = nlevels) vspace = Spaces.CenterFiniteDifferenceSpace(vmesh) @@ -316,11 +316,11 @@ end vdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(50.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = nlevels) vfspace = Spaces.FaceFiniteDifferenceSpace(vmesh) - z_surface = test_warp.(Fields.coordinate_field(hspace)) + z_surface = Geometry.ZPoint.(test_warp.(Fields.coordinate_field(hspace))) fhvspace = Spaces.ExtrudedFiniteDifferenceSpace( hspace, vfspace, @@ -425,7 +425,7 @@ end vdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(50.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = nlevels) vspace = Spaces.CenterFiniteDifferenceSpace(vmesh) diff --git a/lib/ClimaCoreVTK/src/ClimaCoreVTK.jl b/lib/ClimaCoreVTK/src/ClimaCoreVTK.jl index 8cee98d072..c7e41834a4 100644 --- a/lib/ClimaCoreVTK/src/ClimaCoreVTK.jl +++ b/lib/ClimaCoreVTK/src/ClimaCoreVTK.jl @@ -156,12 +156,4 @@ function writepvd(basename::String, times, fields::NamedTuple; vtkargs...) end end -Base.@deprecate writevtk(basename::String, times, fields; vtkargs...) writepvd( - basename, - times, - fields; - vtkargs..., -) - - end # module diff --git a/src/DataLayouts/broadcast.jl b/src/DataLayouts/broadcast.jl index 4a8b722fd2..c77b5ad0b8 100644 --- a/src/DataLayouts/broadcast.jl +++ b/src/DataLayouts/broadcast.jl @@ -538,9 +538,6 @@ function Base.copyto!( dest::VIFH{S, Ni}, bc::Base.Broadcast.Broadcasted{VIFHStyle{Ni, A}}, ) where {S, Ni, A} - # if enable_threading() - # return _threaded_copyto!(dest, bc) - # end return _serial_copyto!(dest, bc) end @@ -588,8 +585,5 @@ function Base.copyto!( dest::VIJFH{S, Nij}, bc::Base.Broadcast.Broadcasted{VIJFHStyle{Nij, A}}, ) where {S, Nij, A} - # if enable_threading() - # return _threaded_copyto!(dest, bc) - # end return _serial_copyto!(dest, bc) end diff --git a/src/Domains/Domains.jl b/src/Domains/Domains.jl index bf07ec1db2..03dcb27d70 100644 --- a/src/Domains/Domains.jl +++ b/src/Domains/Domains.jl @@ -51,8 +51,7 @@ function IntervalDomain( coord_min::Geometry.Abstract1DPoint, coord_max::Geometry.Abstract1DPoint; periodic = false, - boundary_tags = nothing, # TODO: deprecate this - boundary_names::BCTagType = boundary_tags, + boundary_names::BCTagType = nothing, ) if !periodic && isnothing(boundary_names) throw( diff --git a/src/Fields/Fields.jl b/src/Fields/Fields.jl index ba0ea7425b..a10326b078 100644 --- a/src/Fields/Fields.jl +++ b/src/Fields/Fields.jl @@ -331,9 +331,6 @@ local_geometry_field(space::AbstractSpace) = Field(Spaces.local_geometry_data(space), space) local_geometry_field(field::Field) = local_geometry_field(axes(field)) -Base.@deprecate dz_field(space::AbstractSpace) Ī”z_field(space) false -Base.@deprecate dz_field(field::Field) Ī”z_field(field) false - """ Ī”z_field(field::Field) Ī”z_field(space::AbstractSpace) @@ -457,22 +454,6 @@ function Spaces.weighted_dss!( return nothing end -# Add definitions for backward compatibility -Spaces.weighted_dss2!( - field::Field, - dss_buffer = Spaces.create_dss_buffer(field), -) = Spaces.weighted_dss!(field, dss_buffer) - -Spaces.weighted_dss_start2!(field::Field, ghost_buffer) = - Spaces.weighted_dss_start!(field, ghost_buffer) - -Spaces.weighted_dss_internal2!(field::Field, ghost_buffer) = - Spaces.weighted_dss_internal!(field, ghost_buffer) - -Spaces.weighted_dss_ghost2!(field, ghost_buffer) = - Spaces.weighted_dss_ghost!(field, ghost_buffer) - - """ Spaces.create_dss_buffer(field::Field) diff --git a/src/Fields/broadcast.jl b/src/Fields/broadcast.jl index a8605dc356..aa9ece9b7c 100644 --- a/src/Fields/broadcast.jl +++ b/src/Fields/broadcast.jl @@ -420,12 +420,3 @@ function Base.Broadcast.copyto!(field::Field, nt::NamedTuple) ), ) end - - -# TODO: deprecate these - -allow_mismatched_diagonalized_spaces() = false - -is_diagonalized_spaces(::Type{S}, ::Type{S}) where {S <: AbstractSpace} = true - -is_diagonalized_spaces(::Type, ::Type) = false diff --git a/src/Hypsography/Hypsography.jl b/src/Hypsography/Hypsography.jl index 13d58e09e2..23d336782c 100644 --- a/src/Hypsography/Hypsography.jl +++ b/src/Hypsography/Hypsography.jl @@ -79,13 +79,6 @@ of the domain, using the method of [GalChen1975](@cite). """ struct LinearAdaption{F <: Fields.Field} <: HypsographyAdaption surface::F - function LinearAdaption(surface::Fields.Field) - if eltype(surface) <: Real - @warn "`LinearAdaptation`: `surface` argument scalar field has been deprecated. Use a field `ZPoint`s." - surface = Geometry.ZPoint.(surface) - end - new{typeof(surface)}(surface) - end end Adapt.adapt_structure(to, adaption::LinearAdaption) = @@ -132,10 +125,6 @@ struct SLEVEAdaption{F <: Fields.Field, FT <: Real} <: HypsographyAdaption ) where {FT <: Real} @assert 0 <= Ī·ā‚• <= 1 @assert s >= 0 - if eltype(surface) <: Real - @warn "`SLEVEAdaption`: `surface` argument scalar field has been deprecated. Use a field `ZPoint`s." - surface = Geometry.ZPoint.(surface) - end new{typeof(surface), FT}(surface, Ī·ā‚•, s) end end diff --git a/src/InputOutput/readers.jl b/src/InputOutput/readers.jl index cb810ebf73..2e54b97b2d 100644 --- a/src/InputOutput/readers.jl +++ b/src/InputOutput/readers.jl @@ -88,11 +88,6 @@ struct HDF5Reader{C <: ClimaComms.AbstractCommsContext} grid_cache::Dict{Any, Any} end -@deprecate HDF5Reader(filename::AbstractString) HDF5Reader( - filename, - ClimaComms.SingletonCommsContext(), -) - function HDF5Reader( filename::AbstractString, context::ClimaComms.AbstractCommsContext, diff --git a/src/InputOutput/writers.jl b/src/InputOutput/writers.jl index f888f74082..fc78dc9bb6 100644 --- a/src/InputOutput/writers.jl +++ b/src/InputOutput/writers.jl @@ -42,11 +42,6 @@ struct HDF5Writer{C <: ClimaComms.AbstractCommsContext} <: AbstractWriter cache::Dict{String, String} end -@deprecate HDF5Writer(filename::AbstractString) HDF5Writer( - filename, - ClimaComms.SingletonCommsContext(), -) - function HDF5Writer( filename::AbstractString, context::ClimaComms.AbstractCommsContext; @@ -312,54 +307,54 @@ Write `SpectralElementSpace1D` data to HDF5. """ function write_new!( writer::HDF5Writer, - space::Grids.SpectralElementGrid1D, - name::AbstractString = defaultname(space), + grid::Grids.SpectralElementGrid1D, + name::AbstractString = defaultname(grid), ) group = create_group(writer.file, "grids/$name") write_attribute(group, "type", "SpectralElementGrid1D") write_attribute( group, "quadrature_type", - string(nameof(typeof(Spaces.quadrature_style(space)))), + string(nameof(typeof(Spaces.quadrature_style(grid)))), ) write_attribute( group, "quadrature_num_points", - Quadratures.degrees_of_freedom(Spaces.quadrature_style(space)), + Quadratures.degrees_of_freedom(Spaces.quadrature_style(grid)), ) - write_attribute(group, "topology", write!(writer, Spaces.topology(space))) + write_attribute(group, "topology", write!(writer, Spaces.topology(grid))) return name end function write_new!( writer::HDF5Writer, - space::Grids.SpectralElementGrid2D, - name::AbstractString = defaultname(space), + grid::Grids.SpectralElementGrid2D, + name::AbstractString = defaultname(grid), ) group = create_group(writer.file, "grids/$name") write_attribute(group, "type", "SpectralElementGrid2D") write_attribute( group, "quadrature_type", - string(nameof(typeof(Spaces.quadrature_style(space)))), + string(nameof(typeof(Spaces.quadrature_style(grid)))), ) write_attribute( group, "quadrature_num_points", - Quadratures.degrees_of_freedom(Spaces.quadrature_style(space)), + Quadratures.degrees_of_freedom(Spaces.quadrature_style(grid)), ) - write_attribute(group, "topology", write!(writer, Spaces.topology(space))) + write_attribute(group, "topology", write!(writer, Spaces.topology(grid))) return name end function write_new!( writer::HDF5Writer, - space::Grids.FiniteDifferenceGrid, - name::AbstractString = defaultname(space), + grid::Grids.FiniteDifferenceGrid, + name::AbstractString = defaultname(grid), ) group = create_group(writer.file, "grids/$name") write_attribute(group, "type", "FiniteDifferenceGrid") - write_attribute(group, "topology", write!(writer, Spaces.topology(space))) + write_attribute(group, "topology", write!(writer, Spaces.topology(grid))) return name end @@ -371,32 +366,33 @@ Writes an object of type 'Hypsography' and name 'name' to the HDF5 file. """ function write_new!( writer::HDF5Writer, - space::Grids.ExtrudedFiniteDifferenceGrid, - name::AbstractString = defaultname(space), + grid::Grids.ExtrudedFiniteDifferenceGrid, + name::AbstractString = defaultname(grid), ) group = create_group(writer.file, "grids/$name") write_attribute(group, "type", "ExtrudedFiniteDifferenceGrid") write_attribute( group, "horizontal_grid", - write!(writer, space.horizontal_grid), + write!(writer, grid.horizontal_grid), ) - write_attribute(group, "vertical_grid", write!(writer, space.vertical_grid)) - if space.hypsography isa Hypsography.LinearAdaption + write_attribute(group, "vertical_grid", write!(writer, grid.vertical_grid)) + hypsography = grid.hypsography + if hypsography isa Hypsography.LinearAdaption write_attribute(group, "hypsography_type", "LinearAdaption") write_attribute( group, "hypsography_surface", - write!(writer, space.hypsography.surface, "_z_surface/$name"), # Change to save "space.hyps" + write!(writer, hypsography.surface, "_z_surface/$name"), # Change to save "space.hyps" ) - elseif space.hypsography isa Hypsography.SLEVEAdaption + elseif hypsography isa Hypsography.SLEVEAdaption write_attribute(group, "hypsography_type", "SLEVEAdaption") - write_attribute(group, "hypsography_Ī·ā‚•", space.hypsography.Ī·ā‚•) - write_attribute(group, "hypsography_s", space.hypsography.s) + write_attribute(group, "hypsography_Ī·ā‚•", hypsography.Ī·ā‚•) + write_attribute(group, "hypsography_s", hypsography.s) write_attribute( group, "hypsography_surface", - write!(writer, space.hypsography.surface, "_z_surface/$name"), + write!(writer, hypsography.surface, "_z_surface/$name"), ) end return name @@ -405,16 +401,16 @@ end function write_new!( writer::HDF5Writer, - space::Grids.LevelGrid, - name::AbstractString = defaultname(space), + grid::Grids.LevelGrid, + name::AbstractString = defaultname(grid), ) group = create_group(writer.file, "grids/$name") write_attribute(group, "type", "LevelGrid") - write_attribute(group, "full_grid", write!(writer, space.full_grid)) - if space.level isa PlusHalf - write_attribute(group, "level_half", space.level - half) + write_attribute(group, "full_grid", write!(writer, grid.full_grid)) + if grid.level isa PlusHalf + write_attribute(group, "level_half", grid.level - half) else - write_attribute(group, "level", space.level) + write_attribute(group, "level", grid.level) end return name end diff --git a/src/Limiters/quasimonotone.jl b/src/Limiters/quasimonotone.jl index 37b1e03b96..f87fd924e3 100644 --- a/src/Limiters/quasimonotone.jl +++ b/src/Limiters/quasimonotone.jl @@ -68,11 +68,6 @@ function QuasiMonotoneLimiter(Ļq::Fields.Field; rtol = eps(eltype(parent(Ļq))) return QuasiMonotoneLimiter(q_bounds, similar(q_bounds), ghost_buffer, rtol) end -Base.@deprecate( - QuasiMonotoneLimiter(Ļq::Fields.Field, Ļ::Fields.Field), - QuasiMonotoneLimiter(Ļq::Fields.Field; rtol = eps(eltype(parent(Ļq)))), -) - function make_q_bounds( Ļq::Union{DataLayouts.IFH{S}, DataLayouts.IJFH{S}}, ) where {S} diff --git a/src/Meshes/Meshes.jl b/src/Meshes/Meshes.jl index fc1c98f161..4d35a05327 100644 --- a/src/Meshes/Meshes.jl +++ b/src/Meshes/Meshes.jl @@ -119,26 +119,5 @@ include("interval.jl") include("rectangle.jl") include("cubedsphere.jl") -# deprecations -@deprecate EquispacedRectangleMesh(args...) RectilinearMesh(args...) -@deprecate equispaced_rectangular_mesh(args...) RectilinearMesh(args...) -@deprecate TensorProductMesh(args...) RectilinearMesh(args...) -@deprecate EquiangularSphereWarp() EquiangularCubedSphere -@deprecate EquidistantSphereWarp() EquidistantCubedSphere -@deprecate ConformalSphereWarp() ConformalCubedSphere -@deprecate Mesh2D( - domain::Domains.SphereDomain, - ::Type{T}, - Ne, -) where {T <: AbstractCubedSphere} T(domain, Ne) -@deprecate Mesh2D(domain::RectangleDomain, x1c, x2c) RectilinearMesh( - IntervalMesh(domain.interval1, x1c), - IntervalMesh(domain.interval2, x2c), -) -@deprecate coordinates(mesh::AbstractMesh, elem, Ī¾::NTuple) coordinates( - mesh, - elem, - StaticArrays.SVector(Ī¾), -) end # module diff --git a/src/Meshes/cubedsphere.jl b/src/Meshes/cubedsphere.jl index 3df1c30f4c..bb31394e9b 100644 --- a/src/Meshes/cubedsphere.jl +++ b/src/Meshes/cubedsphere.jl @@ -233,13 +233,13 @@ end coordinates( mesh::AbstractCubedSphere, elem::CartesianIndex{3}, - Ī¾::StaticArrays.SVector{2}, + Ī¾::Union{StaticArrays.SVector{2}, Tuple{<:Real, <:Real}}, ) = coordinates(mesh, elem, Ī¾, mesh.localelementmap) function coordinates( mesh::AbstractCubedSphere, elem::CartesianIndex{3}, - (Ī¾1, Ī¾2)::StaticArrays.SVector{2}, + (Ī¾1, Ī¾2)::Union{StaticArrays.SVector{2}, Tuple{<:Real, <:Real}}, ::IntrinsicMap, ) FT = typeof(mesh.domain.radius) @@ -257,7 +257,7 @@ end function coordinates( mesh::AbstractCubedSphere, elem::CartesianIndex{3}, - (Ī¾1, Ī¾2)::StaticArrays.SVector{2}, + (Ī¾1, Ī¾2)::Union{StaticArrays.SVector{2}, Tuple{<:Real, <:Real}}, ::NormalizedBilinearMap, ) radius = mesh.domain.radius diff --git a/src/Meshes/interval.jl b/src/Meshes/interval.jl index 7133cf63ad..0486294289 100644 --- a/src/Meshes/interval.jl +++ b/src/Meshes/interval.jl @@ -55,7 +55,7 @@ coordinates(mesh::IntervalMesh, elem::Integer, vert::Integer) = function coordinates( mesh::IntervalMesh, elem::Integer, - (Ī¾1,)::StaticArrays.SVector{1}, + (Ī¾1,)::Union{StaticArrays.SVector{1}, Tuple{<:Real}}, ) ca = mesh.faces[elem] cb = mesh.faces[elem + 1] diff --git a/src/Meshes/rectangle.jl b/src/Meshes/rectangle.jl index fd8de017cf..a9b0393682 100644 --- a/src/Meshes/rectangle.jl +++ b/src/Meshes/rectangle.jl @@ -119,7 +119,7 @@ end function coordinates( mesh::RectilinearMesh, elem::CartesianIndex{2}, - (Ī¾1, Ī¾2)::StaticArrays.SVector{2}, + (Ī¾1, Ī¾2)::Union{StaticArrays.SVector{2}, Tuple{<:Real, <:Real}}, ) x1, x2 = elem.I coord1 = coordinates(mesh.intervalmesh1, x1, StaticArrays.SVector(Ī¾1)) diff --git a/src/Operators/numericalflux.jl b/src/Operators/numericalflux.jl index 7d965d8103..aa3d38fa69 100644 --- a/src/Operators/numericalflux.jl +++ b/src/Operators/numericalflux.jl @@ -26,12 +26,12 @@ function add_numerical_flux_internal!(fn, dydt, args...) space = axes(dydt) Nq = Quadratures.degrees_of_freedom(Spaces.quadrature_style(space)) topology = Spaces.topology(space) + internal_surface_geometry = Spaces.grid(space).internal_surface_geometry for (iface, (elemā», faceā», elemāŗ, faceāŗ, reversed)) in enumerate(Topologies.interior_faces(topology)) - internal_surface_geometry_slab = - slab(space.internal_surface_geometry, iface) + internal_surface_geometry_slab = slab(internal_surface_geometry, iface) arg_slabsā» = map(arg -> slab(Fields.todata(arg), elemā»), args) arg_slabsāŗ = map(arg -> slab(Fields.todata(arg), elemāŗ), args) @@ -102,6 +102,7 @@ function add_numerical_flux_boundary!(fn, dydt, args...) space = axes(dydt) Nq = Quadratures.degrees_of_freedom(Spaces.quadrature_style(space)) topology = Spaces.topology(space) + boundary_surface_geometries = Spaces.grid(space).boundary_surface_geometries for (iboundary, boundarytag) in enumerate(Topologies.boundary_tags(topology)) @@ -109,7 +110,7 @@ function add_numerical_flux_boundary!(fn, dydt, args...) enumerate(Topologies.boundary_faces(topology, boundarytag)) boundary_surface_geometry_slab = surface_geometry_slab = - slab(space.boundary_surface_geometries[iboundary], iface) + slab(boundary_surface_geometries[iboundary], iface) arg_slabsā» = map(arg -> slab(Fields.todata(arg), elemā»), args) dydt_slabā» = slab(Fields.field_values(dydt), elemā») diff --git a/src/Remapping/distributed_remapping.jl b/src/Remapping/distributed_remapping.jl index a5e27bb89e..a3282ee1a9 100644 --- a/src/Remapping/distributed_remapping.jl +++ b/src/Remapping/distributed_remapping.jl @@ -323,21 +323,8 @@ function Remapper( ) end -function Remapper( - target_hcoords::AbstractArray, - target_zcoords::Union{AbstractArray, Nothing}, - space::Spaces.AbstractSpace, -) - Base.depwarn( - "The order of arguments in Remapper has changed. Please use Remapper(space, target_hcoords, target_zcoords) instead.", - :Remapper, - ) - return Remapper(space, target_hcoords, target_zcoords) -end - -function Remapper(space::Spaces.AbstractSpace, target_hcoords::AbstractArray) - return Remapper(space, target_hcoords, nothing) -end +Remapper(space::Spaces.AbstractSpace, target_hcoords::AbstractArray) = + Remapper(space, target_hcoords, nothing) """ _set_interpolated_values!(remapper, field) diff --git a/src/Remapping/interpolate_array.jl b/src/Remapping/interpolate_array.jl index e9beb68ecc..b5b957af13 100644 --- a/src/Remapping/interpolate_array.jl +++ b/src/Remapping/interpolate_array.jl @@ -575,7 +575,8 @@ function interpolate_column( # When we don't have hypsography, there is no notion of "interpolating hypsography". In # this case, the reference vertical points coincide with the physical ones. Setting # physical_z = false ensures that zpts_ref = zpts - if space.hypsography isa Grids.Flat + hypsography = Spaces.grid(space).hypsography + if hypsography isa Grids.Flat physical_z = false end @@ -594,10 +595,9 @@ function interpolate_column( # interpolate_slab! takes a vector z_surface = [zero(FT)] - interpolate_slab!( z_surface, - space.hypsography.surface.z, + hypsography.surface.z, [Fields.SlabIndex(nothing, gidx)], [Is], ) @@ -606,7 +606,7 @@ function interpolate_column( all_zpts_ref = [ Hypsography.physical_z_to_ref_z( - Spaces.grid(space).hypsography, + hypsography, z_ref, Geometry.ZPoint(z_surface), Geometry.ZPoint(z_top), diff --git a/src/Spaces/dss.jl b/src/Spaces/dss.jl index 7585e18c1c..a57634b064 100644 --- a/src/Spaces/dss.jl +++ b/src/Spaces/dss.jl @@ -172,10 +172,6 @@ end weighted_dss_start!(data, space, dss_buffer::Nothing) = nothing -# TODO: deprecate -weighted_dss_start!(data, space, hspace, dss_buffer) = - weighted_dss_start!(data, space, dss_buffer) - """ weighted_dss_internal!( @@ -329,17 +325,3 @@ function weighted_dss_ghost!( end weighted_dss_ghost!(data, space, hspace, dss_buffer) = data - - -# TODO: deprecate - - -# for backward compatibility -function weighted_dss2! end -function weighted_dss_start2! end -function weighted_dss_internal2! end -function weighted_dss_ghost2! end -function dss2! end - - -dss2!(data, topology, quadrature_style) = dss!(data, topology) diff --git a/src/Spaces/extruded.jl b/src/Spaces/extruded.jl index 5408bc8497..eadc02a46e 100644 --- a/src/Spaces/extruded.jl +++ b/src/Spaces/extruded.jl @@ -38,62 +38,6 @@ function ExtrudedFiniteDifferenceSpace( return ExtrudedFiniteDifferenceSpace(grid_space, vertical_space.staggering) end -@inline function Base.getproperty( - space::ExtrudedFiniteDifferenceSpace, - name::Symbol, -) - if name == :horizontal_space - Base.depwarn( - "`space.horizontal_space` is deprecated, use `Spaces.horizontal_space(space)` instead", - :getproperty, - ) - return horizontal_space(space) - elseif name == :vertical_topology - Base.depwarn( - "`space.vertical_topology` is deprecated, use `Spaces.vertical_topology(space)` instead", - :getproperty, - ) - return vertical_topology(space) - elseif name == :hypsography - Base.depwarn( - "`space.hypsography` is deprecated, use `Spaces.grid(space).hypsography` instead", - :getproperty, - ) - return grid(space).hypsography - elseif name == :global_geometry - Base.depwarn( - "`space.global_geometry` is deprecated, use `Spaces.global_geometry(space)` instead", - :getproperty, - ) - return global_geometry(space) - elseif name == :center_local_geometry - Base.depwarn( - "`space.center_local_geometry` is deprecated, use `Spaces.local_geometry_data(grid(space), Grids.CellCenter())` instead", - :getproperty, - ) - return local_geometry_data(grid(space), Grids.CellCenter()) - elseif name == :face_local_geometry - Base.depwarn( - "`space.face_local_geometry` is deprecated, use `Spaces.local_geometry_data(grid(space), Grids.CellFace())` instead", - :getproperty, - ) - return local_geometry_data(grid(space), Grids.CellFace()) - elseif name == :center_ghost_geometry - Base.depwarn( - "`space.center_ghost_geometry` is deprecated, use `nothing` instead", - :getproperty, - ) - return nothing - elseif name == :face_ghost_geometry - Base.depwarn( - "`space.face_ghost_geometry` is deprecated, use `nothing` instead", - :getproperty, - ) - return nothing - end - return getfield(space, name) -end - FaceExtrudedFiniteDifferenceSpace(grid::Grids.ExtrudedFiniteDifferenceGrid) = ExtrudedFiniteDifferenceSpace(grid, CellFace()) CenterExtrudedFiniteDifferenceSpace(grid::Grids.ExtrudedFiniteDifferenceGrid) = @@ -193,7 +137,7 @@ function Base.show(io::IO, space::ExtrudedFiniteDifferenceSpace) println(iio, " "^(indent + 4), "mesh: ", Spaces.topology(hspace).mesh) println(iio, " "^(indent + 4), "quadrature: ", quadrature_style(hspace)) println(iio, " "^(indent + 2), "vertical:") - print(iio, " "^(indent + 4), "mesh: ", space.vertical_topology.mesh) + print(iio, " "^(indent + 4), "mesh: ", vertical_topology(space).mesh) end quadrature_style(space::ExtrudedFiniteDifferenceSpace) = @@ -224,7 +168,7 @@ Base.@propagate_inbounds function slab( h, ) SpectralElementSpaceSlab( - Spaces.horizontal_space(space).quadrature_style, + Spaces.quadrature_style(space), slab(local_geometry_data(space), v, h), ) end @@ -261,12 +205,15 @@ end function eachslabindex(cspace::CenterExtrudedFiniteDifferenceSpace) h_iter = eachslabindex(Spaces.horizontal_space(cspace)) - Nv = size(cspace.center_local_geometry, 4) + center_local_geometry = + local_geometry_data(grid(cspace), Grids.CellCenter()) + Nv = size(center_local_geometry, 4) return Iterators.product(1:Nv, h_iter) end function eachslabindex(fspace::FaceExtrudedFiniteDifferenceSpace) h_iter = eachslabindex(Spaces.horizontal_space(fspace)) - Nv = size(fspace.face_local_geometry, 4) + face_local_geometry = local_geometry_data(grid(fspace), Grids.CellFace()) + Nv = size(face_local_geometry, 4) return Iterators.product(1:Nv, h_iter) end diff --git a/src/Spaces/finitedifference.jl b/src/Spaces/finitedifference.jl index f5e4d2a964..9e06cfa370 100644 --- a/src/Spaces/finitedifference.jl +++ b/src/Spaces/finitedifference.jl @@ -66,35 +66,6 @@ FaceFiniteDifferenceSpace(mesh::Meshes.IntervalMesh) = CenterFiniteDifferenceSpace(mesh::Meshes.IntervalMesh) = FiniteDifferenceSpace(Grids.FiniteDifferenceGrid(mesh), CellCenter()) -@inline function Base.getproperty(space::FiniteDifferenceSpace, name::Symbol) - if name == :topology - Base.depwarn( - "`space.topology` is deprecated, use `Spaces.topology(space)` instead", - :getproperty, - ) - return topology(space) - elseif name == :global_geometry - Base.depwarn( - "`space.global_geometry` is deprecated, use `Spaces.global_geometry(space)` instead", - :getproperty, - ) - return global_geometry(space) - elseif name == :center_local_geometry - Base.depwarn( - "`space.center_local_geometry` is deprecated, use `local_geometry_data(grid(space), Grids.CellCenter())` instead", - :getproperty, - ) - return local_geometry_data(space, Grids.CellCenter()) - elseif name == :face_local_geometry - Base.depwarn( - "`space.face_local_geometry` is deprecated, use `local_geometry_data(grid(space), Grids.CellFace())` instead", - :getproperty, - ) - return local_geometry_data(space, Grids.CellFace()) - end - return getfield(space, name) -end - Adapt.adapt_structure(to, space::FiniteDifferenceSpace) = FiniteDifferenceSpace(Adapt.adapt(to, grid(space)), staggering(space)) @@ -104,10 +75,6 @@ nlevels(space::FiniteDifferenceSpace) = length(space) # TODO: deprecate? Base.length(space::FiniteDifferenceSpace) = length(coordinates_data(space)) - - -Base.@deprecate z_component(::Type{T}) where {T} Ī”z_metric_component(T) false - """ Ī”z_metric_component(::Type{<:Goemetry.AbstractPoint}) @@ -122,8 +89,6 @@ in an `AxisTensor`. Ī”z_metric_component(::Type{<:Geometry.ZPoint}) = 1 Ī”z_metric_component(::Type{<:Geometry.XZPoint}) = 4 -Base.@deprecate dz_data(space::AbstractSpace) Ī”z_data(space) false - """ Ī”z_data(space::AbstractSpace) diff --git a/src/Spaces/pointspace.jl b/src/Spaces/pointspace.jl index 1e16236f6d..49505ddca7 100644 --- a/src/Spaces/pointspace.jl +++ b/src/Spaces/pointspace.jl @@ -38,7 +38,7 @@ end Adapt.adapt_structure(to, space::PointSpace) = - PointSpace(DeviceSideContext(), Adapt.adapt(to, space.local_geometry)) + PointSpace(DeviceSideContext(), Adapt.adapt(to, local_geometry_data(space))) function PointSpace( context::ClimaComms.AbstractCommsContext, diff --git a/src/Spaces/spectralelement.jl b/src/Spaces/spectralelement.jl index 7bdab14c72..bc6680ce98 100644 --- a/src/Spaces/spectralelement.jl +++ b/src/Spaces/spectralelement.jl @@ -65,42 +65,6 @@ function SpectralElementSpace1D( SpectralElementSpace1D(grid) end - -@inline function Base.getproperty(space::SpectralElementSpace1D, name::Symbol) - if name == :topology - Base.depwarn( - "`space.topology` is deprecated, use `Spaces.topology(space)` instead", - :getproperty, - ) - return topology(space) - elseif name == :quadrature_style - Base.depwarn( - "`space.quadrature_style` is deprecated, use `Spaces.quadrature_style(space)` instead", - :getproperty, - ) - return quadrature_style(space) - elseif name == :global_geometry - Base.depwarn( - "`space.global_geometry` is deprecated, use `Spaces.global_geometry(space)` instead", - :getproperty, - ) - return global_geometry(space) - elseif name == :local_geometry - Base.depwarn( - "`space.local_geometry` is deprecated, use `Spaces.local_geometry_data(space)` instead", - :getproperty, - ) - return local_geometry_data(space) - elseif name == :local_dss_weights - Base.depwarn( - "`space.local_dss_weights` is deprecated, use `Spaces.local_dss_weights(space)` instead", - :getproperty, - ) - return local_dss_weights(space) - end - return getfield(space, name) -end - # 2D """ SpectralElementSpace2D(grid::SpectralElementGrid1D) @@ -124,66 +88,6 @@ function SpectralElementSpace2D( SpectralElementSpace2D(grid) end -@inline function Base.getproperty(space::SpectralElementSpace2D, name::Symbol) - if name == :topology - Base.depwarn( - "`space.topology` is deprecated, use `Spaces.topology(space)` instead", - :getproperty, - ) - return topology(space) - elseif name == :quadrature_style - Base.depwarn( - "`space.quadrature_style` is deprecated, use `Spaces.quadrature_style(space)` instead", - :getproperty, - ) - return quadrature_style(space) - elseif name == :global_geometry - Base.depwarn( - "`space.global_geometry` is deprecated, use `Spaces.global_geometry(space)` instead", - :getproperty, - ) - return global_geometry(space) - elseif name == :local_geometry - Base.depwarn( - "`space.local_geometry` is deprecated, use `Spaces.local_geometry_data(space)` instead", - :getproperty, - ) - return local_geometry_data(space) - elseif name == :ghost_geometry - Base.depwarn( - "`space.ghost_geometry` is deprecated, use `nothing` instead", - :getproperty, - ) - return nothing - elseif name == :local_dss_weights - Base.depwarn( - "`space.local_dss_weights` is deprecated, use `Spaces.local_dss_weights(space)` instead", - :getproperty, - ) - return local_dss_weights(space) - elseif name == :ghost_dss_weights - Base.depwarn( - "`space.ghost_dss_weights` is deprecated, use `nothing` instead", - :getproperty, - ) - return nothing - elseif name == :internal_surface_geometry - Base.depwarn( - "`space.internal_surface_geometry` is deprecated, use `Spaces.grid(space).internal_surface_geometry` instead", - :getproperty, - ) - return grid(space).internal_surface_geometry - elseif name == :boundary_surface_geometries - Base.depwarn( - "`space.boundary_surface_geometries` is deprecated, use `Spaces.grid(space).boundary_surface_geometries` instead", - :getproperty, - ) - return grid(space).boundary_surface_geometries - end - return getfield(space, name) -end - - Adapt.adapt_structure(to, space::SpectralElementSpace2D) = SpectralElementSpace2D(Adapt.adapt(to, grid(space))) @@ -226,7 +130,8 @@ number of unique quadrature points along each dimension. function node_horizontal_length_scale(space::AbstractSpectralElementSpace) quad = quadrature_style(space) Nu = Quadratures.unique_degrees_of_freedom(quad) - return Meshes.element_horizontal_length_scale(space.topology.mesh) / Nu + return Meshes.element_horizontal_length_scale(Spaces.topology(space).mesh) / + Nu end @@ -240,7 +145,7 @@ Base.@propagate_inbounds function slab( ) SpectralElementSpaceSlab( quadrature_style(space), - slab(space.local_geometry, v, h), + slab(local_geometry_data(space), v, h), ) end Base.@propagate_inbounds slab(space::AbstractSpectralElementSpace, h) = diff --git a/src/Spaces/triangulation.jl b/src/Spaces/triangulation.jl index e6c9d49680..fda23175e3 100644 --- a/src/Spaces/triangulation.jl +++ b/src/Spaces/triangulation.jl @@ -16,12 +16,12 @@ function triangles(Ni, Nj, Nh) end function triangulate(space::SpectralElementSpace2D) - Ni, Nj, _, _, Nh = size(space.local_geometry) + Ni, Nj, _, _, Nh = size(local_geometry_data(space)) return triangles(Ni, Nj, Nh) end function triangulate(space::ExtrudedFiniteDifferenceSpace) - Ni, Nj, _, Nv, Nh = size(space.local_geometry) + Ni, Nj, _, Nv, Nh = size(local_geometry_data(space)) @assert Nj == 1 "triangulation only defined for 1D extruded fields" return triangles(Ni, Nv, Nh) end diff --git a/src/Topologies/Topologies.jl b/src/Topologies/Topologies.jl index 9653314fbe..c5179e1d34 100644 --- a/src/Topologies/Topologies.jl +++ b/src/Topologies/Topologies.jl @@ -346,14 +346,6 @@ include("topology2d.jl") include("dss_transform.jl") include("dss.jl") -# deprecate -@deprecate boundaries(topology::AbstractTopology) boundary_tags(topology) - const DistributedTopology2D = Topology2D -@deprecate Topology2D(mesh::Meshes.AbstractMesh, args...) Topology2D( - ClimaComms.SingletonCommsContext(), - mesh, - args..., -) end # module diff --git a/src/deprecated.jl b/src/deprecated.jl index 28182d2b47..21897e6f16 100644 --- a/src/deprecated.jl +++ b/src/deprecated.jl @@ -1,45 +1 @@ -# Device module -module Device -using ClimaComms -using CUDA - -Base.@deprecate device(; disablegpu = false) if disablegpu - ClimaComms.CPUSingleThreaded() -else - ClimaComms.device() -end false - -Base.@deprecate device_array_type(ctx::ClimaComms.AbstractCPUDevice) ClimaComms.array_type( - ctx, -) false -Base.@deprecate device_array_type(ctx::ClimaComms.CUDADevice) ClimaComms.array_type( - ctx, -) false - -Base.@deprecate device(ctx::ClimaComms.SingletonCommsContext) ClimaComms.device( - ctx, -) false - -Base.@deprecate device(ctx::Array) false -Base.@deprecate device(ctx::CUDA.CuArray) ClimaComms.device(ctx) false - -end - -@deprecate comm_context(field::Fields.Field) ClimaComms.context(field) - -@deprecate comm_context(space::Spaces.ExtrudedFiniteDifferenceSpace) ClimaComms.context( - space, -) -@deprecate comm_context(space::Spaces.SpectralElementSpace2D) ClimaComms.context( - space, -) -@deprecate comm_context(space::S) where {S <: Spaces.AbstractSpace} ClimaComms.context( - space, -) - -@deprecate comm_context(topology::Topologies.Topology2D) ClimaComms.context( - topology, -) -@deprecate comm_context(topology::T) where {T <: Topologies.AbstractTopology} ClimaComms.context( - topology, -) +# Deprecated methods diff --git a/src/interface.jl b/src/interface.jl index 11496d3c2e..ceb5217eda 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -1,24 +1,5 @@ # Toplevel interface functions for recurisve broadcast expressions -""" - enable_threading() - -By default returns `false` signifying threading is disabled. -Enable the threading runtime by redefining the method at the toplevel your experiment file: - - import ClimaCore: enable_threading - enable_threading() = true - -and running julia with `julia --nthreads=N ...` - -This function is deprecated in version `0.10.42`. -Please use the ClimaComms context for threading. -""" -function enable_threading end - -Base.@deprecate enable_threading() deprecated_enable_threading() false -deprecated_enable_threading() = false - """ slab(data::AbstractData, h::Integer) diff --git a/test/Fields/field.jl b/test/Fields/field.jl index 2a3650d7c9..5b62625aec 100644 --- a/test/Fields/field.jl +++ b/test/Fields/field.jl @@ -538,8 +538,8 @@ end lg_space = Spaces.level(space, TU.fc_index(1, space)) lg_field_space = axes(Fields.level(Y, TU.fc_index(1, space))) @test all( - lg_space.local_geometry.coordinates === - lg_field_space.local_geometry.coordinates, + Spaces.local_geometry_data(lg_space).coordinates === + Spaces.local_geometry_data(lg_field_space).coordinates, ) @test all(Fields.zeros(lg_space) == Fields.zeros(lg_field_space)) end diff --git a/test/Fields/field_opt.jl b/test/Fields/field_opt.jl index efe013a5fb..a93c9ce808 100644 --- a/test/Fields/field_opt.jl +++ b/test/Fields/field_opt.jl @@ -2,6 +2,7 @@ using Test using StaticArrays, IntervalSets import ClimaCore +import ClimaComms import ClimaCore.Utilities: PlusHalf, half import ClimaCore.DataLayouts: IJFH import ClimaCore: @@ -308,19 +309,21 @@ end # https://github.com/CliMA/ClimaCore.jl/issues/1062 @testset "Allocations with copyto! on FieldVectors" begin function toy_sphere(::Type{FT}) where {FT} + context = ClimaComms.context() helem = npoly = 2 hdomain = Domains.SphereDomain(FT(1e7)) hmesh = Meshes.EquiangularCubedSphere(hdomain, helem) - htopology = Topologies.Topology2D(hmesh) + htopology = Topologies.Topology2D(context, hmesh) quad = Quadratures.GLL{npoly + 1}() hspace = Spaces.SpectralElementSpace2D(htopology, quad) vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zero(FT)), Geometry.ZPoint{FT}(FT(1e4)); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = 4) - vspace = Spaces.CenterFiniteDifferenceSpace(vmesh) + vtopology = Topologies.IntervalTopology(context, vmesh) + vspace = Spaces.CenterFiniteDifferenceSpace(vtopology) center_space = Spaces.ExtrudedFiniteDifferenceSpace(hspace, vspace) face_space = Spaces.FaceExtrudedFiniteDifferenceSpace(center_space) return (center_space, face_space) diff --git a/test/Fields/reduction_cuda.jl b/test/Fields/reduction_cuda.jl index 9c2333d332..ab5db17a16 100644 --- a/test/Fields/reduction_cuda.jl +++ b/test/Fields/reduction_cuda.jl @@ -121,7 +121,7 @@ end z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_mesh = Meshes.IntervalMesh(z_domain, nelems = z_elem) z_topology = Topologies.IntervalTopology(context, z_mesh) @@ -205,7 +205,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(z0), Geometry.ZPoint{FT}(z_max); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) z_mesh = Meshes.IntervalMesh(domain; nelems = z_nelems) diff --git a/test/Fields/reduction_cuda_distributed.jl b/test/Fields/reduction_cuda_distributed.jl index 475c39cba2..86da245149 100644 --- a/test/Fields/reduction_cuda_distributed.jl +++ b/test/Fields/reduction_cuda_distributed.jl @@ -131,7 +131,7 @@ end z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_mesh = Meshes.IntervalMesh(z_domain, nelems = z_elem) z_topology = Topologies.IntervalTopology(vcontext, z_mesh) diff --git a/test/Hypsography/2d.jl b/test/Hypsography/2d.jl index 6e178cb192..c7cd304e47 100644 --- a/test/Hypsography/2d.jl +++ b/test/Hypsography/2d.jl @@ -1,5 +1,6 @@ using Test import ClimaCore +import ClimaComms import ClimaCore: ClimaCore, slab, @@ -17,13 +18,15 @@ import ClimaCore: using ClimaCore.Geometry FT = Float64 +context = ClimaComms.context() vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0), Geometry.ZPoint{FT}(4); boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 40) -vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) +z_topology = Topologies.IntervalTopology(context, vertmesh) +vert_center_space = Spaces.CenterFiniteDifferenceSpace(z_topology) @@ -37,7 +40,7 @@ horztopology = Topologies.IntervalTopology(horzmesh) quad = Quadratures.GLL{4 + 1}() horzspace = Spaces.SpectralElementSpace1D(horztopology, quad) -z_surface = sin.(Fields.coordinate_field(horzspace).x) .+ 1 +z_surface = Geometry.ZPoint.(sin.(Fields.coordinate_field(horzspace).x) .+ 1) hv_center_space = Spaces.ExtrudedFiniteDifferenceSpace( horzspace, diff --git a/test/Hypsography/3dsphere.jl b/test/Hypsography/3dsphere.jl index 00889f2083..33070a52b2 100644 --- a/test/Hypsography/3dsphere.jl +++ b/test/Hypsography/3dsphere.jl @@ -17,13 +17,15 @@ import ClimaCore: using ClimaCore.Geometry FT = Float64 +context = ClimaComms.context() vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0), Geometry.ZPoint{FT}(4); boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 40) -vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) +z_topology = Topologies.IntervalTopology(context, vertmesh) +vert_center_space = Spaces.CenterFiniteDifferenceSpace(z_topology) @@ -37,8 +39,10 @@ quad = Quadratures.GLL{4 + 1}() horzspace = Spaces.SpectralElementSpace2D(horztopology, quad) z_surface = - cosd.(Fields.coordinate_field(horzspace).lat) .+ - cosd.(Fields.coordinate_field(horzspace).long) .+ 1 + Geometry.ZPoint.( + cosd.(Fields.coordinate_field(horzspace).lat) .+ + cosd.(Fields.coordinate_field(horzspace).long) .+ 1 + ) hv_center_space = Spaces.ExtrudedFiniteDifferenceSpace( horzspace, diff --git a/test/InputOutput/hdf5.jl b/test/InputOutput/hdf5.jl index 21f4cf968f..0702593d46 100644 --- a/test/InputOutput/hdf5.jl +++ b/test/InputOutput/hdf5.jl @@ -1,10 +1,12 @@ using Test using ClimaCore: InputOutput +using ClimaComms filename = tempname(pwd()) @testset "General HDF5 features" begin - writer = InputOutput.HDF5Writer(filename) + context = ClimaComms.context() + writer = InputOutput.HDF5Writer(filename, context) # Write some data InputOutput.HDF5.create_dataset(writer.file, "test", [1, 2, 3]) @@ -14,7 +16,7 @@ filename = tempname(pwd()) InputOutput.write_attributes!(writer, "/test", attributes) close(writer) - reader = InputOutput.HDF5Reader(filename) + reader = InputOutput.HDF5Reader(filename, context) attributes_read = InputOutput.read_attributes(reader, "test") @test attributes_read == attributes close(reader) diff --git a/test/InputOutput/hybrid2dbox.jl b/test/InputOutput/hybrid2dbox.jl index 63263d36d5..d488d9114a 100644 --- a/test/InputOutput/hybrid2dbox.jl +++ b/test/InputOutput/hybrid2dbox.jl @@ -31,7 +31,8 @@ function hvspace_2D( boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) - vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) + verttopo = Topologies.IntervalTopology(context, vertmesh) + vert_center_space = Spaces.CenterFiniteDifferenceSpace(verttopo) horzdomain = Domains.IntervalDomain( Geometry.XPoint{FT}(xlim[1]), @@ -111,7 +112,7 @@ end filename = tempname() writer = InputOutput.HDF5Writer(filename, context) InputOutput.write!(writer, "Y" => Y) # write field vector from hdf5 file - reader = InputOutput.HDF5Reader(filename) + reader = InputOutput.HDF5Reader(filename, context) restart_Y = InputOutput.read_field(reader, "Y") # read fieldvector from hdf5 file close(reader) @test restart_Y == Y # test if restart is exact diff --git a/test/InputOutput/hybrid2dbox_stretched.jl b/test/InputOutput/hybrid2dbox_stretched.jl index 670b8e26b6..8ab9366073 100644 --- a/test/InputOutput/hybrid2dbox_stretched.jl +++ b/test/InputOutput/hybrid2dbox_stretched.jl @@ -33,7 +33,8 @@ function hvspace_2D( ) stretch = Meshes.ExponentialStretching{FT}(FT(100.0)) vertmesh = Meshes.IntervalMesh(vertdomain, stretch, nelems = zelem) - vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) + verttopo = Topologies.IntervalTopology(context, vertmesh) + vert_center_space = Spaces.CenterFiniteDifferenceSpace(verttopo) horzdomain = Domains.IntervalDomain( Geometry.XPoint{FT}(xlim[1]), @@ -113,7 +114,7 @@ end writer = InputOutput.HDF5Writer(filename, context) InputOutput.write!(writer, "Y" => Y) # write field vector from hdf5 file - reader = InputOutput.HDF5Reader(filename) + reader = InputOutput.HDF5Reader(filename, context) restart_Y = InputOutput.read_field(reader, "Y") # read fieldvector from hdf5 file close(reader) @test restart_Y == Y # test if restart is exact diff --git a/test/InputOutput/hybrid2dbox_topography.jl b/test/InputOutput/hybrid2dbox_topography.jl index e19d9834da..1e5882f615 100644 --- a/test/InputOutput/hybrid2dbox_topography.jl +++ b/test/InputOutput/hybrid2dbox_topography.jl @@ -32,7 +32,8 @@ function hvspace_2D( boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) - vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) + verttopo = Topologies.IntervalTopology(context, vertmesh) + vert_center_space = Spaces.CenterFiniteDifferenceSpace(verttopo) horzdomain = Domains.IntervalDomain( Geometry.XPoint{FT}(xlim[1]), @@ -46,10 +47,12 @@ function hvspace_2D( horzspace = Spaces.SpectralElementSpace1D(horztopology, quad) z_surface = - sinpi.( - 2 .* (Fields.coordinate_field(horzspace).x .- xlim[1]) ./ - (xlim[2] - xlim[1]), - ) .+ 1 + Geometry.ZPoint.( + sinpi.( + 2 .* (Fields.coordinate_field(horzspace).x .- xlim[1]) ./ + (xlim[2] - xlim[1]), + ) .+ 1 + ) hv_center_space = Spaces.ExtrudedFiniteDifferenceSpace( horzspace, @@ -121,7 +124,7 @@ end filename = tempname() writer = InputOutput.HDF5Writer(filename, context) InputOutput.write!(writer, "Y" => Y) # write field vector from hdf5 file - reader = InputOutput.HDF5Reader(filename) + reader = InputOutput.HDF5Reader(filename, context) restart_Y = InputOutput.read_field(reader, "Y") # read fieldvector from hdf5 file close(reader) @test restart_Y == Y # test if restart is exact diff --git a/test/InputOutput/hybrid3dbox.jl b/test/InputOutput/hybrid3dbox.jl index ffd2a319c0..8e7ea89239 100644 --- a/test/InputOutput/hybrid3dbox.jl +++ b/test/InputOutput/hybrid3dbox.jl @@ -26,14 +26,16 @@ function hvspace_3D( zelem = 16, npoly = 3; ) + context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded()) FT = Float64 vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) - vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) + verttopo = Topologies.IntervalTopology(context, vertmesh) + vert_center_space = Spaces.CenterFiniteDifferenceSpace(verttopo) horzdomain = Domains.RectangleDomain( Geometry.XPoint{FT}(xlim[1]) .. Geometry.XPoint{FT}(xlim[2]), @@ -45,7 +47,6 @@ function hvspace_3D( Nf_center, Nf_face = 2, 1 #1 + 3 + 1 quad = Quadratures.GLL{npoly + 1}() horzmesh = Meshes.RectilinearMesh(horzdomain, xelem, yelem) - context = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded()) horztopology = Topologies.Topology2D(context, horzmesh) horzspace = Spaces.SpectralElementSpace2D(horztopology, quad) diff --git a/test/InputOutput/hybrid3dcubedsphere.jl b/test/InputOutput/hybrid3dcubedsphere.jl index 45cd0ce185..ca978e6b32 100644 --- a/test/InputOutput/hybrid3dcubedsphere.jl +++ b/test/InputOutput/hybrid3dcubedsphere.jl @@ -41,7 +41,7 @@ end z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_mesh = Meshes.IntervalMesh(z_domain, nelems = z_elem) z_topology = Topologies.IntervalTopology(z_mesh) diff --git a/test/InputOutput/hybrid3dcubedsphere_topography.jl b/test/InputOutput/hybrid3dcubedsphere_topography.jl index 981c0fab29..e4d205cb92 100644 --- a/test/InputOutput/hybrid3dcubedsphere_topography.jl +++ b/test/InputOutput/hybrid3dcubedsphere_topography.jl @@ -42,14 +42,16 @@ end z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_surface = - z_max / 8 .* ( - cosd.(Fields.coordinate_field(h_space).lat) .+ - cosd.(Fields.coordinate_field(h_space).long) .+ 1 + Geometry.ZPoint.( + z_max / 8 .* ( + cosd.(Fields.coordinate_field(h_space).lat) .+ + cosd.(Fields.coordinate_field(h_space).long) .+ 1 + ) ) z_mesh = Meshes.IntervalMesh(z_domain, nelems = z_elem) diff --git a/test/MatrixFields/field2arrays.jl b/test/MatrixFields/field2arrays.jl index 3123b591e2..edd4aa00d2 100644 --- a/test/MatrixFields/field2arrays.jl +++ b/test/MatrixFields/field2arrays.jl @@ -8,7 +8,7 @@ import ClimaCore: Geometry, Domains, Meshes, Spaces, Fields, MatrixFields domain = Domains.IntervalDomain( Geometry.ZPoint(FT(1)), Geometry.ZPoint(FT(4)); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain, nelems = 3) center_space = Spaces.CenterFiniteDifferenceSpace(mesh) diff --git a/test/MatrixFields/matrix_field_test_utils.jl b/test/MatrixFields/matrix_field_test_utils.jl index 26cf0aa410..3512133d52 100644 --- a/test/MatrixFields/matrix_field_test_utils.jl +++ b/test/MatrixFields/matrix_field_test_utils.jl @@ -207,7 +207,7 @@ function test_spaces(::Type{FT}) where {FT} vdomain = Domains.IntervalDomain( Geometry.ZPoint(FT(0)), Geometry.ZPoint(FT(10)); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = velem) vtopology = Topologies.IntervalTopology(comms_ctx, vmesh) @@ -216,7 +216,7 @@ function test_spaces(::Type{FT}) where {FT} hypsography = using_cuda ? Hypsography.Flat() : Hypsography.LinearAdaption( - @. cosd(sfc_coord.lat) + cosd(sfc_coord.long) + 1 + Geometry.ZPoint.(@. cosd(sfc_coord.lat) + cosd(sfc_coord.long) + 1), ) # TODO: FD operators don't currently work with hypsography on GPUs. center_space = Spaces.ExtrudedFiniteDifferenceSpace(hspace, vspace, hypsography) diff --git a/test/Meshes/interval.jl b/test/Meshes/interval.jl index 42a2d07179..f5afef8af5 100644 --- a/test/Meshes/interval.jl +++ b/test/Meshes/interval.jl @@ -300,13 +300,13 @@ end parent_domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(z_bottom), Geometry.ZPoint{FT}(z_top_parent), - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) parent_mesh = Meshes.IntervalMesh(parent_domain, stretch, nelems = nz) trunc_domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(z_bottom), Geometry.ZPoint{FT}(z_top), - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) trunc_mesh = Meshes.truncate_mesh(parent_mesh, trunc_domain) diff --git a/test/Operators/finitedifference/column.jl b/test/Operators/finitedifference/column.jl index 34411617f9..325a294455 100644 --- a/test/Operators/finitedifference/column.jl +++ b/test/Operators/finitedifference/column.jl @@ -14,7 +14,7 @@ device = ClimaComms.device() domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) @test eltype(domain) === Geometry.ZPoint{FT} @@ -125,11 +125,12 @@ end end @testset "Test composed stencils" begin + are_boundschecks_forced = Base.JLOptions().check_bounds == 1 for FT in (Float32, Float64) domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) @test eltype(domain) === Geometry.ZPoint{FT} @@ -158,7 +159,11 @@ end right = Operators.SetGradient(FT(-1)), ) - @test_throws Exception āˆ‚.(w .* I.(Īø)) + if are_boundschecks_forced + @test_throws Exception āˆ‚.(w .* I.(Īø)) + else + @warn "Bounds check on BoundsError āˆ‚.(w .* I.(Īø)) not verified." + end # 2) we set boundaries on the 1st operator I = Operators.InterpolateC2F( @@ -201,7 +206,6 @@ end āˆ‚ = Operators.GradientF2C() # TODO: should we throw something else? - are_boundschecks_forced = Base.JLOptions().check_bounds == 1 if are_boundschecks_forced @test_throws BoundsError āˆ‚.(w .* I.(Īø)) else @@ -215,7 +219,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) @test eltype(domain) === Geometry.ZPoint{FT} @@ -269,7 +273,7 @@ convergence_rate(err, Ī”h) = interval = Geometry.ZPoint(a) .. Geometry.ZPoint(b) domain = Domains.IntervalDomain( interval; - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = Meshes.IntervalMesh(domain, stretch_fn, nelems = n) @@ -317,7 +321,7 @@ end interval = Geometry.ZPoint(a) .. Geometry.ZPoint(b) domain = Domains.IntervalDomain( interval; - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = Meshes.IntervalMesh(domain, stretch_fn, nelems = n) @@ -368,7 +372,7 @@ end interval = Geometry.ZPoint(a) .. Geometry.ZPoint(b) domain = Domains.IntervalDomain( interval; - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = Meshes.IntervalMesh(domain, stretch_fn, nelems = n) @@ -419,7 +423,7 @@ end interval = Geometry.ZPoint(a) .. Geometry.ZPoint(b) domain = Domains.IntervalDomain( interval; - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = Meshes.IntervalMesh(domain, stretch_fn, nelems = n) @@ -474,7 +478,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = Meshes.IntervalMesh(domain; nelems = n) @@ -743,7 +747,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(-pi), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain, stretch_fn; nelems = n) @@ -804,7 +808,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(-pi), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain; nelems = n) @@ -915,7 +919,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(-pi), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain, stretch_fn; nelems = n) @@ -985,7 +989,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(-pi), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain; nelems = n) @@ -1044,7 +1048,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain; nelems = n_elems) @@ -1112,7 +1116,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(4Ļ€); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain; nelems = n) diff --git a/test/Operators/finitedifference/implicit_stencils_utils.jl b/test/Operators/finitedifference/implicit_stencils_utils.jl index dd7593b022..a5bf7dfdd8 100644 --- a/test/Operators/finitedifference/implicit_stencils_utils.jl +++ b/test/Operators/finitedifference/implicit_stencils_utils.jl @@ -69,7 +69,7 @@ function get_space(::Type{FT}) where {FT} vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zero(FT)), Geometry.ZPoint{FT}(zmax); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = velem) vtopology = diff --git a/test/Operators/finitedifference/linsolve.jl b/test/Operators/finitedifference/linsolve.jl index ba7e928f83..b7939586d8 100644 --- a/test/Operators/finitedifference/linsolve.jl +++ b/test/Operators/finitedifference/linsolve.jl @@ -23,7 +23,7 @@ hspace = Spaces.SpectralElementSpace2D(htopology, quad) vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zero(FT)), Geometry.ZPoint{FT}(zmax); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = velem) center_space = Spaces.CenterFiniteDifferenceSpace(vmesh) diff --git a/test/Operators/finitedifference/opt.jl b/test/Operators/finitedifference/opt.jl index a1046e29ef..61f51a7ddc 100644 --- a/test/Operators/finitedifference/opt.jl +++ b/test/Operators/finitedifference/opt.jl @@ -210,7 +210,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) mesh = Meshes.IntervalMesh(domain; nelems = 16) diff --git a/test/Operators/finitedifference/opt_examples.jl b/test/Operators/finitedifference/opt_examples.jl index 791afb7714..d588344096 100644 --- a/test/Operators/finitedifference/opt_examples.jl +++ b/test/Operators/finitedifference/opt_examples.jl @@ -445,7 +445,7 @@ end domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain; nelems = n_elems) cs = Spaces.CenterFiniteDifferenceSpace(mesh) diff --git a/test/Operators/finitedifference/opt_implicit_stencils.jl b/test/Operators/finitedifference/opt_implicit_stencils.jl index 4d3d892f9d..e2967a19b1 100644 --- a/test/Operators/finitedifference/opt_implicit_stencils.jl +++ b/test/Operators/finitedifference/opt_implicit_stencils.jl @@ -36,7 +36,7 @@ Operators.Operator2Stencil(op::CurriedTwoArgOperator) = vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zero(FT)), Geometry.ZPoint{FT}(zmax); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = velem) vspace = Spaces.CenterFiniteDifferenceSpace(vmesh) diff --git a/test/Operators/finitedifference/tensor.jl b/test/Operators/finitedifference/tensor.jl index 43b5d95b31..afac9b459c 100644 --- a/test/Operators/finitedifference/tensor.jl +++ b/test/Operators/finitedifference/tensor.jl @@ -13,22 +13,20 @@ using ClimaCore: using LinearAlgebra for FT in (Float32, Float64) + context = ClimaComms.context() hdomain = Domains.SphereDomain{FT}(6.37122e6) hmesh = Meshes.EquiangularCubedSphere(hdomain, 30) - htopology = Topologies.Topology2D(hmesh) + htopology = Topologies.Topology2D(context, hmesh) hspace = Spaces.SpectralElementSpace2D(htopology, Quadratures.GLL{4}()) vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(30e3); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) stretch = Meshes.GeneralizedExponentialStretching(FT(30), FT(5000)) vmesh = Meshes.IntervalMesh(vdomain, stretch; nelems = 45) - vtopology = Topologies.IntervalTopology( - ClimaComms.SingletonCommsContext(ClimaComms.device()), - vmesh, - ) + vtopology = Topologies.IntervalTopology(context, vmesh) vspace = Spaces.CenterFiniteDifferenceSpace(vtopology) cspace = Spaces.ExtrudedFiniteDifferenceSpace(hspace, vspace) diff --git a/test/Operators/finitedifference/wfact.jl b/test/Operators/finitedifference/wfact.jl index 901f084f39..64500f514b 100644 --- a/test/Operators/finitedifference/wfact.jl +++ b/test/Operators/finitedifference/wfact.jl @@ -33,7 +33,7 @@ hspace = Spaces.SpectralElementSpace2D(htopology, quad) vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zero(FT)), Geometry.ZPoint{FT}(zmax); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = velem) center_space = Spaces.CenterFiniteDifferenceSpace(vmesh) diff --git a/test/Operators/hybrid/2d.jl b/test/Operators/hybrid/2d.jl index 21e3a401de..16ac607686 100644 --- a/test/Operators/hybrid/2d.jl +++ b/test/Operators/hybrid/2d.jl @@ -32,7 +32,7 @@ function hvspace_2D(; vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, stretch, nelems = velem) vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) diff --git a/test/Operators/hybrid/3d.jl b/test/Operators/hybrid/3d.jl index bf8bc512d0..35d0037ae8 100644 --- a/test/Operators/hybrid/3d.jl +++ b/test/Operators/hybrid/3d.jl @@ -26,7 +26,7 @@ device = ClimaComms.device() vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(1.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 10) verttopology = Topologies.IntervalTopology( @@ -96,7 +96,7 @@ function hvspace_3D( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) verttopology = Topologies.IntervalTopology( diff --git a/test/Operators/hybrid/cuda.jl b/test/Operators/hybrid/cuda.jl index f0b48b9fd0..b0e0e5b761 100644 --- a/test/Operators/hybrid/cuda.jl +++ b/test/Operators/hybrid/cuda.jl @@ -30,7 +30,7 @@ function hvspace_3D_box( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) @@ -65,7 +65,7 @@ function hvspace_3D_sphere(context) vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(1.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 10) diff --git a/test/Operators/hybrid/dss_opt.jl b/test/Operators/hybrid/dss_opt.jl index cb859c3b3e..abe53d21e5 100644 --- a/test/Operators/hybrid/dss_opt.jl +++ b/test/Operators/hybrid/dss_opt.jl @@ -24,7 +24,7 @@ FT = Float64 vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(1.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 10) vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) diff --git a/test/Operators/hybrid/extruded_3dbox_cuda.jl b/test/Operators/hybrid/extruded_3dbox_cuda.jl index de9748e369..07d0941d6f 100644 --- a/test/Operators/hybrid/extruded_3dbox_cuda.jl +++ b/test/Operators/hybrid/extruded_3dbox_cuda.jl @@ -24,7 +24,7 @@ function get_space(context) vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(1.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 10) diff --git a/test/Operators/hybrid/extruded_sphere_cuda.jl b/test/Operators/hybrid/extruded_sphere_cuda.jl index 3a3731741b..d98cbc2bfa 100644 --- a/test/Operators/hybrid/extruded_sphere_cuda.jl +++ b/test/Operators/hybrid/extruded_sphere_cuda.jl @@ -24,7 +24,7 @@ function get_space(context) vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(1.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 10) diff --git a/test/Operators/hybrid/opt.jl b/test/Operators/hybrid/opt.jl index e34d784aca..52c054dbd5 100644 --- a/test/Operators/hybrid/opt.jl +++ b/test/Operators/hybrid/opt.jl @@ -241,7 +241,7 @@ end vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0.0), Geometry.ZPoint{FT}(pi); - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) vmesh = Meshes.IntervalMesh(vdomain; nelems = 16) cvspace = Spaces.CenterFiniteDifferenceSpace(vmesh) diff --git a/test/Operators/remapping.jl b/test/Operators/remapping.jl index 3017023035..9912372797 100644 --- a/test/Operators/remapping.jl +++ b/test/Operators/remapping.jl @@ -133,7 +133,7 @@ end @testset "Identity Operator" begin domain1D = Domains.IntervalDomain( Geometry.XPoint(-1.0) .. Geometry.XPoint(1.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) domain2D = Domains.RectangleDomain( Geometry.XPoint(-1.0) .. Geometry.XPoint(1.0), @@ -157,7 +157,7 @@ end @testset "Aligned Intervals Different Resolutions" begin domain = Domains.IntervalDomain( Geometry.XPoint(0.0) .. Geometry.XPoint(1.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) source = make_space(domain, 1, 4) @@ -200,13 +200,13 @@ end @testset "Unaligned Intervals Same Resolution" begin domain1 = Domains.IntervalDomain( Geometry.XPoint(-1.0) .. Geometry.XPoint(1.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) source = make_space(domain1, 1, 3) domain2 = Domains.IntervalDomain( Geometry.XPoint(0.0) .. Geometry.XPoint(2.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) target = make_space(domain2, 1, 3) @@ -227,13 +227,13 @@ end @testset "Concentric Domains of Different Length" begin domain1 = Domains.IntervalDomain( Geometry.XPoint(-1.0) .. Geometry.XPoint(1.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) source = make_space(domain1, 1, 4) domain2 = Domains.IntervalDomain( Geometry.XPoint(-0.5) .. Geometry.XPoint(0.5), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) target = make_space(domain2, 1, 4) @@ -404,7 +404,7 @@ end @testset "1D Domains" begin domain = Domains.IntervalDomain( Geometry.XPoint(0.0) .. Geometry.XPoint(1.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) @testset "Single aligned elements" begin @@ -511,7 +511,7 @@ end @testset "1D Domains" begin domain = Domains.IntervalDomain( Geometry.XPoint(0.0) .. Geometry.XPoint(1.0), - boundary_tags = (:left, :right), + boundary_names = (:left, :right), ) @testset "Single aligned elements" begin diff --git a/test/Operators/spectralelement/benchmark_utils.jl b/test/Operators/spectralelement/benchmark_utils.jl index bb222eeb49..fe70882231 100644 --- a/test/Operators/spectralelement/benchmark_utils.jl +++ b/test/Operators/spectralelement/benchmark_utils.jl @@ -127,7 +127,7 @@ function create_space( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{float_type}(zlim[1]), Geometry.ZPoint{float_type}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = z_elem) vtopology = Topologies.IntervalTopology(context, vertmesh) diff --git a/test/Operators/spectralelement/opt.jl b/test/Operators/spectralelement/opt.jl index 424a407a4c..697d2054c6 100644 --- a/test/Operators/spectralelement/opt.jl +++ b/test/Operators/spectralelement/opt.jl @@ -188,7 +188,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0), Geometry.ZPoint{FT}(1000); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = velem) vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) diff --git a/test/Operators/spectralelement/plane.jl b/test/Operators/spectralelement/plane.jl index faf7502649..b5539004e5 100644 --- a/test/Operators/spectralelement/plane.jl +++ b/test/Operators/spectralelement/plane.jl @@ -30,7 +30,7 @@ hspace = Spaces.SpectralElementSpace1D(htopology, quad) vdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(-pi), Geometry.ZPoint{FT}(pi); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vmesh = Meshes.IntervalMesh(vdomain, nelems = 16) vtopology = diff --git a/test/Remapping/distributed_remapping.jl b/test/Remapping/distributed_remapping.jl index 26b5f34451..1e7bd7d39b 100644 --- a/test/Remapping/distributed_remapping.jl +++ b/test/Remapping/distributed_remapping.jl @@ -30,7 +30,7 @@ if !(device isa ClimaComms.CUDADevice) vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) @@ -86,7 +86,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) @@ -166,7 +166,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) @@ -247,7 +247,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) diff --git a/test/Remapping/interpolate_array.jl b/test/Remapping/interpolate_array.jl index d16d0a1019..948343e047 100644 --- a/test/Remapping/interpolate_array.jl +++ b/test/Remapping/interpolate_array.jl @@ -18,7 +18,7 @@ device = ClimaComms.CPUSingleThreaded() vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) @@ -74,7 +74,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) @@ -129,7 +129,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) @@ -186,7 +186,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(1000.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = 30) diff --git a/test/Spaces/ddss1_cs.jl b/test/Spaces/ddss1_cs.jl index ea90819fcd..a2b95b6949 100644 --- a/test/Spaces/ddss1_cs.jl +++ b/test/Spaces/ddss1_cs.jl @@ -91,7 +91,7 @@ end z_domain = Domains.IntervalDomain( Geometry.ZPoint(zero(z_max)), Geometry.ZPoint(z_max); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) z_mesh = Meshes.IntervalMesh(z_domain, nelems = z_elem) z_topology = Topologies.IntervalTopology(context, z_mesh) diff --git a/test/Spaces/distributed_cuda/space_construction.jl b/test/Spaces/distributed_cuda/space_construction.jl index 8276032a2b..da99be802e 100644 --- a/test/Spaces/distributed_cuda/space_construction.jl +++ b/test/Spaces/distributed_cuda/space_construction.jl @@ -33,7 +33,7 @@ import ClimaCore: vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) vtopology = Topologies.IntervalTopology(vcontext, vertmesh) diff --git a/test/Spaces/extruded_cuda.jl b/test/Spaces/extruded_cuda.jl index 4f095749ee..4529ec7c0d 100644 --- a/test/Spaces/extruded_cuda.jl +++ b/test/Spaces/extruded_cuda.jl @@ -7,7 +7,8 @@ using ClimaComms using CUDA using ClimaComms: SingletonCommsContext import ClimaCore -import ClimaCore: Domains, Topologies, Meshes, Spaces, Geometry, column, Fields +import ClimaCore: + Domains, Topologies, Meshes, Spaces, Geometry, column, Fields, Grids using Test include( @@ -16,8 +17,7 @@ include( import .TestUtilities as TU compare(cpu, gpu) = all(parent(cpu) .ā‰ˆ Array(parent(gpu))) -compare(cpu, gpu, sym) = - all(parent(getproperty(cpu, sym)) .ā‰ˆ Array(parent(getproperty(gpu, sym)))) +compare(cpu, gpu, f) = all(parent(f(cpu)) .ā‰ˆ Array(parent(f(gpu)))) @testset "CuArray-backed extruded spaces" begin context = SingletonCommsContext( @@ -40,8 +40,16 @@ end gpuspace = TU.CenterExtrudedFiniteDifferenceSpace(FT; context = gpu_context) # Test that all geometries match with CPU version: - @test compare(cpuspace, gpuspace, :center_local_geometry) - @test compare(cpuspace, gpuspace, :face_local_geometry) + @test compare( + cpuspace, + gpuspace, + x -> Spaces.local_geometry_data(Spaces.grid(x), Grids.CellCenter()), + ) + @test compare( + cpuspace, + gpuspace, + x -> Spaces.local_geometry_data(Spaces.grid(x), Grids.CellFace()), + ) space = gpuspace Y = Fields.Field(typeof((; v = FT(0))), space) @@ -62,7 +70,7 @@ end gpuspace = TU.SpectralElementSpace2D(FT; context = gpu_context) # Test that all geometries match with CPU version: - @test compare(cpuspace, gpuspace, :local_geometry) + @test compare(cpuspace, gpuspace, x -> Spaces.local_geometry_data(x)) space = gpuspace Y = Fields.Field(typeof((; v = FT(0))), space) diff --git a/test/Spaces/spaces.jl b/test/Spaces/spaces.jl index b0e08ea6ca..c09da20faa 100644 --- a/test/Spaces/spaces.jl +++ b/test/Spaces/spaces.jl @@ -83,7 +83,7 @@ on_gpu || @testset "extruded (2d 1Ɨ3) finite difference space" begin vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(0), Geometry.ZPoint{FT}(10); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, Meshes.Uniform(), nelems = 10) @@ -208,8 +208,8 @@ end @test coord_slab[1, 4] ā‰ˆ Geometry.XYPoint{FT}(-3.0, 8.0) @test coord_slab[4, 4] ā‰ˆ Geometry.XYPoint{FT}(5.0, 8.0) - local_geometry_slab = slab(space.grid.local_geometry, 1) - dss_weights_slab = slab(space.grid.local_dss_weights, 1) + local_geometry_slab = slab(Spaces.local_geometry_data(space), 1) + dss_weights_slab = slab(Spaces.local_dss_weights(space), 1) if on_gpu adapted_space = adapt(space)(space) @@ -232,11 +232,11 @@ end end end - @test length(space.grid.boundary_surface_geometries) == 2 - @test keys(space.grid.boundary_surface_geometries) == (:south, :north) - @test sum(parent(space.grid.boundary_surface_geometries.north.sWJ)) ā‰ˆ 8 - @test parent(space.grid.boundary_surface_geometries.north.normal)[1, :, 1] ā‰ˆ - [0.0, 1.0] + boundary_surface_geometries = Spaces.grid(space).boundary_surface_geometries + @test length(boundary_surface_geometries) == 2 + @test keys(boundary_surface_geometries) == (:south, :north) + @test sum(parent(boundary_surface_geometries.north.sWJ)) ā‰ˆ 8 + @test parent(boundary_surface_geometries.north.normal)[1, :, 1] ā‰ˆ [0.0, 1.0] point_space = Spaces.column(space, 1, 1, 1) @test point_space isa Spaces.PointSpace diff --git a/test/Spaces/sphere.jl b/test/Spaces/sphere.jl index a2dedb922a..17305d9536 100644 --- a/test/Spaces/sphere.jl +++ b/test/Spaces/sphere.jl @@ -96,7 +96,7 @@ end vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) vertgrid = Grids.FiniteDifferenceGrid(vertmesh) diff --git a/test/Spaces/terrain_warp.jl b/test/Spaces/terrain_warp.jl index 0f5fb52cb1..c97163c080 100644 --- a/test/Spaces/terrain_warp.jl +++ b/test/Spaces/terrain_warp.jl @@ -6,6 +6,7 @@ import ClimaCore: ClimaCore, Domains, Geometry, + Grids, Fields, Operators, Meshes, @@ -53,7 +54,7 @@ function generate_base_spaces( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, stretch, nelems = velem) vert_face_space = Spaces.FaceFiniteDifferenceSpace(vertmesh) @@ -439,21 +440,26 @@ end hspace = Spaces.SpectralElementSpace1D(horztopology, quad) # Generate surface elevation profile - z_surface = warp_sin_2d.(Fields.coordinate_field(hspace)) + z_surface = + Geometry.ZPoint.(warp_sin_2d.(Fields.coordinate_field(hspace))) # Generate space with known mesh-warp parameters Ī·ā‚• = 1; s = 1 fspace = Spaces.ExtrudedFiniteDifferenceSpace( hspace, vert_face_space, Hypsography.SLEVEAdaption(z_surface, FT(1), FT(1)), ) + face_local_geometry = Spaces.local_geometry_data( + Spaces.grid(fspace), + Grids.CellFace(), + ) for i in 1:(nl + 1) z_extracted = Fields.Field( - Fields.level(fspace.face_local_geometry.coordinates.z, i), + Fields.level(face_local_geometry.coordinates.z, i), fspace, ) Ī· = FT((i - 1) / 10) z_surface_known = - @. FT(Ī·) + z_surface * FT(sinh(1 - Ī·) / sinh(1)) + @. FT(Ī·) + z_surface.z * FT(sinh(1 - Ī·) / sinh(1)) @test maximum( abs.( Fields.field_values(z_extracted) .- @@ -493,7 +499,8 @@ end hspace = Spaces.SpectralElementSpace1D(horztopology, quad) # Generate surface elevation profile - z_surface = warp_sin_2d.(Fields.coordinate_field(hspace)) + z_surface = + Geometry.ZPoint.(warp_sin_2d.(Fields.coordinate_field(hspace))) # Generate space with known mesh-warp parameters Ī·ā‚• = 1; s = 0.1 # Scale height is poorly specified, so code should throw warning. @test_throws ErrorException Spaces.ExtrudedFiniteDifferenceSpace( diff --git a/test/TestUtilities/TestUtilities.jl b/test/TestUtilities/TestUtilities.jl index 720393c3f0..3fb60eab91 100644 --- a/test/TestUtilities/TestUtilities.jl +++ b/test/TestUtilities/TestUtilities.jl @@ -72,7 +72,7 @@ function ColumnCenterFiniteDifferenceSpace( domain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh = Meshes.IntervalMesh(domain, nelems = zelem) topology = Topologies.IntervalTopology(context, mesh) @@ -115,7 +115,7 @@ function CenterExtrudedFiniteDifferenceSpace( vertdomain = Domains.IntervalDomain( Geometry.ZPoint{FT}(zlim[1]), Geometry.ZPoint{FT}(zlim[2]); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = zelem) vtopology = Topologies.IntervalTopology(context, vertmesh) diff --git a/test/Topologies/interval.jl b/test/Topologies/interval.jl index 11be63f170..c9643e87c7 100644 --- a/test/Topologies/interval.jl +++ b/test/Topologies/interval.jl @@ -7,7 +7,7 @@ using ClimaCore: Geometry, Domains, Meshes, Topologies domain = Domains.IntervalDomain( Geometry.ZPoint(0.0), Geometry.ZPoint(10.0); - boundary_tags = (:bottom, :top), + boundary_names = (:bottom, :top), ) mesh1 = Meshes.IntervalMesh(domain, [Geometry.ZPoint(Float64(i)) for i in 0:10]) mesh2 = Meshes.IntervalMesh(domain, [Geometry.ZPoint(Float64(i)) for i in 0:10])