Skip to content

Commit cb7f050

Browse files
authored
Merge pull request #4009 from CliMA/sa/flux_form_updraft_advection
Use flux form terms for sedimentation
2 parents 1d30573 + a5cfe2a commit cb7f050

File tree

10 files changed

+140
-191
lines changed

10 files changed

+140
-191
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ steps:
862862
artifact_paths: "prognostic_edmfx_rico_implicit_column/output_active/*"
863863
agents:
864864
slurm_mem: 20GB
865+
soft_fail: true
865866

866867
- label: ":umbrella: Prognostic EDMFX Rico with 2-moment in a column"
867868
command: >

config/model_configs/prognostic_edmfx_rico_column_2M.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ z_elem: 100
2626
z_stretch: false
2727
perturb_initstate: false
2828
dt: "5secs"
29-
t_end: "180mins"
29+
t_end: "12hours"
3030
dt_save_state_to_disk: "60mins"
3131
toml: [toml/prognostic_edmfx_1M.toml]
3232
netcdf_interpolation_num_points: [8, 8, 100]

config/model_configs/prognostic_edmfx_trmm_column.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ y_elem: 2
2525
z_elem: 82
2626
z_stretch: false
2727
dt: 10secs
28-
t_end: 6hours
28+
t_end: 12hours
2929
dt_save_state_to_disk: 60mins
3030
toml: [toml/prognostic_edmfx_1M.toml]
3131
netcdf_interpolation_num_points: [8, 8, 82]

src/cache/precipitation_precomputed_quantities.jl

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ function set_precipitation_velocities!(
108108
)
109109
(; ᶜwₗ, ᶜwᵢ, ᶜwᵣ, ᶜwₛ, ᶜwₜqₜ, ᶜwₕhₜ) = p.precomputed
110110
(; ᶜΦ) = p.core
111-
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₕʲs) = p.precomputed
112-
(; ᶜts⁰) = p.precomputed
111+
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs) = p.precomputed
112+
(; ᶜts⁰, ᶜtsʲs) = p.precomputed
113113
cmc = CAP.microphysics_cloud_params(p.params)
114114
cmp = CAP.microphysics_1m_params(p.params)
115115
thp = CAP.thermodynamics_params(p.params)
@@ -211,7 +211,14 @@ function set_precipitation_velocities!(
211211
# Add contributions to energy and total water advection
212212
# TODO do we need to add kinetic energy of subdomains?
213213
for j in 1:n
214-
@. ᶜρwₕhₜ += Y.c.sgsʲs.:($$j).ρa * ᶜwₕʲs.:($$j) * Y.c.sgsʲs.:($$j).mse
214+
@. ᶜρwₕhₜ +=
215+
Y.c.sgsʲs.:($$j).ρa *
216+
(
217+
ᶜwₗʲs.:($$j) * Y.c.sgsʲs.:($$j).q_liq * (Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
218+
ᶜwᵢʲs.:($$j) * Y.c.sgsʲs.:($$j).q_ice * (Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
219+
ᶜwᵣʲs.:($$j) * Y.c.sgsʲs.:($$j).q_rai * (Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
220+
ᶜwₛʲs.:($$j) * Y.c.sgsʲs.:($$j).q_sno * (Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ)
221+
)
215222
end
216223
@. ᶜwₕhₜ = Geometry.WVector(ᶜρwₕhₜ) / Y.c.ρ
217224

@@ -323,8 +330,8 @@ function set_precipitation_velocities!(
323330
)
324331
(; ᶜwₗ, ᶜwᵢ, ᶜwᵣ, ᶜwₛ, ᶜwₙₗ, ᶜwₙᵣ, ᶜwₜqₜ, ᶜwₕhₜ) = p.precomputed
325332
(; ᶜΦ) = p.core
326-
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₙₗʲs, ᶜwₙᵣʲs, ᶜwₕʲs) = p.precomputed
327-
(; ᶜts⁰) = p.precomputed
333+
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₙₗʲs, ᶜwₙᵣʲs) = p.precomputed
334+
(; ᶜts⁰, ᶜtsʲs) = p.precomputed
328335
cmc = CAP.microphysics_cloud_params(p.params)
329336
cm1p = CAP.microphysics_1m_params(p.params)
330337
cm2p = CAP.microphysics_2m_params(p.params)
@@ -477,7 +484,14 @@ function set_precipitation_velocities!(
477484
# Add contributions to energy and total water advection
478485
# TODO do we need to add kinetic energy of subdomains?
479486
for j in 1:n
480-
@. ᶜρwₕhₜ += Y.c.sgsʲs.:($$j).ρa * ᶜwₕʲs.:($$j) * Y.c.sgsʲs.:($$j).mse
487+
@. ᶜρwₕhₜ +=
488+
Y.c.sgsʲs.:($$j).ρa *
489+
(
490+
ᶜwₗʲs.:($$j) * Y.c.sgsʲs.:($$j).q_liq * (Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
491+
ᶜwᵢʲs.:($$j) * Y.c.sgsʲs.:($$j).q_ice * (Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
492+
ᶜwᵣʲs.:($$j) * Y.c.sgsʲs.:($$j).q_rai * (Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
493+
ᶜwₛʲs.:($$j) * Y.c.sgsʲs.:($$j).q_sno * (Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ)
494+
)
481495
end
482496
@. ᶜwₕhₜ = Geometry.WVector(ᶜρwₕhₜ) / Y.c.ρ
483497

src/cache/precomputed_quantities.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ function precomputed_quantities(Y, atmos)
142142
ᶜwᵢʲs = similar(Y.c, NTuple{n, FT}),
143143
ᶜwᵣʲs = similar(Y.c, NTuple{n, FT}),
144144
ᶜwₛʲs = similar(Y.c, NTuple{n, FT}),
145-
ᶜwₜʲs = similar(Y.c, NTuple{n, FT}),
146-
ᶜwₕʲs = similar(Y.c, NTuple{n, FT}),
147145
ᶜSqₗᵖ⁰ = similar(Y.c, FT),
148146
ᶜSqᵢᵖ⁰ = similar(Y.c, FT),
149147
ᶜSqᵣᵖ⁰ = similar(Y.c, FT),
@@ -161,8 +159,6 @@ function precomputed_quantities(Y, atmos)
161159
ᶜwᵢʲs = similar(Y.c, NTuple{n, FT}),
162160
ᶜwᵣʲs = similar(Y.c, NTuple{n, FT}),
163161
ᶜwₛʲs = similar(Y.c, NTuple{n, FT}),
164-
ᶜwₜʲs = similar(Y.c, NTuple{n, FT}),
165-
ᶜwₕʲs = similar(Y.c, NTuple{n, FT}),
166162
ᶜwₙₗʲs = similar(Y.c, NTuple{n, FT}),
167163
ᶜwₙᵣʲs = similar(Y.c, NTuple{n, FT}),
168164
ᶜSqₗᵖ⁰ = similar(Y.c, FT),

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -519,23 +519,20 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
519519
@assert (p.atmos.moisture_model isa NonEquilMoistModel)
520520

521521
(; params, dt) = p
522-
(; ᶜΦ,) = p.core
523522
thp = CAP.thermodynamics_params(params)
524523
cmp = CAP.microphysics_1m_params(params)
525524
cmc = CAP.microphysics_cloud_params(params)
526-
(; turbconv_model) = p.atmos
527525

528526
(; ᶜSqₗᵖʲs, ᶜSqᵢᵖʲs, ᶜSqᵣᵖʲs, ᶜSqₛᵖʲs, ᶜρʲs, ᶜtsʲs) = p.precomputed
529527
(; ᶜSqₗᵖ⁰, ᶜSqᵢᵖ⁰, ᶜSqᵣᵖ⁰, ᶜSqₛᵖ⁰, ᶜts⁰) = p.precomputed
530528

531-
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₜʲs, ᶜwₕʲs) = p.precomputed
529+
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs) = p.precomputed
532530

533531
# TODO - can I re-use them between js and env?
534532
ᶜSᵖ = p.scratch.ᶜtemp_scalar
535533
ᶜSᵖ_snow = p.scratch.ᶜtemp_scalar_2
536534

537535
n = n_mass_flux_subdomains(p.atmos.turbconv_model)
538-
FT = eltype(params)
539536

540537
for j in 1:n
541538

@@ -565,35 +562,6 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
565562
ᶜρʲs.:($$j),
566563
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_ice),
567564
)
568-
# compute their contirbutions to energy and total water advection
569-
@. ᶜwₜʲs.:($$j) = ifelse(
570-
Y.c.sgsʲs.:($$j).ρa * Y.c.sgsʲs.:($$j).q_tot > FT(0),
571-
(
572-
ᶜwₗʲs.:($$j) * Y.c.sgsʲs.:($$j).q_liq +
573-
ᶜwᵢʲs.:($$j) * Y.c.sgsʲs.:($$j).q_ice +
574-
ᶜwᵣʲs.:($$j) * Y.c.sgsʲs.:($$j).q_rai +
575-
ᶜwₛʲs.:($$j) * Y.c.sgsʲs.:($$j).q_sno
576-
) / Y.c.sgsʲs.:($$j).q_tot,
577-
FT(0),
578-
)
579-
@. ᶜwₕʲs.:($$j) = ifelse(
580-
Y.c.sgsʲs.:($$j).ρa * abs(Y.c.sgsʲs.:($$j).mse) > FT(0),
581-
(
582-
ᶜwₗʲs.:($$j) *
583-
Y.c.sgsʲs.:($$j).q_liq *
584-
(Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
585-
ᶜwᵢʲs.:($$j) *
586-
Y.c.sgsʲs.:($$j).q_ice *
587-
(Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
588-
ᶜwᵣʲs.:($$j) *
589-
Y.c.sgsʲs.:($$j).q_rai *
590-
(Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
591-
ᶜwₛʲs.:($$j) *
592-
Y.c.sgsʲs.:($$j).q_sno *
593-
(Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ)
594-
) / (Y.c.sgsʲs.:($$j).mse),
595-
FT(0),
596-
)
597565

598566
# Precipitation sources and sinks from the updrafts
599567
compute_precipitation_sources!(
@@ -730,7 +698,6 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
730698
)
731699

732700
(; params, dt) = p
733-
(; ᶜΦ,) = p.core
734701
thp = CAP.thermodynamics_params(params)
735702
cm1p = CAP.microphysics_1m_params(p.params)
736703
cm2p = CAP.microphysics_2m_params(p.params)
@@ -749,7 +716,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
749716
) = p.precomputed
750717
(; ᶜSqₗᵖ⁰, ᶜSqᵢᵖ⁰, ᶜSqᵣᵖ⁰, ᶜSqₛᵖ⁰, ᶜSnₗᵖ⁰, ᶜSnᵣᵖ⁰, ᶜts⁰, ᶜu⁰) =
751718
p.precomputed
752-
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₙₗʲs, ᶜwₙᵣʲs, ᶜwₜʲs, ᶜwₕʲs, ᶜuʲs) =
719+
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₙₗʲs, ᶜwₙᵣʲs, ᶜuʲs) =
753720
p.precomputed
754721

755722
ᶜSᵖ = p.scratch.ᶜtemp_scalar
@@ -776,7 +743,6 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
776743

777744
# Compute sources
778745
n = n_mass_flux_subdomains(p.atmos.turbconv_model)
779-
FT = eltype(params)
780746
for j in 1:n
781747

782748
# compute terminal velocity for precipitation
@@ -835,35 +801,6 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
835801
ᶜρʲs.:($$j),
836802
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_ice),
837803
)
838-
# compute their contirbutions to energy and total water advection
839-
@. ᶜwₜʲs.:($$j) = ifelse(
840-
Y.c.sgsʲs.:($$j).ρa * Y.c.sgsʲs.:($$j).q_tot > FT(0),
841-
(
842-
ᶜwₗʲs.:($$j) * Y.c.sgsʲs.:($$j).q_liq +
843-
ᶜwᵢʲs.:($$j) * Y.c.sgsʲs.:($$j).q_ice +
844-
ᶜwᵣʲs.:($$j) * Y.c.sgsʲs.:($$j).q_rai +
845-
ᶜwₛʲs.:($$j) * Y.c.sgsʲs.:($$j).q_sno
846-
) / Y.c.sgsʲs.:($$j).q_tot,
847-
FT(0),
848-
)
849-
@. ᶜwₕʲs.:($$j) = ifelse(
850-
Y.c.sgsʲs.:($$j).ρa * abs(Y.c.sgsʲs.:($$j).mse) > FT(0),
851-
(
852-
ᶜwₗʲs.:($$j) *
853-
Y.c.sgsʲs.:($$j).q_liq *
854-
(Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
855-
ᶜwᵢʲs.:($$j) *
856-
Y.c.sgsʲs.:($$j).q_ice *
857-
(Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
858-
ᶜwᵣʲs.:($$j) *
859-
Y.c.sgsʲs.:($$j).q_rai *
860-
(Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
861-
ᶜwₛʲs.:($$j) *
862-
Y.c.sgsʲs.:($$j).q_sno *
863-
(Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ)
864-
) / (Y.c.sgsʲs.:($$j).mse),
865-
FT(0),
866-
)
867804

868805
# Precipitation sources and sinks from the updrafts
869806
compute_warm_precipitation_sources_2M!(

0 commit comments

Comments
 (0)