Skip to content

Commit

Permalink
Merge pull request #1581 from CliMA/ck/cleanup
Browse files Browse the repository at this point in the history
Remove duplicate quadratures module
  • Loading branch information
charleskawczynski authored Dec 20, 2023
2 parents d261a88 + 2dc2b09 commit 2979991
Show file tree
Hide file tree
Showing 118 changed files with 620 additions and 603 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ steps:
- group: "Unit: Spaces"
steps:

- label: "Unit: quadrature"
- label: "Unit: Quadratures"
key: unit_quadrature
command: "julia --color=yes --check-bounds=yes --project=test test/Spaces/quadrature.jl"
command: "julia --color=yes --check-bounds=yes --project=test test/Quadratures/Quadratures.jl"

- label: "Unit: spaces"
key: unit_spaces
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/3d/se_kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ClimaCore:
Meshes,
Operators,
Spaces,
Quadratures,
Topologies,
DataLayouts,
RecursiveApply
Expand Down Expand Up @@ -73,7 +74,7 @@ function initialize_mwe(device, ::Type{FT}) where {FT}
horizontal_mesh,
Topologies.spacefillingcurve(horizontal_mesh),
)
quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
h_space = Spaces.SpectralElementSpace2D(horizontal_topology, quad)

# vertical space
Expand Down
11 changes: 9 additions & 2 deletions benchmarks/3d/vector_laplacian.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@

using ClimaComms
using ClimaCore:
Geometry, Domains, Meshes, Topologies, Spaces, Fields, Operators
Geometry,
Domains,
Meshes,
Topologies,
Spaces,
Fields,
Operators,
Quadratures
using CUDA, BenchmarkTools

hdomain = Domains.SphereDomain(6.37122e6)
hmesh = Meshes.EquiangularCubedSphere(hdomain, 30)
htopology = Topologies.Topology2D(hmesh)
hspace = Spaces.SpectralElementSpace2D(htopology, Spaces.Quadratures.GLL{4}())
hspace = Spaces.SpectralElementSpace2D(htopology, Quadratures.GLL{4}())

vdomain = Domains.IntervalDomain(
Geometry.ZPoint(0.0),
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/bickleyjet/bickleyjet_dg_reference.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Base.Threads
import ClimaCore.Spaces
import ClimaCore.Quadratures
using CUDA

function spaceconfig(::Val{Nq}, ::Type{DA} = Array) where {Nq, DA}
quad = Spaces.Quadratures.GLL{Nq}()
ξ, W = Spaces.Quadratures.quadrature_points(Float64, quad)
D = Spaces.Quadratures.differentiation_matrix(Float64, quad)
quad = Quadratures.GLL{Nq}()
ξ, W = Quadratures.quadrature_points(Float64, quad)
D = Quadratures.differentiation_matrix(Float64, quad)
return (DA(ξ), DA(W), DA(D))
end

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bickleyjet/core_vs_ref.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for Nq in Nqs
# setup core
mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(mesh)
quad = Spaces.Quadratures.GLL{Nq}()
quad = Quadratures.GLL{Nq}()
space = Spaces.SpectralElementSpace2D(grid_topology, quad)

y0 = init_state.(Fields.coordinate_field(space), Ref(parameters))
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bickleyjet/run_ref_thread.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Nq = 4

mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(mesh)
quad = Spaces.Quadratures.GLL{Nq}()
quad = Quadratures.GLL{Nq}()
space = Spaces.SpectralElementSpace2D(grid_topology, quad)

X = coordinates(Val(Nq), n1, n2)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/lib/ClimaCoreTempestRemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ apply_remap
The following example converts an OrdinaryDiffEq solution object `sol` to a netcdf file, and remaps it to an regular latitude-longitude (RLL) grid.

```julia
using ClimaCore: Geometry, Meshes, Domains, Topologies, Spaces
using ClimaCore: Geometry, Meshes, Domains, Topologies, Spaces, Quadratures
using NCDatasets, ClimaCoreTempestRemap

# sol is the integrator solution
Expand All @@ -58,7 +58,7 @@ using NCDatasets, ClimaCoreTempestRemap

# the issue is that the Space types changed since this changed
# we can reconstruct it by digging around a bit
Nq = Spaces.Quadratures.degrees_of_freedom(Spaces.quadrature_style(cspace))
Nq = Quadratures.degrees_of_freedom(Spaces.quadrature_style(cspace))

datafile_cc = "test.nc"
NCDataset(datafile_cc, "c") do nc
Expand Down Expand Up @@ -115,7 +115,7 @@ remap_weights(
meshfile_rll,
meshfile_overlap;
in_type = "cgll",
in_np = Spaces.Quadratures.degrees_of_freedom(Spaces.quadrature_style(cspace)),
in_np = Quadratures.degrees_of_freedom(Spaces.quadrature_style(cspace)),
)

# apply remap
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/introduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ column_face_space =
# These nodes are chosen by a particular *quadrature rule*, which allows us to integrate functions over the domain. The only supported choice for now is a Gauss-Legendre-Lobatto rule.

## Gauss-Legendre-Lobatto quadrature with 4 nodes in each direction, so 16 in each element
quad = ClimaCore.Spaces.Quadratures.GLL{4}()
quad = ClimaCore.Quadratures.GLL{4}()
rectangle_space =
ClimaCore.Spaces.SpectralElementSpace2D(rectangle_topology, quad)
#----------------------------------------------------------------------------
Expand Down
13 changes: 10 additions & 3 deletions examples/bickleyjet/bickleyjet_cg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ using ClimaComms
using LinearAlgebra

import ClimaCore:
Domains, Fields, Geometry, Meshes, Operators, Spaces, Topologies
Domains,
Fields,
Geometry,
Meshes,
Operators,
Spaces,
Topologies,
Quadratures
import ClimaCore.Geometry:

using OrdinaryDiffEq: ODEProblem, solve, SSPRK33
Expand Down Expand Up @@ -40,10 +47,10 @@ Nq = 4
Nqh = 7
mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(context, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
quad = Quadratures.GLL{Nq}()
space = Spaces.SpectralElementSpace2D(grid_topology, quad)

Iquad = Spaces.Quadratures.GLL{Nqh}()
Iquad = Quadratures.GLL{Nqh}()
Ispace = Spaces.SpectralElementSpace2D(grid_topology, Iquad)

function init_state(coord, p)
Expand Down
3 changes: 2 additions & 1 deletion examples/bickleyjet/bickleyjet_cg_invariant_hypervisc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ClimaCore:
Operators,
Spaces,
Topologies,
Quadratures,
DataLayouts
using OrdinaryDiffEq: ODEProblem, solve, SSPRK33

Expand Down Expand Up @@ -55,7 +56,7 @@ domain = Domains.RectangleDomain(
)
n1, n2 = 16, 16
Nq = 4
quad = Spaces.Quadratures.GLL{Nq}()
quad = Quadratures.GLL{Nq}()
mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(context, mesh)
if usempi
Expand Down
13 changes: 10 additions & 3 deletions examples/bickleyjet/bickleyjet_cg_unsmesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ using ClimaComms
using LinearAlgebra

import ClimaCore:
Domains, Fields, Geometry, Meshes, Operators, Spaces, Topologies
Domains,
Fields,
Geometry,
Meshes,
Operators,
Spaces,
Topologies,
Quadratures
import ClimaCore.Geometry:

using OrdinaryDiffEq: ODEProblem, solve, SSPRK33
Expand Down Expand Up @@ -41,10 +48,10 @@ Nqh = 7

mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(context, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
quad = Quadratures.GLL{Nq}()
space = Spaces.SpectralElementSpace2D(grid_topology, quad)

Iquad = Spaces.Quadratures.GLL{Nqh}()
Iquad = Quadratures.GLL{Nqh}()
Ispace = Spaces.SpectralElementSpace2D(grid_topology, Iquad)

function init_state(coord, p)
Expand Down
7 changes: 4 additions & 3 deletions examples/bickleyjet/bickleyjet_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ClimaCore:
Operators,
RecursiveApply,
Spaces,
Quadratures,
Topologies
import ClimaCore.Geometry:
import ClimaCore.RecursiveApply: , rdiv, rmap
Expand Down Expand Up @@ -51,10 +52,10 @@ Nq = 4
Nqh = 7
mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(context, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
quad = Quadratures.GLL{Nq}()
space = Spaces.SpectralElementSpace2D(grid_topology, quad)

Iquad = Spaces.Quadratures.GLL{Nqh}()
Iquad = Quadratures.GLL{Nqh}()
Ispace = Spaces.SpectralElementSpace2D(grid_topology, Iquad)

function init_state(coord, p)
Expand Down Expand Up @@ -206,7 +207,7 @@ 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)
M = Spaces.Quadratures.cutoff_filter_matrix(
M = Quadratures.cutoff_filter_matrix(
Float64,
Spaces.quadrature_style(space),
3,
Expand Down
6 changes: 3 additions & 3 deletions examples/common_spaces.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ClimaComms
using ClimaCore: Geometry, Domains, Meshes, Topologies, Spaces
using ClimaCore: Geometry, Domains, Meshes, Topologies, Spaces, Quadratures

function periodic_line_mesh(; x_max, x_elem)
domain = Domains.IntervalDomain(
Expand Down Expand Up @@ -36,7 +36,7 @@ function make_horizontal_space(
npoly,
context::ClimaComms.SingletonCommsContext,
)
quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
if mesh isa Meshes.AbstractMesh1D
topology = Topologies.IntervalTopology(mesh)
space = Spaces.SpectralElementSpace1D(topology, quad)
Expand All @@ -52,7 +52,7 @@ function make_horizontal_space(
npoly,
comms_ctx::ClimaComms.MPICommsContext,
)
quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
if mesh isa Meshes.AbstractMesh1D
error("Distributed mode does not work with 1D horizontal spaces.")
elseif mesh isa Meshes.AbstractMesh2D
Expand Down
5 changes: 3 additions & 2 deletions examples/hybrid/box/bubble_3d_invariant_rhoe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import ClimaCore:
Geometry,
Topologies,
Spaces,
Quadratures,
Fields,
Operators
using ClimaCorePlots, Plots
Expand Down Expand Up @@ -149,7 +150,7 @@ function hvspace_3D(
)
Nv = Meshes.nelements(vertmesh)
Nf_center, Nf_face = 2, 1 #1 + 3 + 1
quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
horzmesh = Meshes.RectilinearMesh(horzdomain, xyelem, xyelem)
horztopology = Topologies.Topology2D(comms_ctx, horzmesh)
horzspace = Spaces.SpectralElementSpace2D(horztopology, quad)
Expand Down Expand Up @@ -191,7 +192,7 @@ end
function compute_κ₄(sim_params::SimulationParameters{FT}) where {FT}
(; lxy, xyelem, npoly) = sim_params
quad_points, _ =
Spaces.Quadratures.quadrature_points(FT, Quadratures.GLL{npoly + 1}())
Quadratures.quadrature_points(FT, Quadratures.GLL{npoly + 1}())
Δx = (lxy / xyelem) * diff(quad_points)[1] / 2
κ₄ = 1.0e6 * (Δx / lxy)^3.2
return κ₄
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid/box/bubble_3d_invariant_rhotheta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ using LinearAlgebra
import ClimaCore:
ClimaCore,
slab,
Spaces,
Domains,
Meshes,
Geometry,
Topologies,
Spaces,
Quadratures,
Fields,
Operators
using ClimaCore.Geometry
Expand Down Expand Up @@ -56,7 +56,7 @@ function hvspace_3D(
vertmesh = Meshes.IntervalMesh(zdomain, nelems = zelem)
vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh)

quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
horzspace = Spaces.SpectralElementSpace2D(horztopology, quad)

hv_center_space =
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid/box/bubble_3d_rhotheta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ using LinearAlgebra, StaticArrays
import ClimaCore:
ClimaCore,
slab,
Spaces,
Domains,
Meshes,
Geometry,
Topologies,
Spaces,
Quadratures,
Fields,
Operators
import ClimaCore.Geometry:
Expand Down Expand Up @@ -55,7 +55,7 @@ function hvspace_3D(
vertmesh = Meshes.IntervalMesh(zdomain, nelems = zelem)
vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh)

quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
horzspace = Spaces.SpectralElementSpace2D(horztopology, quad)

hv_center_space =
Expand Down
3 changes: 2 additions & 1 deletion examples/hybrid/box/limiters_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ClimaCore:
Meshes,
Operators,
Spaces,
Quadratures,
Topologies,
Limiters,
slab
Expand Down Expand Up @@ -80,7 +81,7 @@ function hvspace_3D(
z_topology = Topologies.IntervalTopology(context, z_mesh)
z_space = Spaces.CenterFiniteDifferenceSpace(z_topology)

quad = Spaces.Quadratures.GLL{Nij}()
quad = Quadratures.GLL{Nij}()
hspace = Spaces.SpectralElementSpace2D(horztopology, quad)
cspace = Spaces.ExtrudedFiniteDifferenceSpace(hspace, z_space)
fspace = Spaces.FaceExtrudedFiniteDifferenceSpace(cspace)
Expand Down
3 changes: 2 additions & 1 deletion examples/hybrid/hybrid3dcs_dss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ClimaCore:
Meshes,
Operators,
Spaces,
Quadratures,
Topologies,
DataLayouts

Expand Down Expand Up @@ -69,7 +70,7 @@ function hybrid3dcubedsphere_dss_profiler(
z_stretch_string = "uniform"
horizontal_mesh = cubed_sphere_mesh(; radius = R, h_elem = h_elem)

quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
h_topology = Topologies.Topology2D(
comms_ctx,
horizontal_mesh,
Expand Down
3 changes: 2 additions & 1 deletion examples/hybrid/plane/bubble_2d_invariant_rhoe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ClimaCore:
Geometry,
Topologies,
Spaces,
Quadratures,
Fields,
Operators
using ClimaCore.Geometry
Expand Down Expand Up @@ -44,7 +45,7 @@ function hvspace_2D(
horzmesh = Meshes.IntervalMesh(horzdomain, nelems = xelem)
horztopology = Topologies.IntervalTopology(horzmesh)

quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
horzspace = Spaces.SpectralElementSpace1D(horztopology, quad)

hv_center_space =
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid/plane/density_current_2d_flux_form.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ using LinearAlgebra, StaticArrays
import ClimaCore:
ClimaCore,
slab,
Spaces,
Domains,
Meshes,
Geometry,
Topologies,
Spaces,
Quadratures,
Fields,
Operators
import ClimaCore.Geometry:
Expand Down Expand Up @@ -43,7 +43,7 @@ function hvspace_2D(
horzmesh = Meshes.IntervalMesh(horzdomain; nelems = helem)
horztopology = Topologies.IntervalTopology(horzmesh)

quad = Spaces.Quadratures.GLL{npoly + 1}()
quad = Quadratures.GLL{npoly + 1}()
horzspace = Spaces.SpectralElementSpace1D(horztopology, quad)

hv_center_space =
Expand Down
Loading

0 comments on commit 2979991

Please sign in to comment.