Skip to content

Commit 03076a8

Browse files
committed
rft: split horizontal and vertical smagorinsky
- add diffusivity diagnostics - implicit vertical smagorinsky - les ci_plots edits - use vertical strain for lilly correction - full strain rate method
1 parent 6c5903a commit 03076a8

File tree

11 files changed

+316
-154
lines changed

11 files changed

+316
-154
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`, `UV`, `W`, `UV_W_decoupled`] (!! experimental !!)"
174+
value: ~
175175
bubble:
176176
help: "Enable bubble correction for more accurate surface areas"
177177
value: false

post_processing/ci_plots.jl

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,17 +1310,10 @@ 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", "hus", "hur", "cl", "clw", "cli", "ke",
1314+
"Dh_smag", "dtmaxh_smag", "strainrateh_smag", # smag horizontal
1315+
"Dv_smag", "dtmaxv_smag", "strainratev_smag", # smag vertical
1316+
"edt" # DecayWithHeight vertical diffusivity
13241317
]
13251318
short_names = short_names collect(keys(simdirs[1].vars))
13261319

@@ -1333,10 +1326,7 @@ function make_plots(
13331326
window_end = last(var.dims["time"])
13341327
window_start = window_end - 2hours
13351328
var_window = ClimaAnalysis.window(
1336-
var,
1337-
"time";
1338-
left = window_start,
1339-
right = window_end,
1329+
var, "time"; left = window_start, right = window_end,
13401330
)
13411331
var_reduced = horizontal_average(average_time(var_window))
13421332
return var_reduced

src/cache/precomputed_quantities.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,17 @@ function precomputed_quantities(Y, atmos)
245245
precipitation_sgs_quantities...,
246246
diagnostic_precipitation_sgs_quantities...,
247247
) : (;)
248-
smagorinsky_lilly_quantities =
249-
if atmos.smagorinsky_lilly isa SmagorinskyLilly
248+
smagorinsky_quantities =
249+
if atmos.smagorinsky 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+
ᶜL_h = similar(Y.c, FT), ᶜL_v = similar(Y.c, FT),
255+
ᶜνₜ_h = similar(Y.c, FT), ᶜνₜ_v = similar(Y.c, FT),
256+
ᶜD_h = similar(Y.c, FT), ᶜD_v = similar(Y.c, FT),
257+
ᶜS_norm_h = similar(Y.c, FT),
258+
ᶜS_norm_v = similar(Y.c, FT),
256259
)
257260
else
258261
(;)
@@ -281,8 +284,9 @@ function precomputed_quantities(Y, atmos)
281284
precipitation_quantities...,
282285
surface_precip_fluxes...,
283286
cloud_diagnostics_tuple,
284-
smagorinsky_lilly_quantities...,
285-
amd_les_quantities...)
287+
smagorinsky_quantities...,
288+
amd_les_quantities...,
289+
)
286290
end
287291

288292
# Interpolates the third contravariant component of Y.c.uₕ to cell faces.
@@ -608,9 +612,7 @@ NVTX.@annotate function set_explicit_precomputed_quantities_part2!(Y, p, t)
608612
set_cloud_fraction!(Y, p, moisture_model, cloud_model)
609613
end
610614

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

615617
if p.atmos.amd_les isa AnisotropicMinimumDissipation
616618
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 = "Horizontal 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 = "strainrateh_smag",
369+
long_name = "Strain rate horizontal 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 = "strainratev_smag",
378+
long_name = "Strain rate vertical 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)