Skip to content

Commit

Permalink
Try #1487:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Oct 24, 2023
2 parents f31a62a + 529d48b commit 39dac54
Show file tree
Hide file tree
Showing 67 changed files with 3,106 additions and 2,563 deletions.
4 changes: 2 additions & 2 deletions .dev/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ version = "0.21.4"

[[deps.JuliaFormatter]]
deps = ["CSTParser", "CommonMark", "DataStructures", "Glob", "Pkg", "PrecompileTools", "Tokenize"]
git-tree-sha1 = "80031f6e58b09b0de4553bf63d9a36ec5db57967"
git-tree-sha1 = "0bac3374ff3aa798148669ecb5559ba20c8b0e73"
uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
version = "1.0.39"
version = "1.0.40"

[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
Expand Down
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Memoize = "c03570c3-d221-55d1-a50c-7939bbd78826"
PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Expand All @@ -28,6 +29,7 @@ Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
WeakValueDicts = "897b6980-f191-5a31-bcb0-bf3c4585e0c1"

[compat]
Adapt = "3"
Expand All @@ -43,13 +45,15 @@ GaussQuadrature = "0.5"
GilbertCurves = "0.1"
HDF5 = "0.16, 0.17"
IntervalSets = "0.5, 0.6, 0.7"
Memoize = "0.4"
PkgVersion = "0.1, 0.2, 0.3"
RecursiveArrayTools = "2"
Requires = "1"
RootSolvers = "0.3, 0.4"
Static = "0.4, 0.5, 0.6, 0.7, 0.8"
StaticArrays = "1"
UnPack = "1"
WeakValueDicts = "0.1"
julia = "1.8"

[extras]
Expand Down
13 changes: 12 additions & 1 deletion docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ uuid = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
version = "0.5.5"

[[deps.ClimaCore]]
deps = ["Adapt", "BandedMatrices", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "LinearAlgebra", "PkgVersion", "RecursiveArrayTools", "Requires", "RootSolvers", "SparseArrays", "Static", "StaticArrays", "Statistics", "UnPack"]
deps = ["Adapt", "BandedMatrices", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "LinearAlgebra", "Memoize", "PkgVersion", "RecursiveArrayTools", "Requires", "RootSolvers", "SparseArrays", "Static", "StaticArrays", "Statistics", "UnPack", "WeakValueDicts"]
path = ".."
uuid = "d414da3d-4745-48bb-8d80-42e94e092884"
version = "0.10.55"
Expand Down Expand Up @@ -1477,6 +1477,12 @@ git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102"
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
version = "0.3.2"

[[deps.Memoize]]
deps = ["MacroTools"]
git-tree-sha1 = "2b1dfcba103de714d31c033b5dacc2e4a12c7caa"
uuid = "c03570c3-d221-55d1-a50c-7939bbd78826"
version = "0.4.4"

[[deps.MicrosoftMPI_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "a7023883872e52bc29bcaac74f19adf39347d2d5"
Expand Down Expand Up @@ -2543,6 +2549,11 @@ git-tree-sha1 = "4528479aa01ee1b3b4cd0e6faef0e04cf16466da"
uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91"
version = "1.25.0+0"

[[deps.WeakValueDicts]]
git-tree-sha1 = "98528c2610a5479f091d470967a25becfd83edd0"
uuid = "897b6980-f191-5a31-bcb0-bf3c4585e0c1"
version = "0.1.0"

[[deps.WoodburyMatrices]]
deps = ["LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "de67fa59e33ad156a590055375a30b23c40299d3"
Expand Down
1 change: 0 additions & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ Spaces.dss_ghost!
Spaces.create_dss_buffer
Spaces.fill_send_buffer!
Spaces.DSSBuffer
Spaces.create_ghost_buffer
Spaces.load_from_recv_buffer!
Spaces.weighted_dss_start!
Spaces.weighted_dss_internal!
Expand Down
13 changes: 12 additions & 1 deletion examples/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ uuid = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
version = "0.5.5"

[[deps.ClimaCore]]
deps = ["Adapt", "BandedMatrices", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "LinearAlgebra", "PkgVersion", "RecursiveArrayTools", "Requires", "RootSolvers", "SparseArrays", "Static", "StaticArrays", "Statistics", "UnPack"]
deps = ["Adapt", "BandedMatrices", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "LinearAlgebra", "Memoize", "PkgVersion", "RecursiveArrayTools", "Requires", "RootSolvers", "SparseArrays", "Static", "StaticArrays", "Statistics", "UnPack", "WeakValueDicts"]
path = ".."
uuid = "d414da3d-4745-48bb-8d80-42e94e092884"
version = "0.10.55"
Expand Down Expand Up @@ -1226,6 +1226,12 @@ git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102"
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
version = "0.3.2"

[[deps.Memoize]]
deps = ["MacroTools"]
git-tree-sha1 = "2b1dfcba103de714d31c033b5dacc2e4a12c7caa"
uuid = "c03570c3-d221-55d1-a50c-7939bbd78826"
version = "0.4.4"

[[deps.MicroCollections]]
deps = ["BangBang", "InitialValues", "Setfield"]
git-tree-sha1 = "629afd7d10dbc6935ec59b32daeb33bc4460a42e"
Expand Down Expand Up @@ -2082,6 +2088,11 @@ git-tree-sha1 = "4528479aa01ee1b3b4cd0e6faef0e04cf16466da"
uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91"
version = "1.25.0+0"

[[deps.WeakValueDicts]]
git-tree-sha1 = "98528c2610a5479f091d470967a25becfd83edd0"
uuid = "897b6980-f191-5a31-bcb0-bf3c4585e0c1"
version = "0.1.0"

[[deps.WriteVTK]]
deps = ["Base64", "CodecZlib", "FillArrays", "LightXML", "TranscodingStreams", "VTKBase"]
git-tree-sha1 = "41f0dc2a8f6fd860c266b91fd5cdf4fead65ae69"
Expand Down
2 changes: 1 addition & 1 deletion examples/bickleyjet/bickleyjet_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function rhs!(dydt, y, (parameters, numflux), t)
dydt_data .= RecursiveApply.rdiv.(dydt_data, space.local_geometry.WJ)
M = Spaces.Quadratures.cutoff_filter_matrix(
Float64,
space.quadrature_style,
Spaces.quadrature_style(space),
3,
)
Operators.tensor_product!(dydt_data, M)
Expand Down
8 changes: 3 additions & 5 deletions examples/hybrid/hybrid3dcs_dss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,16 @@ function hybrid3dcubedsphere_dss_profiler(
c = center_initial_condition(ᶜlocal_geometry),
f = face_initial_condition(ᶠlocal_geometry),
)
ghost_buffer = (
c = Spaces.create_ghost_buffer(Y.c),
f = Spaces.create_ghost_buffer(Y.f),
)
ghost_buffer =
(c = Spaces.create_dss_buffer(Y.c), f = Spaces.create_dss_buffer(Y.f))
dss_buffer_f = Spaces.create_dss_buffer(Y.f)
dss_buffer_c = Spaces.create_dss_buffer(Y.c)
nsamples = 10000
nsamplesprofiling = 100

# precompile relevant functions
space = axes(Y.c)
horizontal_topology = space.horizontal_space.topology
horizontal_topology = Spaces.topology(space)
Spaces.weighted_dss_internal!(Y.c, ghost_buffer.c)
weighted_dss_full!(Y.c, ghost_buffer.c)
Spaces.fill_send_buffer!(
Expand Down
2 changes: 1 addition & 1 deletion examples/hybrid/sphere/deformation_flow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function run_deformation_flow(use_limiter, fct_op)
Geometry.LatLongZPoint(ϕ_c, λ_c1, FT(0)),
Geometry.LatLongZPoint(ϕ_c, λ_c2, FT(0)),
)
horz_geometry = horz_space.global_geometry
horz_geometry = Spaces.global_geometry(horz_space)
rds = map(centers) do center
Geometry.great_circle_distance(coord, center, horz_geometry)
end
Expand Down
2 changes: 1 addition & 1 deletion examples/hybrid/sphere/hadley_circulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ end

# write out our cubed sphere mesh
meshfile_cc = remap_tmpdir * "mesh_cubedsphere.g"
write_exodus(meshfile_cc, hv_center_space.horizontal_space.topology)
write_exodus(meshfile_cc, Spaces.topology(hv_center_space))

# write out RLL mesh
nlat = 90
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid/sphere/remap_pipeline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function remap2latlon(filein, nc_dir, nlat, nlon)
# reconstruct space, obtain Nq from space
cspace = axes(Y.c)
hspace = Spaces.horizontal_space(cspace)
Nq = Spaces.Quadratures.degrees_of_freedom(hspace.quadrature_style)
Nq = Spaces.Quadratures.degrees_of_freedom(Spaces.quadrature_style(hspace))

# create a temporary dir for intermediate data
remap_tmpdir = nc_dir * "remaptmp/"
Expand Down Expand Up @@ -97,7 +97,7 @@ function remap2latlon(filein, nc_dir, nlat, nlon)

# write out our cubed sphere mesh
meshfile_cc = remap_tmpdir * "mesh_cubedsphere.g"
write_exodus(meshfile_cc, hspace.topology)
write_exodus(meshfile_cc, Spaces.topology(hspace))

meshfile_rll = remap_tmpdir * "mesh_rll.g"
rll_mesh(meshfile_rll; nlat = nlat, nlon = nlon)
Expand Down
4 changes: 2 additions & 2 deletions examples/sphere/limiters_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ for (k, ne) in enumerate(ne_seq)
Spaces.SpectralElementSpace2D(grid_topology, quad; enable_bubble = true)

# Initialize variables needed for limiters
n_elems = Topologies.nlocalelems(space.topology)
n_elems = Topologies.nlocalelems(Spaces.topology(space))
min_q = zeros(n_elems)
max_q = zeros(n_elems)

coords = Fields.coordinate_field(space)
Δh[k] = 2 * R / ne
global_geom = space.global_geometry
global_geom = Spaces.global_geometry(space)

# Initialize state
y0 = map(coords) do coord
Expand Down
4 changes: 2 additions & 2 deletions examples/sphere/shallow_water_cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ function rhs!(dYdt_fv, y_fv, parameters, t)
wcurl(Geometry.Covariant3Vector(curl(y.u))),
)

NVTX.@range "dss" Spaces.weighted_dss2!(dYdt, ghost_buffer)
NVTX.@range "dss" Spaces.weighted_dss!(dYdt, ghost_buffer)
end

NVTX.@range "tendency" begin
Expand All @@ -489,7 +489,7 @@ function rhs!(dYdt_fv, y_fv, parameters, t)
dYdt.u += -grad(g * (y.h + h_s) + norm(y.u)^2 / 2) #+
dYdt.u += y.u × (f + curl(y.u))
end
NVTX.@range "dss" Spaces.weighted_dss2!(dYdt, ghost_buffer)
NVTX.@range "dss" Spaces.weighted_dss!(dYdt, ghost_buffer)
end
end
return dYdt_fv
Expand Down
2 changes: 1 addition & 1 deletion examples/sphere/solidbody.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ for (k, ne) in enumerate(ne_seq)

Δh[k] = 2 * R / ne

global_geom = space.global_geometry
global_geom = Spaces.global_geometry(space)

h_init = map(coords) do coord
rd = Geometry.great_circle_distance(coord, center, global_geom)
Expand Down
2 changes: 1 addition & 1 deletion lib/ClimaCoreMakie/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function plot_vertices(
space,
ClimaCore.Geometry.Cartesian123Point.(
ClimaCore.Fields.coordinate_field(space),
Ref(space.global_geometry),
Ref(Spaces.global_geometry(space)),
),
)
end
Expand Down
18 changes: 7 additions & 11 deletions lib/ClimaCorePlots/src/ClimaCorePlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ RecipesBase.@recipe function f(
coord_field = Fields.coordinate_field(space)

lagrange_quad = Spaces.Quadratures.ClosedUniform{Nu}()
dataspace = Spaces.SpectralElementSpace1D(space.topology, lagrange_quad)
dataspace =
Spaces.SpectralElementSpace1D(Spaces.topology(space), lagrange_quad)
interp = Operators.Interpolate(dataspace)
ifield = interp.(field)

Expand Down Expand Up @@ -98,7 +99,7 @@ RecipesBase.@recipe function f(space::Spaces.ExtrudedFiniteDifferenceSpace)
#TODO: assumes VIFH layout
@assert Nj == 1 "plotting only defined for 1D extruded fields"

hspace = space.horizontal_space
hspace = Spaces.horizontal_space(space)

quad = Spaces.quadrature_style(hspace)
quad_name = Base.typename(typeof(quad)).name
Expand Down Expand Up @@ -195,7 +196,7 @@ function _slice_triplot(field, hinterpolate, ncolors)
Ni, Nj, _, Nv, Nh = size(data)

space = axes(field)
htopology = Spaces.topology(space.horizontal_space)
htopology = Spaces.topology(space)
hdomain = Topologies.domain(htopology)
vdomain = Topologies.domain(space.vertical_topology)

Expand Down Expand Up @@ -251,12 +252,7 @@ RecipesBase.@recipe function f(
field::Fields.Field{<:Any, S};
hinterpolate = 0,
ncolors = 256,
) where {
S <: Spaces.ExtrudedFiniteDifferenceSpace{
<:Any,
<:Spaces.IntervalSpectralElementSpace1D,
},
}
) where {S <: Spaces.ExtrudedFiniteDifferenceSpace2D}
hcoord, vcoord, data = _slice_triplot(field, hinterpolate, ncolors)
coord_symbols = propertynames(Fields.coordinate_field(axes(field)))

Expand All @@ -282,7 +278,7 @@ function _slice_along(field, coord)
)
end
space = axes(field)
hspace = space.horizontal_space
hspace = Spaces.horizontal_space(space)
htopo = ClimaCore.Spaces.topology(hspace)
hmesh = htopo.mesh
linear_idx = LinearIndices(ClimaCore.Meshes.elements(hmesh))
Expand Down Expand Up @@ -364,7 +360,7 @@ RecipesBase.@recipe function f(
hinterpolate = 0,
ncolors = 256,
) where {
S <: Spaces.ExtrudedFiniteDifferenceSpace{
S <: Spaces.ExtrudedFiniteDifferenceSpace3D{
<:Any,
<:Spaces.RectilinearSpectralElementSpace2D,
},
Expand Down
16 changes: 10 additions & 6 deletions lib/ClimaCoreTempestRemap/src/netcdf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def_space_coord(
nc::NCDataset,
space::Spaces.SpectralElementSpace2D;
type = "dgll",
) = def_space_coord(nc, space, space.topology.mesh; type)
) = def_space_coord(nc, space, Spaces.topology(space).mesh; type)

function def_space_coord(
nc::NCDataset,
Expand Down Expand Up @@ -224,13 +224,17 @@ end

function def_space_coord(
nc::NCDataset,
space::Spaces.ExtrudedFiniteDifferenceSpace{S};
space::Spaces.ExtrudedFiniteDifferenceSpace;
type = "dgll",
) where {S <: Spaces.Staggering}
hvar = def_space_coord(nc, space.horizontal_space; type = type)
)
staggering = Spaces.staggering(space)
hvar = def_space_coord(nc, Spaces.horizontal_space(space); type = type)
vvar = def_space_coord(
nc,
Spaces.FiniteDifferenceSpace{S}(space.vertical_topology),
Spaces.FiniteDifferenceSpace(
Spaces.vertical_topology(space),
staggering,
),
)
(hvar..., vvar...)
end
Expand Down Expand Up @@ -332,7 +336,7 @@ function Base.setindex!(
)
nc = NCDataset(var)
space = axes(field)
hspace = space.horizontal_space
hspace = Spaces.horizontal_space(space)
if nc.attrib["node_type"] == "cgll"
nodes = Spaces.unique_nodes(hspace)
elseif nc.attrib["node_type"] == "dgll"
Expand Down
24 changes: 8 additions & 16 deletions lib/ClimaCoreTempestRemap/src/onlineremap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ function remap!(
# using out_type == "cgll"
if R.out_type == "cgll"
topology = Spaces.topology(R.target_space)
hspace = Spaces.horizontal_space(R.target_space)
quadrature_style = hspace.quadrature_style
Spaces.dss2!(target, topology, quadrature_style)
Topologies.dss!(target, topology)
end
return target
end
Expand Down Expand Up @@ -131,13 +129,7 @@ function remap!(target::Fields.Field, R::LinearMap, source::Fields.Field)
# using out_type == "cgll"
if R.out_type == "cgll"
topology = Spaces.topology(axes(target))
hspace = Spaces.horizontal_space(axes(target))
quadrature_style = hspace.quadrature_style
Spaces.dss2!(
Fields.field_values(target),
topology,
quadrature_style,
)
Topologies.dss!(Fields.field_values(target), topology)
end
return target
end
Expand Down Expand Up @@ -170,15 +162,15 @@ function generate_map(
out_type = "cgll",
)
if (target_space_distr != nothing)
comms_ctx = target_space_distr.topology.context
comms_ctx = ClimaComms.context(target_space_distr)
else
comms_ctx = target_space.topology.context
comms_ctx = ClimaComms.context(target_space)
end

if ClimaComms.iamroot(comms_ctx)
# write meshes and generate weights on root process (using global indices)
write_exodus(meshfile_source, source_space.topology)
write_exodus(meshfile_target, target_space.topology)
write_exodus(meshfile_source, Spaces.topology(source_space))
write_exodus(meshfile_target, Spaces.topology(target_space))
overlap_mesh(meshfile_overlap, meshfile_source, meshfile_target)
remap_weights(
weightfile,
Expand All @@ -187,11 +179,11 @@ function generate_map(
meshfile_overlap;
in_type = in_type,
in_np = Spaces.Quadratures.degrees_of_freedom(
source_space.quadrature_style,
Spaces.quadrature_style(source_space),
),
out_type = out_type,
out_np = Spaces.Quadratures.degrees_of_freedom(
target_space.quadrature_style,
Spaces.quadrature_style(target_space),
),
)

Expand Down
Loading

0 comments on commit 39dac54

Please sign in to comment.