Skip to content

Commit 506578c

Browse files
committed
Use CommonSpaces to create spaces
1 parent d68ea75 commit 506578c

File tree

25 files changed

+868
-450
lines changed

25 files changed

+868
-450
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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+2"
18681868

18691869
[[deps.OpenMPI_jll]]
18701870
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML", "Zlib_jll"]
@@ -2024,12 +2024,6 @@ version = "0.4.34"
20242024
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
20252025
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
20262026

2027-
[[deps.PrecompileCI]]
2028-
deps = ["ClimaAtmos", "ClimaComms", "ClimaCore", "ClimaParams", "Logging", "PrecompileTools"]
2029-
path = "PrecompileCI"
2030-
uuid = "76d61242-8ec2-4c91-8455-3234246697a2"
2031-
version = "0.1.0"
2032-
20332027
[[deps.PrecompileTools]]
20342028
deps = ["Preferences"]
20352029
git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f"
@@ -2210,9 +2204,9 @@ version = "0.5.1+0"
22102204

22112205
[[deps.RootSolvers]]
22122206
deps = ["ForwardDiff", "Printf"]
2213-
git-tree-sha1 = "75b130d104fb3d9d39a5c784fad23aebc7d7d956"
2207+
git-tree-sha1 = "769388dbf7656e70f6ee250f35bb6cbca8f43203"
22142208
uuid = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74"
2215-
version = "1.0.0"
2209+
version = "0.4.6"
22162210

22172211
[[deps.RoundingEmulator]]
22182212
git-tree-sha1 = "40b9edad2e5287e05bd413a38f61a8ff55b9557b"

.buildkite/PrecompileCI/src/PrecompileCI.jl

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,42 @@ import ClimaComms
66
import ClimaCore: InputOutput, Meshes, Spaces, Quadratures
77
import ClimaParams
88

9-
@compile_workload begin
10-
with_logger(NullLogger()) do
11-
FT = Float32 # Float64?
12-
h_elem = 6 # 16, 30?
13-
z_elem = 10 # 30, 31, 63?
14-
x_elem = y_elem = 2
15-
x_max = y_max = 1e8
16-
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
9+
# @compile_workload begin
10+
# with_logger(NullLogger()) do
11+
# FT = Float32 # Float64?
12+
# h_elem = 6 # 16, 30?
13+
# z_elem = 10 # 30, 31, 63?
14+
# x_elem = y_elem = 2
15+
# x_max = y_max = 1e8
16+
# 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
2424

25-
# constants
26-
quad = Quadratures.GLL{4}()
27-
params = CA.ClimaAtmosParameters(FT)
28-
radius = CA.Parameters.planet_radius(params)
25+
# # constants
26+
# quad = Quadratures.GLL{4}()
27+
# params = CA.ClimaAtmosParameters(FT)
28+
# radius = CA.Parameters.planet_radius(params)
2929

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)
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)
3434

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)
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)
4040

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)
44-
end
45-
end
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)
44+
# end
45+
# end
4646

4747
end # module Precompile

.buildkite/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
2727
NullBroadcasts = "0d71be07-595a-4f89-9529-4065a4ab43a6"
2828
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
2929
Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b"
30-
PrecompileCI = "76d61242-8ec2-4c91-8455-3234246697a2"
3130
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
3231
Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
3332
ProfileCanvas = "efd6af41-a80b-495e-886c-e51b0c7d77a3"

.buildkite/ci_driver.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ redirect_stderr(IOContext(stderr, :stacktrace_types_limited => Ref(false)))
99
# To load in the precompiled methods, run `using PrecompileCI` before loading ClimaAtmos.
1010
# To see what methods are precompiled, open julia: `julia --project=.buildkite/PrecompileCI`
1111
# and run `using PrecompileTools; PrecompileTools.verbose[] = true; include(".buildkite/PrecompileCI/src/PrecompileCI.jl")`
12-
haskey(ENV, "CI") && (using PrecompileCI)
12+
# haskey(ENV, "CI") && (using PrecompileCI)
1313

1414
import ClimaComms
1515
ClimaComms.@import_required_backends

.buildkite/pipeline.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ steps:
2828
- julia --check-bounds=yes -e 'using TOML; @assert TOML.parsefile(".buildkite/Manifest-v1.11.toml")["deps"]["ClimaAtmos"][1]["path"] == ".."'
2929

3030
- echo "--- Instantiate .buildkite"
31-
- "julia --project=.buildkite -e 'using Pkg; Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true); using CUDA; CUDA.precompile_runtime(); Pkg.status()'"
31+
- julia --project=.buildkite -e '
32+
using Pkg;
33+
Pkg.Registry.update();
34+
Pkg.add(PackageSpec(name="ClimaCore", url="https://github.com/CliMA/ClimaCore.jl", rev="ne/fd_grid"));
35+
Pkg.add(PackageSpec(name="ClimaUtilities", url="https://github.com/CliMA/ClimaUtilities.jl", rev="main"));
36+
Pkg.instantiate();
37+
Pkg.precompile(; strict=true);
38+
using CUDA; CUDA.precompile_runtime();
39+
Pkg.status()
40+
'
3241
3342
agents:
3443
slurm_cpus_per_task: 8

calibration/experiments/gcm_driven_scm/helper_funcs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ 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+
# TODO: Update this to use the new get_spaces function
2627
spaces =
2728
CA.get_spaces(atmos_config.parsed_args, params, atmos_config.comms_ctx)
2829
coord = CA.Fields.coordinate_field(spaces.center_space)

docs/src/api.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,21 @@ ClimaAtmos.InitialConditions.Bomex
4343
ClimaAtmos.InitialConditions.Soares
4444
```
4545

46-
### Helper
46+
## Helper
4747

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

52+
## Grids
53+
54+
```@docs
55+
ClimaAtmos.ColGrid
56+
ClimaAtmos.SphereGrid
57+
ClimaAtmos.PlaneGrid
58+
ClimaAtmos.BoxGrid
59+
```
60+
5261
## Jacobian
5362

5463
```@docs

post_processing/ci_plots.jl

Lines changed: 109 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,6 @@ make_plots_generic(
437437
simulation_path,
438438
vars,
439439
time = LAST_SNAP,
440-
x = 0.0, # Our columns are still 3D objects...
441-
y = 0.0,
442440
more_kwargs = YLINEARSCALE,
443441
)
444442
```
@@ -453,8 +451,6 @@ make_plots_generic(
453451
simulation_path,
454452
vars,
455453
time = LAST_SNAP,
456-
x = 0.0, # Our columns are still 3D objects...
457-
y = 0.0,
458454
more_kwargs = YLINEARSCALE,
459455
)
460456
```
@@ -589,14 +585,23 @@ ColumnPlots = Union{
589585
function make_plots(::ColumnPlots, output_paths::Vector{<:AbstractString})
590586
simdirs = SimDir.(output_paths)
591587
short_names = ["ta", "wa"]
592-
vars = map_comparison(get, simdirs, short_names)
588+
vars = map_comparison(simdirs, short_names) do simdir, short_name
589+
var = get(simdir; short_name)
590+
# For vertical-only (FiniteDifferenceGrid) spaces, the data may have
591+
# extra singleton dimensions. Check and squeeze if needed.
592+
if haskey(var.dims, "x") && length(var.dims["x"]) == 1
593+
var = slice(var; x = var.dims["x"][1])
594+
end
595+
if haskey(var.dims, "y") && length(var.dims["y"]) == 1
596+
var = slice(var; y = var.dims["y"][1])
597+
end
598+
return var
599+
end
593600

594601
make_plots_generic(
595602
output_paths,
596603
vars,
597604
time = LAST_SNAP,
598-
x = 0.0, # Our columns are still 3D objects...
599-
y = 0.0,
600605
MAX_NUM_COLS = length(simdirs),
601606
more_kwargs = YLINEARSCALE,
602607
)
@@ -644,7 +649,7 @@ function make_plots(
644649
end
645650

646651
vars = [
647-
slice(get(simdir; short_name), x = 0.0, y = 0.0) for
652+
get(simdir; short_name) for
648653
short_name in short_names
649654
]
650655

@@ -689,7 +694,7 @@ function make_plots(
689694
surface_precip = read_var(simdir.variable_paths["pr"]["inst"]["10s"])
690695
viz.line_plot1D!(
691696
fig,
692-
slice(surface_precip, x = 0.0, y = 0.0);
697+
surface_precip;
693698
p_loc = [pr_row, 1:3],
694699
)
695700

@@ -1371,6 +1376,12 @@ EDMFBoxPlots = Union{
13711376
Val{:diagnostic_edmfx_dycoms_rf01_box},
13721377
Val{:diagnostic_edmfx_trmm_box_0M},
13731378
Val{:diagnostic_edmfx_dycoms_rf01_explicit_box},
1379+
Val{:prognostic_edmfx_bomex_box},
1380+
Val{:rcemipii_box_diagnostic_edmfx},
1381+
Val{:diagnostic_edmfx_trmm_stretched_box},
1382+
}
1383+
1384+
EDMFColumnPlots = Union{
13741385
Val{:prognostic_edmfx_adv_test_column},
13751386
Val{:prognostic_edmfx_gabls_column},
13761387
Val{:prognostic_edmfx_gabls_column_sparse_autodiff},
@@ -1386,13 +1397,10 @@ EDMFBoxPlots = Union{
13861397
Val{:prognostic_edmfx_simpleplume_column},
13871398
Val{:prognostic_edmfx_gcmdriven_column},
13881399
Val{:prognostic_edmfx_tv_era5driven_column},
1389-
Val{:prognostic_edmfx_bomex_box},
1390-
Val{:rcemipii_box_diagnostic_edmfx},
13911400
Val{:prognostic_edmfx_soares_column},
1392-
Val{:diagnostic_edmfx_trmm_stretched_box},
13931401
}
13941402

1395-
EDMFBoxPlotsWithPrecip = Union{
1403+
EDMFColumnPlotsWithPrecip = Union{
13961404
Val{:prognostic_edmfx_rico_column},
13971405
Val{:prognostic_edmfx_rico_implicit_column},
13981406
Val{:prognostic_edmfx_rico_column_2M},
@@ -1485,14 +1493,99 @@ end
14851493
function make_plots(
14861494
sim_type::Union{
14871495
EDMFBoxPlots,
1488-
EDMFBoxPlotsWithPrecip,
14891496
DiagEDMFBoxPlotsWithPrecip,
14901497
},
14911498
output_paths::Vector{<:AbstractString},
14921499
)
14931500
simdirs = SimDir.(output_paths)
14941501

1495-
if sim_type isa EDMFBoxPlotsWithPrecip
1502+
if sim_type isa DiagEDMFBoxPlotsWithPrecip
1503+
precip_names = ("husra", "hussn", "husraup", "hussnup")
1504+
else
1505+
precip_names = ()
1506+
end
1507+
1508+
short_names = [
1509+
"wa",
1510+
"waup",
1511+
"ta",
1512+
"taup",
1513+
"hus",
1514+
"husup",
1515+
"arup",
1516+
"tke",
1517+
"ua",
1518+
"thetaa",
1519+
"thetaaup",
1520+
"ha",
1521+
"haup",
1522+
"hur",
1523+
"hurup",
1524+
"lmix",
1525+
"cl",
1526+
"clw",
1527+
"clwup",
1528+
"cli",
1529+
"cliup",
1530+
precip_names...,
1531+
]
1532+
reduction = "inst"
1533+
1534+
available_periods = ClimaAnalysis.available_periods(
1535+
simdirs[1];
1536+
short_name = short_names[1],
1537+
reduction,
1538+
)
1539+
# choose the shortest available period
1540+
available_periods = collect(available_periods) # ensure vector for indexing
1541+
period = available_periods[argmin(CA.time_to_seconds.(available_periods))]
1542+
1543+
short_name_tuples = pair_edmf_names(short_names)
1544+
var_groups_zt =
1545+
map_comparison(simdirs, short_name_tuples) do simdir, name_tuple
1546+
return [
1547+
slice(
1548+
get(simdir; short_name, reduction, period),
1549+
x = 0.0,
1550+
y = 0.0,
1551+
) for short_name in name_tuple
1552+
]
1553+
end
1554+
1555+
var_groups_z = [
1556+
([slice(v, time = LAST_SNAP) for v in group]...,) for
1557+
group in var_groups_zt
1558+
]
1559+
1560+
tmp_file = make_plots_generic(
1561+
output_paths,
1562+
output_name = "tmp",
1563+
var_groups_z;
1564+
plot_fn = plot_edmf_vert_profile!,
1565+
MAX_NUM_COLS = 2,
1566+
MAX_NUM_ROWS = 4,
1567+
)
1568+
1569+
make_plots_generic(
1570+
output_paths,
1571+
vcat(var_groups_zt...),
1572+
plot_fn = plot_parsed_attribute_title!,
1573+
summary_files = [tmp_file],
1574+
MAX_NUM_COLS = 2,
1575+
MAX_NUM_ROWS = 4,
1576+
)
1577+
end
1578+
1579+
function make_plots(
1580+
sim_type::Union{
1581+
EDMFColumnPlots,
1582+
EDMFColumnPlotsWithPrecip,
1583+
},
1584+
output_paths::Vector{<:AbstractString},
1585+
)
1586+
simdirs = SimDir.(output_paths)
1587+
1588+
if sim_type isa EDMFColumnPlotsWithPrecip
14961589
if sim_type isa Val{:prognostic_edmfx_rico_column_2M}
14971590
precip_names = (
14981591
"husra",
@@ -1512,8 +1605,6 @@ function make_plots(
15121605
precip_names =
15131606
("husra", "hussn", "husraup", "hussnup", "husraen", "hussnen")
15141607
end
1515-
elseif sim_type isa DiagEDMFBoxPlotsWithPrecip
1516-
precip_names = ("husra", "hussn", "husraup", "hussnup")
15171608
else
15181609
precip_names = ()
15191610
end
@@ -1557,11 +1648,7 @@ function make_plots(
15571648
var_groups_zt =
15581649
map_comparison(simdirs, short_name_tuples) do simdir, name_tuple
15591650
return [
1560-
slice(
1561-
get(simdir; short_name, reduction, period),
1562-
x = 0.0,
1563-
y = 0.0,
1564-
) for short_name in name_tuple
1651+
get(simdir; short_name, reduction, period) for short_name in name_tuple
15651652
]
15661653
end
15671654

src/ClimaAtmos.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ import .Diagnostics as CAD
156156
include(joinpath("callbacks", "get_callbacks.jl"))
157157

158158
include(joinpath("simulation", "AtmosSimulations.jl"))
159+
include(joinpath("simulation", "grids.jl"))
159160

160161
include(joinpath("solver", "model_getters.jl")) # high-level (using parsed_args) model getters
161162
include(joinpath("solver", "type_getters.jl"))

0 commit comments

Comments
 (0)