Skip to content

Commit 526d837

Browse files
authored
Merge branch 'main' into ep/add_rwp
2 parents 0ce8c26 + df84868 commit 526d837

File tree

9 files changed

+194
-48
lines changed

9 files changed

+194
-48
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,9 @@ version = "0.1.13"
462462

463463
[[deps.CloudMicrophysics]]
464464
deps = ["ClimaParams", "DocStringExtensions", "ForwardDiff", "LazyArtifacts", "LogExpFunctions", "RootSolvers", "SpecialFunctions", "StaticArrays", "Thermodynamics"]
465-
git-tree-sha1 = "755a88a92c3281975eec4da19dbbec8839c607aa"
465+
git-tree-sha1 = "3a938de9cf21b603108aa273d973997fbd8c882d"
466466
uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
467-
version = "0.26.2"
467+
version = "0.26.4"
468468

469469
[deps.CloudMicrophysics.extensions]
470470
EmulatorModelsExt = ["DataFrames", "MLJ"]

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ClimaInterpolations = "0.1.0"
5050
ClimaParams = "0.11.1"
5151
ClimaTimeSteppers = "0.8.2"
5252
ClimaUtilities = "0.1.23"
53-
CloudMicrophysics = "0.26.2"
53+
CloudMicrophysics = "0.26.4"
5454
Dates = "1"
5555
ForwardDiff = "1"
5656
Insolation = "0.9.5"

config/model_configs/prognostic_edmfx_rico_column_2M.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ subsidence: "Rico"
33
ls_adv: "Rico"
44
surface_setup: "Rico"
55
turbconv: "prognostic_edmfx"
6-
implicit_diffusion: false
6+
implicit_diffusion: true
77
implicit_sgs_advection: false
88
approximate_linear_solve_iters: 2
99
edmfx_upwinding: first_order
@@ -25,9 +25,9 @@ y_elem: 2
2525
z_elem: 100
2626
z_stretch: false
2727
perturb_initstate: false
28-
dt: "10secs"
29-
t_end: "6hours"
30-
dt_save_state_to_disk: "10mins"
28+
dt: "5secs"
29+
t_end: "180mins"
30+
dt_save_state_to_disk: "60mins"
3131
toml: [toml/prognostic_edmfx_1M.toml]
3232
netcdf_interpolation_num_points: [8, 8, 100]
3333
prescribed_aerosols: ["SO4", "CB1", "OC1", "DST01", "SSLT01", "SSLT02", "SSLT03", "SSLT04", "SSLT05"]

docs/src/config_no_table.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ To start the model with a custom configuration, run:
1212
### Example
1313
Below is the default Bomex configuration:
1414
```
15-
job_id: "prognostic_edmfx_bomex_box"
1615
initial_condition: "Bomex"
1716
subsidence: "Bomex"
1817
scm_coriolis: "Bomex"

src/cache/precipitation_precomputed_quantities.jl

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function set_precipitation_velocities!(
107107
(; ᶜwₗ, ᶜwᵢ, ᶜwᵣ, ᶜwₛ, ᶜwnₗ, ᶜwnᵣ, ᶜwₜqₜ, ᶜwₕhₜ, ᶜts, ᶜu) = p.precomputed
108108
(; ᶜΦ) = p.core
109109

110-
cm1c = CAP.microphysics_cloud_params(p.params)
110+
cmc = CAP.microphysics_cloud_params(p.params)
111111
cm1p = CAP.microphysics_1m_params(p.params)
112112
cm2p = CAP.microphysics_2m_params(p.params)
113113
thp = CAP.thermodynamics_params(p.params)
@@ -117,50 +117,56 @@ function set_precipitation_velocities!(
117117
@. ᶜwnᵣ = getindex(
118118
CM2.rain_terminal_velocity(
119119
cm2p.sb,
120-
cm2p.tv,
121-
specific(Y.c.ρq_rai, Y.c.ρ),
120+
cm2p.rtv,
121+
max(zero(Y.c.ρ), specific(Y.c.ρq_rai, Y.c.ρ)),
122122
Y.c.ρ,
123-
Y.c.ρn_rai,
123+
max(zero(Y.c.ρ), Y.c.ρn_rai),
124124
),
125125
1,
126126
)
127127
@. ᶜwᵣ = getindex(
128128
CM2.rain_terminal_velocity(
129129
cm2p.sb,
130-
cm2p.tv,
131-
specific(Y.c.ρq_rai, Y.c.ρ),
130+
cm2p.rtv,
131+
max(zero(Y.c.ρ), specific(Y.c.ρq_rai, Y.c.ρ)),
132132
Y.c.ρ,
133-
Y.c.ρn_rai,
133+
max(zero(Y.c.ρ), Y.c.ρn_rai),
134134
),
135135
2,
136136
)
137137
@. ᶜwₛ = CM1.terminal_velocity(
138138
cm1p.ps,
139139
cm1p.tv.snow,
140140
Y.c.ρ,
141-
specific(Y.c.ρq_sno, Y.c.ρ),
141+
max(zero(Y.c.ρ), specific(Y.c.ρq_sno, Y.c.ρ)),
142142
)
143143
# compute sedimentation velocity for cloud condensate [m/s]
144-
# TODO sedimentation velocities of cloud condensates are based
145-
# on the 1M scheme. Sedimentation velocity of cloud number concentration
146-
# is equal to that of the mass.
147-
@. ᶜwnₗ = CMNe.terminal_velocity(
148-
cm1c.liquid,
149-
cm1c.Ch2022.rain,
150-
Y.c.ρ,
151-
specific(Y.c.ρq_liq, Y.c.ρ),
144+
# TODO sedimentation of ice is based on the 1M scheme
145+
@. ᶜwnₗ = getindex(
146+
CM2.cloud_terminal_velocity(
147+
cm2p.sb.pdf_c,
148+
cm2p.ctv,
149+
max(zero(Y.c.ρ), specific(Y.c.ρq_liq, Y.c.ρ)),
150+
Y.c.ρ,
151+
max(zero(Y.c.ρ), Y.c.ρn_liq),
152+
),
153+
1,
152154
)
153-
@. ᶜwₗ = CMNe.terminal_velocity(
154-
cm1c.liquid,
155-
cm1c.Ch2022.rain,
156-
Y.c.ρ,
157-
specific(Y.c.ρq_liq, Y.c.ρ),
155+
@. ᶜwₗ = getindex(
156+
CM2.cloud_terminal_velocity(
157+
cm2p.sb.pdf_c,
158+
cm2p.ctv,
159+
max(zero(Y.c.ρ), specific(Y.c.ρq_liq, Y.c.ρ)),
160+
Y.c.ρ,
161+
max(zero(Y.c.ρ), Y.c.ρn_liq),
162+
),
163+
2,
158164
)
159165
@. ᶜwᵢ = CMNe.terminal_velocity(
160-
cm1c.ice,
161-
cm1c.Ch2022.small_ice,
166+
cmc.ice,
167+
cmc.Ch2022.small_ice,
162168
Y.c.ρ,
163-
specific(Y.c.ρq_ice, Y.c.ρ),
169+
max(zero(Y.c.ρ), specific(Y.c.ρq_ice, Y.c.ρ)),
164170
)
165171

166172
# compute their contributions to energy and total water advection

src/cache/precomputed_quantities.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,14 @@ function precomputed_quantities(Y, atmos)
157157
ᶜSqₛᵖʲs = similar(Y.c, NTuple{n, FT}),
158158
ᶜSnₗᵖʲs = similar(Y.c, NTuple{n, FT}),
159159
ᶜSnᵣᵖʲs = similar(Y.c, NTuple{n, FT}),
160+
ᶜwₗʲs = similar(Y.c, NTuple{n, FT}),
161+
ᶜwᵢʲs = similar(Y.c, NTuple{n, FT}),
162+
ᶜwᵣʲs = similar(Y.c, NTuple{n, FT}),
163+
ᶜ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}),
166+
ᶜwₙₗʲs = similar(Y.c, NTuple{n, FT}),
167+
ᶜwₙᵣʲs = similar(Y.c, NTuple{n, FT}),
160168
ᶜSqₗᵖ⁰ = similar(Y.c, FT),
161169
ᶜSqᵢᵖ⁰ = similar(Y.c, FT),
162170
ᶜSqᵣᵖ⁰ = similar(Y.c, FT),

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 97 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,10 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
769769
)
770770

771771
(; params, dt) = p
772+
(; ᶜΦ,) = p.core
772773
thp = CAP.thermodynamics_params(params)
773-
cmp = CAP.microphysics_2m_params(params)
774+
cm1p = CAP.microphysics_1m_params(p.params)
775+
cm2p = CAP.microphysics_2m_params(p.params)
774776
cmc = CAP.microphysics_cloud_params(params)
775777

776778
(;
@@ -786,6 +788,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
786788
) = p.precomputed
787789
(; ᶜSqₗᵖ⁰, ᶜSqᵢᵖ⁰, ᶜSqᵣᵖ⁰, ᶜSqₛᵖ⁰, ᶜSnₗᵖ⁰, ᶜSnᵣᵖ⁰, ᶜts⁰, ᶜu⁰) =
788790
p.precomputed
791+
(; ᶜwₗʲs, ᶜwᵢʲs, ᶜwᵣʲs, ᶜwₛʲs, ᶜwₙₗʲs, ᶜwₙᵣʲs, ᶜwₜʲs, ᶜwₕʲs) = p.precomputed
789792

790793
ᶜSᵖ = p.scratch.ᶜtemp_scalar
791794
ᶜS₂ᵖ = p.scratch.ᶜtemp_scalar_2
@@ -801,7 +804,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
801804
seasalt_mean_radius,
802805
sulfate_num,
803806
p.tracers.prescribed_aerosols_field,
804-
cmp.aerosol,
807+
cm2p.aerosol,
805808
)
806809
else
807810
@. seasalt_num = 0
@@ -811,7 +814,95 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
811814

812815
# Compute sources
813816
n = n_mass_flux_subdomains(p.atmos.turbconv_model)
817+
FT = eltype(params)
814818
for j in 1:n
819+
820+
# compute terminal velocity for precipitation
821+
# TODO sedimentation of snow is based on the 1M scheme
822+
@. ᶜwₙᵣʲs.:($$j) = getindex(
823+
CM2.rain_terminal_velocity(
824+
cm2p.sb,
825+
cm2p.rtv,
826+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_rai),
827+
ᶜρʲs.:($$j),
828+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).n_rai),
829+
),
830+
1,
831+
)
832+
@. ᶜwᵣʲs.:($$j) = getindex(
833+
CM2.rain_terminal_velocity(
834+
cm2p.sb,
835+
cm2p.rtv,
836+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_rai),
837+
ᶜρʲs.:($$j),
838+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).n_rai),
839+
),
840+
2,
841+
)
842+
@. ᶜwₛʲs.:($$j) = CM1.terminal_velocity(
843+
cm1p.ps,
844+
cm1p.tv.snow,
845+
ᶜρʲs.:($$j),
846+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_sno),
847+
)
848+
# compute sedimentation velocity for cloud condensate [m/s]
849+
# TODO sedimentation of ice is based on the 1M scheme
850+
@. ᶜwₙₗʲs.:($$j) = getindex(
851+
CM2.cloud_terminal_velocity(
852+
cm2p.sb.pdf_c,
853+
cm2p.ctv,
854+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_liq),
855+
ᶜρʲs.:($$j),
856+
max(zero(Y.c.ρ), ᶜρʲs.:($$j) * Y.c.sgsʲs.:($$j).n_liq),
857+
),
858+
1,
859+
)
860+
@. ᶜwₗʲs.:($$j) = getindex(
861+
CM2.cloud_terminal_velocity(
862+
cm2p.sb.pdf_c,
863+
cm2p.ctv,
864+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_liq),
865+
ᶜρʲs.:($$j),
866+
max(zero(Y.c.ρ), ᶜρʲs.:($$j) * Y.c.sgsʲs.:($$j).n_liq),
867+
),
868+
2,
869+
)
870+
@. ᶜwᵢʲs.:($$j) = CMNe.terminal_velocity(
871+
cmc.ice,
872+
cmc.Ch2022.small_ice,
873+
ᶜρʲs.:($$j),
874+
max(zero(Y.c.ρ), Y.c.sgsʲs.:($$j).q_ice),
875+
)
876+
# compute their contirbutions to energy and total water advection
877+
@. ᶜwₜʲs.:($$j) = ifelse(
878+
Y.c.sgsʲs.:($$j).ρa * Y.c.sgsʲs.:($$j).q_tot > FT(0),
879+
(
880+
ᶜwₗʲs.:($$j) * Y.c.sgsʲs.:($$j).q_liq +
881+
ᶜwᵢʲs.:($$j) * Y.c.sgsʲs.:($$j).q_ice +
882+
ᶜwᵣʲs.:($$j) * Y.c.sgsʲs.:($$j).q_rai +
883+
ᶜwₛʲs.:($$j) * Y.c.sgsʲs.:($$j).q_sno
884+
) / Y.c.sgsʲs.:($$j).q_tot,
885+
FT(0),
886+
)
887+
@. ᶜwₕʲs.:($$j) = ifelse(
888+
Y.c.sgsʲs.:($$j).ρa * abs(Y.c.sgsʲs.:($$j).mse) > FT(0),
889+
(
890+
ᶜwₗʲs.:($$j) *
891+
Y.c.sgsʲs.:($$j).q_liq *
892+
(Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
893+
ᶜwᵢʲs.:($$j) *
894+
Y.c.sgsʲs.:($$j).q_ice *
895+
(Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
896+
ᶜwᵣʲs.:($$j) *
897+
Y.c.sgsʲs.:($$j).q_rai *
898+
(Iₗ(thp, ᶜtsʲs.:($$j)) + ᶜΦ) +
899+
ᶜwₛʲs.:($$j) *
900+
Y.c.sgsʲs.:($$j).q_sno *
901+
(Iᵢ(thp, ᶜtsʲs.:($$j)) + ᶜΦ)
902+
) / abs(Y.c.sgsʲs.:($$j).mse),
903+
FT(0),
904+
)
905+
815906
# Precipitation sources and sinks from the updrafts
816907
compute_warm_precipitation_sources_2M!(
817908
ᶜSᵖ,
@@ -830,7 +921,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
830921
Y.c.sgsʲs.:($j).q_sno,
831922
ᶜtsʲs.:($j),
832923
dt,
833-
cmp,
924+
cm2p,
834925
thp,
835926
)
836927
@. ᶜSqᵢᵖʲs.:($$j) = 0
@@ -870,7 +961,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
870961
Y.c.sgsʲs.:($$j).n_liq + Y.c.sgsʲs.:($$j).n_rai,
871962
ᶜρʲs.:($$j),
872963
max(0, w_component.(Geometry.WVector.(ᶜuʲs.:($$j)))),
873-
(cmp,),
964+
(cm2p,),
874965
thp,
875966
ᶜtsʲs.:($$j),
876967
dt,
@@ -903,7 +994,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
903994
ᶜq_sno⁰,
904995
ᶜts⁰,
905996
dt,
906-
cmp,
997+
cm2p,
907998
thp,
908999
)
9091000
@. ᶜSqᵢᵖ⁰ = 0
@@ -943,7 +1034,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation
9431034
ᶜn_liq⁰ + ᶜn_rai⁰,
9441035
ᶜρ⁰,
9451036
w_component.(Geometry.WVector.(ᶜu⁰)),
946-
(cmp,),
1037+
(cm2p,),
9471038
thp,
9481039
ᶜts⁰,
9491040
dt,

src/parameters/create_parameters.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ microphys_2m_parameters(::Type{FT}) where {FT <: AbstractFloat} =
163163
microphys_2m_parameters(toml_dict::CP.AbstractTOMLDict) = (;
164164
sb = CM.Parameters.SB2006(toml_dict),
165165
aps = CM.Parameters.AirProperties(toml_dict),
166-
tv = CM.Parameters.SB2006VelType(toml_dict),
166+
ctv = CM.Parameters.StokesRegimeVelType(toml_dict),
167+
rtv = CM.Parameters.SB2006VelType(toml_dict),
167168
liquid = CM.Parameters.CloudLiquid(toml_dict),
168169
ice = CM.Parameters.CloudIce(toml_dict),
169170
arg = CM.Parameters.AerosolActivationParameters(toml_dict),

0 commit comments

Comments
 (0)