Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .buildkite/Manifest-v1.11.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ version = "2.5.5+0"
[[deps.OpenLibm_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "05823500-19ac-5b8b-9628-191a04bc5112"
version = "0.8.5+0"
version = "0.8.1+2"

[[deps.OpenMPI_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML", "Zlib_jll"]
Expand Down Expand Up @@ -2210,9 +2210,9 @@ version = "0.5.1+0"

[[deps.RootSolvers]]
deps = ["ForwardDiff", "Printf"]
git-tree-sha1 = "75b130d104fb3d9d39a5c784fad23aebc7d7d956"
git-tree-sha1 = "769388dbf7656e70f6ee250f35bb6cbca8f43203"
uuid = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74"
version = "1.0.0"
version = "0.4.6"

[[deps.RoundingEmulator]]
git-tree-sha1 = "40b9edad2e5287e05bd413a38f61a8ff55b9557b"
Expand Down
50 changes: 28 additions & 22 deletions .buildkite/PrecompileCI/src/PrecompileCI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,39 @@ import ClimaParams
x_max = y_max = 1e8
z_max = FT(30000.0)
dz_bottom = FT(500) # other values?
z_stretch = Meshes.HyperbolicTangentStretching(dz_bottom) # Meshes.Uniform()
z_stretch = true # Meshes.Uniform()
bubble = true # false
parsed_args =
Dict{String, Any}("topography" => "NoWarp", "topo_smoothing" => false)
comms_ctx = ClimaComms.context(ClimaComms.CPUSingleThreaded())
deep = false

# constants
quad = Quadratures.GLL{4}()
nh_poly = 3 # GLL{4} = nh_poly + 1
context = ClimaComms.context(ClimaComms.CPUSingleThreaded())
deep_atmosphere = false
topography = CA.NoTopography()
params = CA.ClimaAtmosParameters(FT)
radius = CA.Parameters.planet_radius(params)

# Sphere
horz_mesh = CA.cubed_sphere_mesh(; radius, h_elem)
h_space = CA.make_horizontal_space(horz_mesh, quad, comms_ctx, bubble)
CA.make_hybrid_spaces(h_space, z_max, z_elem, z_stretch; parsed_args)

# box
horizontal_mesh = CA.periodic_rectangle_mesh(; x_max, y_max, x_elem, y_elem)
h_space = CA.make_horizontal_space(horizontal_mesh, quad, comms_ctx, bubble)
# This is broken
# CA.make_hybrid_spaces(h_space, z_max, z_elem, z_stretch; parsed_args)
sphere_grid = CA.SphereGrid(
FT;
context, radius, h_elem, nh_poly, z_elem, z_max, z_stretch,
dz_bottom, bubble, deep_atmosphere,
topography,
)
box_grid = CA.BoxGrid(
FT; context, x_elem, x_max, y_elem, y_max, z_elem, z_max, nh_poly,
z_stretch, dz_bottom, bubble, deep_atmosphere,
periodic_x = true, periodic_y = true, topography,
)
plane_grid = CA.PlaneGrid(
FT; context, x_elem, x_max, z_elem, z_max, nh_poly, z_stretch,
dz_bottom, bubble, deep_atmosphere, periodic_x = true,
topography,
)
column_grid = CA.ColGrid(
FT; context, z_elem, z_max, z_stretch, dz_bottom,
)

# plane
horizontal_mesh = CA.periodic_line_mesh(; x_max, x_elem)
h_space = CA.make_horizontal_space(horizontal_mesh, quad, comms_ctx, bubble)
for grid in [sphere_grid, box_grid, plane_grid, column_grid]
CA.get_spaces(grid, context)
end
end
end

end # module Precompile
end # module PrecompileCI
2 changes: 1 addition & 1 deletion .buildkite/ci_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ redirect_stderr(IOContext(stderr, :stacktrace_types_limited => Ref(false)))
# To load in the precompiled methods, run `using PrecompileCI` before loading ClimaAtmos.
# To see what methods are precompiled, open julia: `julia --project=.buildkite/PrecompileCI`
# and run `using PrecompileTools; PrecompileTools.verbose[] = true; include(".buildkite/PrecompileCI/src/PrecompileCI.jl")`
haskey(ENV, "CI") && (using PrecompileCI)
# haskey(ENV, "CI") && (using PrecompileCI)

import ClimaComms
ClimaComms.@import_required_backends
Expand Down
13 changes: 11 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ steps:
- julia --check-bounds=yes -e 'using TOML; @assert TOML.parsefile(".buildkite/Manifest-v1.11.toml")["deps"]["ClimaAtmos"][1]["path"] == ".."'

- echo "--- Instantiate .buildkite"
- "julia --project=.buildkite -e 'using Pkg; Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true); using CUDA; CUDA.precompile_runtime(); Pkg.status()'"

- julia --project=.buildkite -e '

using Pkg;
Pkg.Registry.update();
Pkg.add(PackageSpec(name="ClimaCore", url="https://github.com/CliMA/ClimaCore.jl", rev="ne/fd_grid"));
Pkg.add(PackageSpec(name="ClimaUtilities", url="https://github.com/CliMA/ClimaUtilities.jl", rev="main"));
Pkg.instantiate();
Pkg.precompile(; strict=true);
using CUDA; CUDA.precompile_runtime();
Pkg.status()
'
agents:
slurm_cpus_per_task: 8
slurm_gpus: 1
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ArgParse = "1"
Artifacts = "1"
AtmosphericProfilesLibrary = "0.1.7"
ClimaComms = "0.6.9"
ClimaCore = "0.14.37"
ClimaCore = "0.14.42"
ClimaDiagnostics = "0.2.12"
ClimaInterpolations = "0.1.0"
ClimaParams = "1.0.2"
Expand Down
1 change: 1 addition & 0 deletions calibration/experiments/gcm_driven_scm/helper_funcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ CLIMADIAGNOSTICS_LES_NAME_MAP =
"""Get z cell centers coordinates for CA run, given config. """
function get_z_grid(atmos_config; z_max = nothing)
params = CA.ClimaAtmosParameters(atmos_config)
# TODO: Update this to use the new get_spaces function
spaces =
CA.get_spaces(atmos_config.parsed_args, params, atmos_config.comms_ctx)
coord = CA.Fields.coordinate_field(spaces.center_space)
Expand Down
11 changes: 10 additions & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,21 @@ ClimaAtmos.InitialConditions.Bomex
ClimaAtmos.InitialConditions.Soares
```

### Helper
## Helper

```@docs
ClimaAtmos.InitialConditions.ColumnInterpolatableField
```

## Grids

```@docs
ClimaAtmos.ColGrid
ClimaAtmos.SphereGrid
ClimaAtmos.PlaneGrid
ClimaAtmos.BoxGrid
```

## Jacobian

```@docs
Expand Down
131 changes: 109 additions & 22 deletions post_processing/ci_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,6 @@ make_plots_generic(
simulation_path,
vars,
time = LAST_SNAP,
x = 0.0, # Our columns are still 3D objects...
y = 0.0,
more_kwargs = YLINEARSCALE,
)
```
Expand All @@ -453,8 +451,6 @@ make_plots_generic(
simulation_path,
vars,
time = LAST_SNAP,
x = 0.0, # Our columns are still 3D objects...
y = 0.0,
more_kwargs = YLINEARSCALE,
)
```
Expand Down Expand Up @@ -589,14 +585,23 @@ ColumnPlots = Union{
function make_plots(::ColumnPlots, output_paths::Vector{<:AbstractString})
simdirs = SimDir.(output_paths)
short_names = ["ta", "wa"]
vars = map_comparison(get, simdirs, short_names)
vars = map_comparison(simdirs, short_names) do simdir, short_name
var = get(simdir; short_name)
# For vertical-only (FiniteDifferenceGrid) spaces, the data may have
# extra singleton dimensions. Check and squeeze if needed.
if haskey(var.dims, "x") && length(var.dims["x"]) == 1
var = slice(var; x = var.dims["x"][1])
end
if haskey(var.dims, "y") && length(var.dims["y"]) == 1
var = slice(var; y = var.dims["y"][1])
end
return var
end

make_plots_generic(
output_paths,
vars,
time = LAST_SNAP,
x = 0.0, # Our columns are still 3D objects...
y = 0.0,
MAX_NUM_COLS = length(simdirs),
more_kwargs = YLINEARSCALE,
)
Expand Down Expand Up @@ -644,7 +649,7 @@ function make_plots(
end

vars = [
slice(get(simdir; short_name), x = 0.0, y = 0.0) for
get(simdir; short_name) for
short_name in short_names
]

Expand Down Expand Up @@ -689,7 +694,7 @@ function make_plots(
surface_precip = read_var(simdir.variable_paths["pr"]["inst"]["10s"])
viz.line_plot1D!(
fig,
slice(surface_precip, x = 0.0, y = 0.0);
surface_precip;
p_loc = [pr_row, 1:3],
)

Expand Down Expand Up @@ -1371,6 +1376,12 @@ EDMFBoxPlots = Union{
Val{:diagnostic_edmfx_dycoms_rf01_box},
Val{:diagnostic_edmfx_trmm_box_0M},
Val{:diagnostic_edmfx_dycoms_rf01_explicit_box},
Val{:prognostic_edmfx_bomex_box},
Val{:rcemipii_box_diagnostic_edmfx},
Val{:diagnostic_edmfx_trmm_stretched_box},
}

EDMFColumnPlots = Union{
Val{:prognostic_edmfx_adv_test_column},
Val{:prognostic_edmfx_gabls_column},
Val{:prognostic_edmfx_gabls_column_sparse_autodiff},
Expand All @@ -1386,13 +1397,10 @@ EDMFBoxPlots = Union{
Val{:prognostic_edmfx_simpleplume_column},
Val{:prognostic_edmfx_gcmdriven_column},
Val{:prognostic_edmfx_tv_era5driven_column},
Val{:prognostic_edmfx_bomex_box},
Val{:rcemipii_box_diagnostic_edmfx},
Val{:prognostic_edmfx_soares_column},
Val{:diagnostic_edmfx_trmm_stretched_box},
}

EDMFBoxPlotsWithPrecip = Union{
EDMFColumnPlotsWithPrecip = Union{
Val{:prognostic_edmfx_rico_column},
Val{:prognostic_edmfx_rico_implicit_column},
Val{:prognostic_edmfx_rico_column_2M},
Expand Down Expand Up @@ -1485,14 +1493,99 @@ end
function make_plots(
sim_type::Union{
EDMFBoxPlots,
EDMFBoxPlotsWithPrecip,
DiagEDMFBoxPlotsWithPrecip,
},
output_paths::Vector{<:AbstractString},
)
simdirs = SimDir.(output_paths)

if sim_type isa EDMFBoxPlotsWithPrecip
if sim_type isa DiagEDMFBoxPlotsWithPrecip
precip_names = ("husra", "hussn", "husraup", "hussnup")
else
precip_names = ()
end

short_names = [
"wa",
"waup",
"ta",
"taup",
"hus",
"husup",
"arup",
"tke",
"ua",
"thetaa",
"thetaaup",
"ha",
"haup",
"hur",
"hurup",
"lmix",
"cl",
"clw",
"clwup",
"cli",
"cliup",
precip_names...,
]
reduction = "inst"

available_periods = ClimaAnalysis.available_periods(
simdirs[1];
short_name = short_names[1],
reduction,
)
# choose the shortest available period
available_periods = collect(available_periods) # ensure vector for indexing
period = available_periods[argmin(CA.time_to_seconds.(available_periods))]

short_name_tuples = pair_edmf_names(short_names)
var_groups_zt =
map_comparison(simdirs, short_name_tuples) do simdir, name_tuple
return [
slice(
get(simdir; short_name, reduction, period),
x = 0.0,
y = 0.0,
) for short_name in name_tuple
]
end

var_groups_z = [
([slice(v, time = LAST_SNAP) for v in group]...,) for
group in var_groups_zt
]

tmp_file = make_plots_generic(
output_paths,
output_name = "tmp",
var_groups_z;
plot_fn = plot_edmf_vert_profile!,
MAX_NUM_COLS = 2,
MAX_NUM_ROWS = 4,
)

make_plots_generic(
output_paths,
vcat(var_groups_zt...),
plot_fn = plot_parsed_attribute_title!,
summary_files = [tmp_file],
MAX_NUM_COLS = 2,
MAX_NUM_ROWS = 4,
)
end

function make_plots(
sim_type::Union{
EDMFColumnPlots,
EDMFColumnPlotsWithPrecip,
},
output_paths::Vector{<:AbstractString},
)
simdirs = SimDir.(output_paths)

if sim_type isa EDMFColumnPlotsWithPrecip
if sim_type isa Val{:prognostic_edmfx_rico_column_2M}
precip_names = (
"husra",
Expand All @@ -1512,8 +1605,6 @@ function make_plots(
precip_names =
("husra", "hussn", "husraup", "hussnup", "husraen", "hussnen")
end
elseif sim_type isa DiagEDMFBoxPlotsWithPrecip
precip_names = ("husra", "hussn", "husraup", "hussnup")
else
precip_names = ()
end
Expand Down Expand Up @@ -1557,11 +1648,7 @@ function make_plots(
var_groups_zt =
map_comparison(simdirs, short_name_tuples) do simdir, name_tuple
return [
slice(
get(simdir; short_name, reduction, period),
x = 0.0,
y = 0.0,
) for short_name in name_tuple
get(simdir; short_name, reduction, period) for short_name in name_tuple
]
end

Expand Down
1 change: 1 addition & 0 deletions src/ClimaAtmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ import .Diagnostics as CAD
include(joinpath("callbacks", "get_callbacks.jl"))

include(joinpath("simulation", "AtmosSimulations.jl"))
include(joinpath("simulation", "grids.jl"))

include(joinpath("solver", "model_getters.jl")) # high-level (using parsed_args) model getters
include(joinpath("solver", "type_getters.jl"))
Expand Down
3 changes: 1 addition & 2 deletions src/cache/temporary_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function temporary_quantities(Y, atmos)
center_space, face_space = axes(Y.c), axes(Y.f)

FT = Spaces.undertype(center_space)
CTh = CTh_vector_type(Y.c)
uvw_vec = UVW(FT(0), FT(0), FT(0))
return (;
ᶠtemp_scalar = Fields.Field(FT, face_space), # ᶠp, ᶠρK_h
Expand Down Expand Up @@ -81,7 +80,7 @@ function temporary_quantities(Y, atmos)
# TODO: Remove this hack
sfc_temp_C3 = Fields.Field(C3{FT}, Spaces.level(face_space, half)), # ρ_flux_χ
# Implicit solver cache:
∂ᶜK_∂ᶜuₕ = similar(Y.c, DiagonalMatrixRow{Adjoint{FT, CTh{FT}}}),
∂ᶜK_∂ᶜuₕ = similar(Y.c, DiagonalMatrixRow{Adjoint{FT, CT12{FT}}}),
∂ᶜK_∂ᶠu₃ = similar(Y.c, BidiagonalMatrixRow{Adjoint{FT, CT3{FT}}}),
ᶠp_grad_matrix = similar(Y.f, BidiagonalMatrixRow{C3{FT}}),
ᶠbidiagonal_matrix_ct3 = similar(Y.f, BidiagonalMatrixRow{CT3{FT}}),
Expand Down
1 change: 1 addition & 0 deletions src/callbacks/get_callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ function get_diagnostics(parsed_args, atmos_model, Y, p, sim_info, output_dir)
FT(time_to_seconds(parsed_args["t_end"]) - t_start),
start_date;
output_writer = netcdf_writer,
topography = has_topography(axes(Y.c)),
)...,
diagnostics...,
]
Expand Down
Loading
Loading