Skip to content

Commit

Permalink
Wip on adding prescribed cloud droplet number concentration
Browse files Browse the repository at this point in the history
  • Loading branch information
trontrytel committed Jul 5, 2024
1 parent fd2fcf2 commit bea03d8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ apply_limiter:
precip_model:
help: "Precipitation model [`nothing` (default), `0M`]"
value: ~
prescribed_Nd:
help: "Prescribed number concentration of cloud droplets per cubic meter of air. If set to zero the scheme uses 1-moment autoconversion rate that does not depend on Nd [`nothing` (default), any positive number]"
value: ~
cloud_model:
help: "Cloud model [`grid_scale`, `quadrature` (default), `diagnostic_edmfx`]"
value: "quadrature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,25 @@ function e_tot_0M_precipitation_sources_helper(
return λ * Iₗ(thp, ts) + (1 - λ) * Iᵢ(thp, ts) + Φ
end

"""
rain_autoconversion_helper(mp, thp, ts, ρ)
- mp - 1-moment microphysics parameters
- thermodynamics parameters
- thermodynamic state
- air density
Returns rain autoconversion rate based on the 1-moment microphysics scheme
or on the 2-moment microphysics scheme with prescribed number concentration
of cloud droplets.
"""
function rain_autoconversion_helper(mp, thp, ts, ρ)
return
isnothing(mp.Ndp) ?
CM1.conv_q_liq_to_q_rai(mp.pr.acnv1M, qₗ(thp, ts), true) :
CM2.conv_q_liq_to_q_rai(mp.vrt, qₗ(thp, ts), ρ, mp.Ndp)
end

"""
compute_precipitation_sources!(Sᵖ, Sᵖ_snow, Sqₜᵖ, Sqᵣᵖ, Sqₛᵖ, Seₜᵖ, ρ, qᵣ, qₛ, ts, Φ, dt, mp, thp)
Expand Down Expand Up @@ -174,7 +193,7 @@ function compute_precipitation_sources!(
# rain autoconversion: q_liq -> q_rain
@. Sᵖ = min(
limit(qₗ(thp, ts), dt, 5),
CM1.conv_q_liq_to_q_rai(mp.pr.acnv1M, qₗ(thp, ts), true),
rain_autoconversion_helper(mp, thp, ts, ρ)
)
@. Sqₜᵖ -= Sᵖ
@. Sqᵣᵖ += Sᵖ
Expand Down
3 changes: 3 additions & 0 deletions src/parameters/create_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function create_parameter_set(config::AtmosConfig)
FT(CA.time_to_seconds(parsed_args["dt"]))
end
precip_model = parsed_args["precip_model"]
prescribed_Nd = parsed_args["prescribed_Nd"]
microphysics_precipitation_params =
if precip_model == nothing || precip_model == "nothing"
nothing
Expand All @@ -96,6 +97,8 @@ function create_parameter_set(config::AtmosConfig)
ce = CM.Parameters.CollisionEff(toml_dict),
tv = CM.Parameters.Blk1MVelType(toml_dict),
aps = CM.Parameters.AirProperties(toml_dict),
var = CM.Parameters.VarTimescaleAcnv(toml_dict),
Ndp = prescribed_Nd == 0 ? nothing : FT(prescribed_Nd),
)
else
error("Invalid precip_model $(precip_model)")
Expand Down

0 comments on commit bea03d8

Please sign in to comment.