Skip to content

Commit 672d0c3

Browse files
committed
Use CommonSpaces to create spaces
1 parent bba7e3b commit 672d0c3

File tree

29 files changed

+866
-533
lines changed

29 files changed

+866
-533
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ weakdeps = ["CUDA", "MPI"]
406406

407407
[[deps.ClimaCore]]
408408
deps = ["Adapt", "BandedMatrices", "BlockArrays", "ClimaComms", "CubedSphere", "DataStructures", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "KrylovKit", "LazyBroadcast", "LinearAlgebra", "MultiBroadcastFusion", "NVTX", "PkgVersion", "RecursiveArrayTools", "RootSolvers", "SparseArrays", "StaticArrays", "Statistics", "UnrolledUtilities"]
409-
git-tree-sha1 = "ca717446978d2815b4fa23a62a2131861e44d1e8"
409+
git-tree-sha1 = "a2acae071e36c1c69c94a83d1fb74b25e8b0fde0"
410410
uuid = "d414da3d-4745-48bb-8d80-42e94e092884"
411-
version = "0.14.42"
411+
version = "0.14.43"
412412
weakdeps = ["CUDA", "Krylov"]
413413

414414
[deps.ClimaCore.extensions]
@@ -1864,7 +1864,7 @@ version = "2.5.5+0"
18641864
[[deps.OpenLibm_jll]]
18651865
deps = ["Artifacts", "Libdl"]
18661866
uuid = "05823500-19ac-5b8b-9628-191a04bc5112"
1867-
version = "0.8.5+0"
1867+
version = "0.8.1+4"
18681868

18691869
[[deps.OpenMPI_jll]]
18701870
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML", "Zlib_jll"]

.buildkite/PrecompileCI/src/PrecompileCI.jl

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module PrecompileCI
33
using PrecompileTools, Logging
44
import ClimaAtmos as CA
55
import ClimaComms
6-
import ClimaCore: InputOutput, Meshes, Spaces, Quadratures
76
import ClimaParams
87

98
@compile_workload begin
@@ -14,34 +13,43 @@ import ClimaParams
1413
x_elem = y_elem = 2
1514
x_max = y_max = 1e8
1615
z_max = FT(30000.0)
17-
dz_bottom = FT(500) # other values?
18-
z_stretch = Meshes.HyperbolicTangentStretching(dz_bottom) # Meshes.Uniform()
19-
bubble = true # false
20-
parsed_args =
21-
Dict{String, Any}("topography" => "NoWarp", "topo_smoothing" => false)
22-
comms_ctx = ClimaComms.context(ClimaComms.CPUSingleThreaded())
23-
deep = false
24-
25-
# constants
26-
quad = Quadratures.GLL{4}()
16+
dz_bottom = FT(500)
17+
z_stretch = true
18+
bubble = true
19+
nh_poly = 3 # GLL{4} = nh_poly + 1
20+
# TODO: compile CUDA methods as well
21+
context = ClimaComms.context(ClimaComms.CPUSingleThreaded())
22+
topography = CA.NoTopography()
2723
params = CA.ClimaAtmosParameters(FT)
2824
radius = CA.Parameters.planet_radius(params)
2925

30-
# Sphere
31-
horz_mesh = CA.cubed_sphere_mesh(; radius, h_elem)
32-
h_space = CA.make_horizontal_space(horz_mesh, quad, comms_ctx, bubble)
33-
CA.make_hybrid_spaces(h_space, z_max, z_elem, z_stretch; parsed_args)
34-
35-
# box
36-
horizontal_mesh = CA.periodic_rectangle_mesh(; x_max, y_max, x_elem, y_elem)
37-
h_space = CA.make_horizontal_space(horizontal_mesh, quad, comms_ctx, bubble)
38-
# This is broken
39-
# CA.make_hybrid_spaces(h_space, z_max, z_elem, z_stretch; parsed_args)
40-
41-
# plane
42-
horizontal_mesh = CA.periodic_line_mesh(; x_max, x_elem)
43-
h_space = CA.make_horizontal_space(horizontal_mesh, quad, comms_ctx, bubble)
26+
sphere_grid = CA.SphereGrid(
27+
FT;
28+
context,
29+
radius, h_elem, nh_poly,
30+
z_elem, z_max, z_stretch, dz_bottom,
31+
bubble, topography,
32+
)
33+
box_grid = CA.BoxGrid(
34+
FT;
35+
context,
36+
x_elem, x_max, y_elem, y_max, nh_poly, periodic_x = true, periodic_y = true,
37+
z_elem, z_max, z_stretch, dz_bottom,
38+
bubble, topography,
39+
)
40+
plane_grid = CA.PlaneGrid(
41+
FT;
42+
context,
43+
x_elem, x_max, nh_poly, periodic_x = true,
44+
z_elem, z_max, z_stretch, dz_bottom,
45+
bubble, topography,
46+
)
47+
column_grid = CA.ColumnGrid(
48+
FT; context, z_elem, z_max, z_stretch, dz_bottom,
49+
)
50+
all_grids = (sphere_grid, box_grid, plane_grid, column_grid)
51+
foreach(CA.get_spaces, all_grids)
4452
end
4553
end
4654

47-
end # module Precompile
55+
end # module PrecompileCI

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ steps:
12081208
CLIMACOMMS_DEVICE: "CUDA"
12091209
CLIMA_NAME_CUDA_KERNELS_FROM_STACK_TRACE: "true"
12101210
agents:
1211-
slurm_mem: 24GB
1211+
slurm_mem: 28GB
12121212
slurm_gpus: 1
12131213

12141214
- group: "Flame graphs"

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ClimaAtmos.jl Release Notes
44
main
55
-------
66

7+
PR [#4021](https://github.com/CliMA/ClimaAtmos.jl/pull/4021) uses ClimaCore
8+
convenience constructors to create spaces without an AtmosConfig.
9+
710
v0.31.5
811
-------
912
PR [#3975](https://github.com/CliMA/ClimaAtmos.jl/pull/3975) updates the pressure gradient formulation to subtract a reference state and use the Exner pressure.

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ ArgParse = "1"
4444
Artifacts = "1"
4545
AtmosphericProfilesLibrary = "0.1.7"
4646
ClimaComms = "0.6.9"
47-
ClimaCore = "0.14.37"
48-
ClimaDiagnostics = "0.2.12"
47+
ClimaCore = "0.14.43"
48+
ClimaDiagnostics = "0.2.13"
4949
ClimaInterpolations = "0.1.0"
5050
ClimaParams = "1.0.2"
5151
ClimaTimeSteppers = "0.8.2"
52-
ClimaUtilities = "0.1.23"
52+
ClimaUtilities = "0.1.27"
5353
CloudMicrophysics = "0.28, 0.29"
5454
Dates = "1"
5555
ForwardDiff = "1"

calibration/experiments/gcm_driven_scm/helper_funcs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ CLIMADIAGNOSTICS_LES_NAME_MAP =
2323
"""Get z cell centers coordinates for CA run, given config. """
2424
function get_z_grid(atmos_config; z_max = nothing)
2525
params = CA.ClimaAtmosParameters(atmos_config)
26-
spaces =
27-
CA.get_spaces(atmos_config.parsed_args, params, atmos_config.comms_ctx)
26+
grid = CA.get_grid(atmos_config.parsed_args, params, atmos_config.comms_ctx)
27+
spaces = CA.get_spaces(grid, atmos_config.comms_ctx)
2828
coord = CA.Fields.coordinate_field(spaces.center_space)
2929
z_vec = convert(Vector{Float64}, parent(coord.z)[:])
3030
if !isnothing(z_max)

docs/src/api.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,21 @@ ClimaAtmos.InitialConditions.Soares
4444
ClimaAtmos.InitialConditions.RCEMIPIIProfile
4545
```
4646

47-
### Helper
47+
## Helper
4848

4949
```@docs
5050
ClimaAtmos.InitialConditions.ColumnInterpolatableField
5151
```
5252

53+
## Grids
54+
55+
```@docs
56+
ClimaAtmos.ColumnGrid
57+
ClimaAtmos.SphereGrid
58+
ClimaAtmos.PlaneGrid
59+
ClimaAtmos.BoxGrid
60+
```
61+
5362
## Jacobian
5463

5564
```@docs
@@ -69,6 +78,8 @@ ClimaAtmos.ScharTopography
6978
ClimaAtmos.EarthTopography
7079
ClimaAtmos.DCMIP200Topography
7180
ClimaAtmos.Hughes2023Topography
81+
ClimaAtmos.SLEVEWarp
82+
ClimaAtmos.LinearWarp
7283
```
7384

7485
### Internals

examples/topography_spectra.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ import ClimaCoreSpectra: power_spectrum_2d
1414

1515
const AA = AtmosArtifacts
1616

17+
using ClimaCore:
18+
Geometry, Domains, Meshes, Topologies, Spaces, Grids, Hypsography, Fields
19+
using ClimaComms
20+
using ClimaUtilities: SpaceVaryingInputs.SpaceVaryingInput
1721

18-
function mask(x::FT) where {FT}
19-
return x * FT(x > 0)
22+
# Include helper functions from test directory
23+
include(joinpath(@__DIR__, "..", "test", "test_helpers.jl"))
24+
25+
# h_elem is the number of elements per side of every panel (6 panels in total)
26+
function cubed_sphere_mesh(; radius, h_elem)
27+
domain = Domains.SphereDomain(radius)
28+
return Meshes.EquiangularCubedSphere(domain, h_elem)
2029
end
2130

2231
"""
@@ -37,10 +46,10 @@ function generate_spaces(;
3746
)
3847
FT = Float32
3948
cubed_sphere_mesh =
40-
CA.cubed_sphere_mesh(; radius = FT(planet_radius), h_elem)
49+
cubed_sphere_mesh(; radius = FT(planet_radius), h_elem)
4150
quad = Quadratures.GLL{4}()
4251
comms_ctx = ClimaComms.context()
43-
h_space = CA.make_horizontal_space(cubed_sphere_mesh, quad, comms_ctx, true)
52+
h_space = make_horizontal_space(cubed_sphere_mesh, quad, comms_ctx, true)
4453
Δh_scale = Spaces.node_horizontal_length_scale(h_space)
4554
@assert h_space isa CC.Spaces.SpectralElementSpace2D
4655
coords = CC.Fields.coordinate_field(h_space)
@@ -49,7 +58,6 @@ function generate_spaces(;
4958
"z",
5059
h_space,
5160
)
52-
elev_from_file = @. mask(elev_from_file)
5361
# Fractional damping of smallest resolved scale
5462
# Approximated as k₀ ≈ 1/Δx, with n_attenuation
5563
# the factor by which we wish to damp wavenumber
@@ -58,7 +66,7 @@ function generate_spaces(;
5866
κ = diff_courant * Δh_scale^2
5967
maxiter = Int(round(log(n_attenuation) / diff_courant))
6068
diffuse_surface_elevation!(elev_from_file; κ, dt = FT(1), maxiter)
61-
elev_from_file = @. mask(elev_from_file)
69+
@. elev_from_file = max(elev_from_file, FT(0))
6270
return elev_from_file
6371
end
6472

0 commit comments

Comments
 (0)