Skip to content

Commit fb93e5d

Browse files
committed
Add EDOnlyEDMFX
1 parent f0645ec commit fb93e5d

File tree

17 files changed

+140
-18
lines changed

17 files changed

+140
-18
lines changed

.buildkite/pipeline.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,30 @@ steps:
533533
agents:
534534
slurm_mem: 20GB
535535

536+
- group: "EDOnlyEDMFX"
537+
steps:
538+
539+
- label: ":man_in_business_suit_levitating: EDOnlyEDMFX test on a sphere"
540+
command: >
541+
julia --color=yes --project=.buildkite .buildkite/ci_driver.jl
542+
--config_file $CONFIG_PATH/edonly_edmfx_aquaplanet.yml
543+
--job_id edonly_edmfx_aquaplanet
544+
artifact_paths: "edonly_edmfx_aquaplanet/output_active/*"
545+
agents:
546+
slurm_mem: 20GB
547+
548+
- label: ":man_in_business_suit_levitating: EDOnlyEDMFX test on a sphere GPU"
549+
command: >
550+
julia --color=yes --project=.buildkite .buildkite/ci_driver.jl
551+
--config_file $CONFIG_PATH/edonly_edmfx_aquaplanet.yml
552+
--job_id edonly_edmfx_aquaplanet_gpu
553+
artifact_paths: "edonly_edmfx_aquaplanet_gpu/output_active/*"
554+
env:
555+
CLIMACOMMS_DEVICE: "CUDA"
556+
agents:
557+
slurm_mem: 20GB
558+
slurm_gpus: 1
559+
536560
- group: "Diagnostic EDMFX"
537561
steps:
538562

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ Main
55
-------
66
### Features
77

8+
### Add EDOnlyEDMFX
9+
10+
PR [3622](https://github.com/CliMA/ClimaAtmos.jl/pull/3622) adds a new
11+
simplified EDMF model that only implements the Eddy-Diffusivity part of the
12+
scheme (not the Mass-Flux).
13+
14+
815
### Update default configuration to use deep-atmosphere eqns, fix diagnostic bug
916
PR [3422](https://github.com/CliMA/ClimaAtmos.jl/pull/3422)
1017
Updates the `default_config` to set `deep_atmosphere=true`, and updates the
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
surface_setup: DefaultMoninObukhov
2+
rad: allskywithclear
3+
co2_model: fixed
4+
implicit_diffusion: true
5+
approximate_linear_solve_iters: 2
6+
edmfx_sgs_diffusive_flux: true
7+
turbconv: edonly_edmfx
8+
moist: equil
9+
precip_model: 0M
10+
dt: 120secs
11+
t_end: 3hours
12+
dt_save_state_to_disk: 600secs
13+
use_itime: true

post_processing/ci_plots.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ function make_plots(
950950
end
951951

952952
AquaplanetPlots = Union{
953+
Val{:edonly_edmfx_aquaplanet},
953954
Val{:mpi_sphere_aquaplanet_rhoe_equilmoist_clearsky},
954955
Val{:sphere_aquaplanet_rhoe_nonequilmoist_allsky},
955956
Val{:rcemipii_sphere_diagnostic_edmfx},

src/cache/cloud_fraction.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,14 @@ NVTX.@annotate function set_cloud_fraction!(
131131
p,
132132
::Union{EquilMoistModel, NonEquilMoistModel},
133133
qc::SGSQuadratureCloud,
134-
::DiagnosticEDMFX,
134+
::Union{EDOnlyEDMFX, DiagnosticEDMFX},
135135
)
136136
SG_quad = qc.SG_quad
137137
(; params) = p
138138

139139
FT = eltype(params)
140140
thermo_params = CAP.thermodynamics_params(params)
141141
(; ᶜts, ᶜmixing_length, cloud_diagnostics_tuple) = p.precomputed
142-
(; ᶜρaʲs, ᶜρʲs, ᶜtsʲs) = p.precomputed
143142
(; turbconv_model) = p.atmos
144143

145144
# TODO - we should make this default when using diagnostic edmf
@@ -158,6 +157,9 @@ NVTX.@annotate function set_cloud_fraction!(
158157

159158
# updrafts
160159
n = n_mass_flux_subdomains(turbconv_model)
160+
if n > 0
161+
(; ᶜρaʲs, ᶜρʲs, ᶜtsʲs) = p.precomputed
162+
end
161163

162164
for j in 1:n
163165
@. cloud_diagnostics_tuple += NamedTuple{(:cf, :q_liq, :q_ice)}(
@@ -296,8 +298,8 @@ function quad_loop(
296298
θ_hat = μ_c + sqrt(FT(2)) * σ_c * χ2
297299
q_hat = q_mean + sqrt(FT(2)) * σ_q * χ1
298300
# The σ_q_lim limits q_tot_hat to be close to zero
299-
# for the negative sampling points. However due to numerical erros
300-
# we sometimes still get small negative numers here
301+
# for the negative sampling points. However due to numerical errors
302+
# we sometimes still get small negative numbers here
301303
return (θ_hat, max(FT(0), q_hat))
302304
end
303305

@@ -315,7 +317,6 @@ function quad_loop(
315317

316318
return (; cf, q_liq, q_ice)
317319
end
318-
319320
return quad(f, get_x_hat, SG_quad)
320321
end
321322

src/cache/diagnostic_edmf_precomputed_quantities.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,7 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_closures!
914914
(; ᶜp, ᶜu, ᶜts) = p.precomputed
915915
(; q_tot) = p.precomputed.ᶜspecific
916916
(; ustar, obukhov_length) = p.precomputed.sfc_conditions
917-
(; ᶜρaʲs, ᶠu³ʲs, ᶜdetrʲs) = p.precomputed
918-
(; ᶜtke⁰, ᶠu³⁰, ᶜu⁰) = p.precomputed
917+
(; ᶜtke⁰) = p.precomputed
919918
(;
920919
ᶜlinear_buoygrad,
921920
ᶜstrain_rate_norm,
@@ -926,7 +925,13 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_closures!
926925
thermo_params = CAP.thermodynamics_params(params)
927926
ᶜlg = Fields.local_geometry_field(Y.c)
928927

929-
@. ᶜu⁰ = C123(Y.c.uₕ) + ᶜinterp(C123(ᶠu³⁰))
928+
if p.atmos.turbconv_model isa DiagnosticEDMFX
929+
(; ᶜρaʲs, ᶠu³ʲs, ᶜdetrʲs, ᶠu³⁰, ᶜu⁰) = p.precomputed
930+
elseif p.atmos.turbconv_model isa EDOnlyEDMFX
931+
ᶠu³⁰ = p.precomputed.ᶠu³
932+
ᶜu⁰ = ᶜu
933+
end
934+
@. ᶜu⁰ = C123(Y.c.uₕ) + ᶜinterp(C123(ᶠu³⁰)) # Set here, but used in a different function
930935

931936
@. ᶜlinear_buoygrad = buoyancy_gradients(
932937
BuoyGradMean(),

src/cache/precomputed_quantities.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ function precomputed_quantities(Y, atmos)
113113
ᶜgradᵥ_θ_liq_ice⁰ = Fields.Field(C3{FT}, cspace),
114114
precipitation_sgs_quantities...,
115115
) : (;)
116+
117+
edonly_quantities =
118+
atmos.turbconv_model isa EDOnlyEDMFX ?
119+
(;
120+
ᶜmixing_length_tuple = similar(Y.c, MixingLength{FT}),
121+
ᶜtke⁰ = similar(Y.c, FT),
122+
ᶜK_u = similar(Y.c, FT),
123+
ρatke_flux = similar(Fields.level(Y.f, half), C3{FT}),
124+
ᶜK_h = similar(Y.c, FT),
125+
) : (;)
126+
116127
sgs_quantities = (;
117128
ᶜgradᵥ_θ_virt = Fields.Field(C3{FT}, cspace),
118129
ᶜgradᵥ_q_tot = Fields.Field(C3{FT}, cspace),
@@ -172,6 +183,7 @@ function precomputed_quantities(Y, atmos)
172183
gs_quantities...,
173184
sgs_quantities...,
174185
advective_sgs_quantities...,
186+
edonly_quantities...,
175187
diagnostic_sgs_quantities...,
176188
vert_diff_quantities...,
177189
sedimentation_quantities...,
@@ -519,6 +531,10 @@ NVTX.@annotate function set_precomputed_quantities!(Y, p, t)
519531
)
520532
end
521533

534+
if turbconv_model isa EDOnlyEDMFX
535+
set_diagnostic_edmf_precomputed_quantities_env_closures!(Y, p, t)
536+
end
537+
522538
if vert_diff isa DecayWithHeightDiffusion
523539
(; ᶜK_h) = p.precomputed
524540
bc_K_h = compute_eddy_diffusivity_coefficient(ᶜρ, vert_diff)

src/diagnostics/Diagnostics.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import ..VerticalDiffusion
3737
import ..DecayWithHeightDiffusion
3838

3939
# turbconv_model
40+
import ..EDOnlyEDMFX
4041
import ..PrognosticEDMFX
4142
import ..DiagnosticEDMFX
4243

src/diagnostics/default_diagnostics.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,13 @@ function default_diagnostics(
378378
)...,
379379
]
380380
end
381+
382+
function default_diagnostics(::EDOnlyEDMFX, duration, start_date; output_writer)
383+
edonly_edmfx_diagnostics = ["tke"]
384+
385+
average_func = frequency_averages(duration)
386+
387+
return [
388+
average_func(edonly_edmfx_diagnostics...; output_writer, start_date)...,
389+
]
390+
end

src/diagnostics/edmfx_diagnostics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ function compute_tke!(
893893
state,
894894
cache,
895895
time,
896-
turbconv_model::Union{PrognosticEDMFX, DiagnosticEDMFX},
896+
turbconv_model::Union{EDOnlyEDMFX, PrognosticEDMFX, DiagnosticEDMFX},
897897
)
898898
if isnothing(out)
899899
return copy(cache.precomputed.ᶜtke⁰)

0 commit comments

Comments
 (0)