Skip to content

Commit a82a107

Browse files
committed
rft: smagorinsky-lilly for future h-v splitting
1 parent 6552cfe commit a82a107

File tree

10 files changed

+233
-150
lines changed

10 files changed

+233
-150
lines changed

config/default_configs/default_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ c_amd:
170170
help: "Model coefficient for AMD-LES closure (TODO: Move to parameters.toml)"
171171
value: 0.29
172172
smagorinsky_lilly:
173-
help: "Smagorinsky-Lilly diffusive closure [`false` (default), `true`]"
174-
value: false
173+
help: "Smagorinsky-Lilly diffusive closure [`nothing` (default), `UVW`]"
174+
value: ~
175175
bubble:
176176
help: "Enable bubble correction for more accurate surface areas"
177177
value: false

config/model_configs/box_density_current_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
reference_job_id: "les_box"
22
initial_condition: "DryDensityCurrentProfile"
33
config: "box"
4-
smagorinsky_lilly: true
4+
smagorinsky_lilly: "UVW"
55
discrete_hydrostatic_balance: true
66
hyperdiff: "false"
77
x_max: 51200.0

config/model_configs/les_isdac_box.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ implicit_diffusion: false
1414
approximate_linear_solve_iters: 2
1515
hyperdiff: "false"
1616
apply_limiter: false
17-
smagorinsky_lilly: true
17+
smagorinsky_lilly: "UVW"
1818
# time- and spatial discretization
1919
x_elem: 10
2020
x_max: 3.2e3

post_processing/ci_plots.jl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,17 +1310,11 @@ function make_plots(
13101310

13111311
reduction = "inst"
13121312
short_names = [
1313-
"wa",
1314-
"ua",
1315-
"va",
1316-
"ta",
1317-
"thetaa",
1318-
"ha",
1319-
"hus",
1320-
"hur",
1321-
"cl",
1322-
"clw",
1323-
"cli",
1313+
"wa", "ua", "va", "ta", "thetaa", "ha",
1314+
"hus", "hur", "cl", "clw", "cli", "ke",
1315+
"Dh_smag", "strainh_smag", # smag horizontal
1316+
"Dv_smag", "strainv_smag", # smag vertical
1317+
"edt", # DecayWithHeight vertical diffusivity
13241318
]
13251319
short_names = short_names collect(keys(simdirs[1].vars))
13261320

@@ -1333,10 +1327,7 @@ function make_plots(
13331327
window_end = last(var.dims["time"])
13341328
window_start = window_end - 2hours
13351329
var_window = ClimaAnalysis.window(
1336-
var,
1337-
"time";
1338-
left = window_start,
1339-
right = window_end,
1330+
var, "time"; left = window_start, right = window_end,
13401331
)
13411332
var_reduced = horizontal_average(average_time(var_window))
13421333
return var_reduced

src/cache/precomputed_quantities.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,12 @@ function precomputed_quantities(Y, atmos)
249249
if atmos.smagorinsky_lilly isa SmagorinskyLilly
250250
uvw_vec = UVW(FT(0), FT(0), FT(0))
251251
(;
252-
ᶜτ_smag = similar(Y.c, typeof(uvw_vec * uvw_vec')),
253-
ᶠτ_smag = similar(Y.f, typeof(uvw_vec * uvw_vec')),
254-
ᶜD_smag = similar(Y.c, FT),
255-
ᶠD_smag = similar(Y.f, FT),
252+
ᶜS = similar(Y.c, typeof(uvw_vec * uvw_vec')),
253+
ᶠS = similar(Y.f, typeof(uvw_vec * uvw_vec')),
254+
ᶜS_norm_h = similar(Y.c, FT), ᶜS_norm_v = similar(Y.c, FT),
255+
ᶜL_h = similar(Y.c, FT), ᶜL_v = similar(Y.c, FT),
256+
ᶜνₜ_h = similar(Y.c, FT), ᶜνₜ_v = similar(Y.c, FT),
257+
ᶜD_h = similar(Y.c, FT), ᶜD_v = similar(Y.c, FT),
256258
)
257259
else
258260
(;)
@@ -608,9 +610,7 @@ NVTX.@annotate function set_explicit_precomputed_quantities_part2!(Y, p, t)
608610
set_cloud_fraction!(Y, p, moisture_model, cloud_model)
609611
end
610612

611-
if p.atmos.smagorinsky_lilly isa SmagorinskyLilly
612-
set_smagorinsky_lilly_precomputed_quantities!(Y, p)
613-
end
613+
set_smagorinsky_lilly_precomputed_quantities!(Y, p, p.atmos.smagorinsky_lilly)
614614

615615
if p.atmos.amd_les isa AnisotropicMinimumDissipation
616616
set_amd_precomputed_quantities!(Y, p)

src/diagnostics/core_diagnostics.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,46 @@ add_diagnostic_variable!(
343343
end,
344344
)
345345

346+
###
347+
# Smagorinsky Lilly diffusivity
348+
###
349+
add_diagnostic_variable!(
350+
short_name = "Dh_smag",
351+
long_name = "Horizontal smagorinsky diffusivity",
352+
units = "m^2 s^-1",
353+
compute! = (out, _, cache, _) -> begin
354+
(; ᶜD_h) = cache.precomputed
355+
isnothing(out) ? copy(ᶜD_h) : (out .= ᶜD_h)
356+
end,
357+
)
358+
add_diagnostic_variable!(
359+
short_name = "Dv_smag",
360+
long_name = "Vertical smagorinsky diffusivity",
361+
units = "m^2 s^-1",
362+
compute! = (out, _, cache, _) -> begin
363+
(; ᶜD_v) = cache.precomputed
364+
isnothing(out) ? copy(ᶜD_v) : (out .= ᶜD_v)
365+
end,
366+
)
367+
add_diagnostic_variable!(
368+
short_name = "strainh_smag",
369+
long_name = "Horizontal strain rate magnitude (for Smagorinsky)",
370+
units = "s",
371+
compute! = (out, state, cache, _) -> begin
372+
(; ᶜS_norm_h) = cache.precomputed
373+
isnothing(out) ? copy(ᶜS_norm_h) : (out .= ᶜS_norm_h)
374+
end,
375+
)
376+
add_diagnostic_variable!(
377+
short_name = "strainv_smag",
378+
long_name = "Vertical strain rate magnitude (for Smagorinsky)",
379+
units = "s",
380+
compute! = (out, state, cache, _) -> begin
381+
(; ᶜS_norm_v) = cache.precomputed
382+
isnothing(out) ? copy(ᶜS_norm_v) : (out .= ᶜS_norm_v)
383+
end,
384+
)
385+
346386
###
347387
# Relative humidity (3d)
348388
###

0 commit comments

Comments
 (0)