Skip to content

Commit

Permalink
Make the 1M scheme more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
trontrytel committed Dec 15, 2023
1 parent 06a3da7 commit d57cd9a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .buildkite/longruns/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ steps:
slurm_mem_per_cpu: 16GB
slurm_time: 24:00:00

- label: ":computer: aquaplanet (ρe_tot) equilmoist clearsky high resolution (nz63) hightop (55km) rayleigh sponge(35e3, 10) Float32 (time-varying insolation)"
- label: ":computer: aquaplanet (ρe_tot) equilmoist 1M clearsky high resolution (nz63) hightop (55km) rayleigh sponge(35e3, 10) Float32 (time-varying insolation)"
command:
- srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml
- julia --color=yes --project=examples post_processing/remap/remap_pipeline.jl --data_dir $$JOB_NAME --out_dir $$JOB_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ z_max: 55000.0
rayleigh_sponge: true
kappa_4: 2.0e16
moist: "equil"
precip_model: "0M"
precip_model: "1M"
precip_upwinding: "first_order"
surface_setup: "DefaultMoninObukhov"
vert_diff: "true"
rad: "clearsky"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
rad: "allskywithclear"
dt_save_to_disk: "15hours"
rayleigh_sponge: true
orographic_gravity_wave: "gfdl_restart"
z_elem: 25
dt: "400secs"
surface_setup: "DefaultMoninObukhov"
t_end: "15hours"
non_orographic_gravity_wave: true
z_max: 45000.0
dz_bottom: 300.0
dt: "400secs"
t_end: "24hours"
dt_save_to_disk: "24hours"
vert_diff: "true"
idealized_insolation: false
z_max: 45000.0
moist: "equil"
precip_model: "1M"
precip_upwinding: "first_order"
rad: "allskywithclear"
idealized_insolation: false
rayleigh_sponge: true
non_orographic_gravity_wave: true
orographic_gravity_wave: "gfdl_restart"
surface_setup: "DefaultMoninObukhov"
job_id: "sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res"
moist: "equil"
toml: [toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.toml]
diagnostics:
- short_name: cl
period: 6hours
- short_name: cli
period: 6hours
- short_name: clw
period: 6hours
- short_name: husra
period: 6hours
- short_name: hussn
period: 6hours
- short_name: ta
period: 6hours
- short_name: hus
period: 6hours
- short_name: hur
period: 6hours
- short_name: mixlgm
period: 6hours
40 changes: 21 additions & 19 deletions src/parameterized_tendencies/microphysics/precipitation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
Tₐ(ts) = TD.air_temperature(thp, ts)
α(ts) = TD.Parameters.cv_l(thp) / Lf(ts) * (Tₐ(ts) - cmp.ps.T_freeze)

qₚ(ρqₚ, ρ) = max(FT(0), ρqₚ / ρ)

# zero out the source terms
@. ᶜSqₜᵖ[colidx] = FT(0)
@. ᶜSeₜᵖ[colidx] = FT(0)
Expand Down Expand Up @@ -228,7 +230,7 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
cmp.tv.rain,
cmp.ce,
qₗ(ᶜts[colidx]),
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
)
Expand All @@ -245,7 +247,7 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
cmp.tv.snow,
cmp.ce,
qᵢ(ᶜts[colidx]),
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
)
Expand All @@ -263,7 +265,7 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
cmp.tv.snow,
cmp.ce,
qₗ(ᶜts[colidx]),
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
)
Expand All @@ -275,7 +277,7 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
ᶜSᵖ[colidx],
FT(-1) * min(
ᶜSᵖ[colidx] * α(ᶜts[colidx]),
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx] / dt,
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]) / dt,
),
)
@. ᶜSqₛᵖ[colidx] += ᶜSᵖ_snow[colidx]
Expand All @@ -301,7 +303,7 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
cmp.tv.rain,
cmp.ce,
qᵢ(ᶜts[colidx]),
Y.c.ρq_rai[colidx],
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
)
Expand All @@ -310,14 +312,14 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
@. ᶜSeₜᵖ[colidx] -= ᶜSᵖ[colidx] * (Iᵢ(ᶜts[colidx]) + ᶜΦ[colidx])
# sink of rain via accretion cloud ice - rain
@. ᶜSᵖ[colidx] = min(
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx] / dt,
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]) / dt,
CM1.accretion_rain_sink(
cmp.pr,
cmp.ci,
cmp.tv.rain,
cmp.ce,
qᵢ(ᶜts[colidx]),
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
)
Expand All @@ -329,28 +331,28 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
@. ᶜSᵖ[colidx] = ifelse(
Tₐ(ᶜts[colidx]) < cmp.ps.T_freeze,
min(
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx] / dt,
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]) / dt,
CM1.accretion_snow_rain(
cmp.ps,
cmp.pr,
cmp.tv.rain,
cmp.tv.snow,
cmp.ce,
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx],
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]),
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
),
-min(
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx] / dt,
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]) / dt,
CM1.accretion_snow_rain(
cmp.pr,
cmp.ps,
cmp.tv.snow,
cmp.tv.rain,
cmp.ce,
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx],
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]),
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
),
),
Expand All @@ -362,14 +364,14 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
# evaporation: q_rai -> q_vap
@. ᶜSᵖ[colidx] =
-min(
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx] / dt,
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]) / dt,
-CM1.evaporation_sublimation(
cmp.pr,
cmp.tv.rain,
cmp.aps,
thp,
TD.PhasePartition(thp, ᶜts[colidx]),
Y.c.ρq_rai[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_rai[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
Tₐ(ᶜts[colidx]),
),
Expand All @@ -380,13 +382,13 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)

# melting: q_sno -> q_rai
@. ᶜSᵖ[colidx] = min(
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx] / dt,
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]) / dt,
CM1.snow_melt(
cmp.ps,
cmp.tv.snow,
cmp.aps,
thp,
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
Tₐ(ᶜts[colidx]),
),
Expand All @@ -402,14 +404,14 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _)
cmp.aps,
thp,
TD.PhasePartition(thp, ᶜts[colidx]),
Y.c.ρq_sno[colidx] / Y.c.ρ[colidx],
qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]),
Y.c.ρ[colidx],
Tₐ(ᶜts[colidx]),
)
@. ᶜSᵖ[colidx] = ifelse(
ᶜSᵖ[colidx] > FT(0),
min(qᵥ(ᶜts[colidx]) / dt, ᶜSᵖ[colidx]),
-min(Y.c.ρq_sno[colidx] / Y.c.ρ[colidx] / dt, FT(-1) * ᶜSᵖ[colidx]),
-min(qₚ(Y.c.ρq_sno[colidx], Y.c.ρ[colidx]) / dt, FT(-1) * ᶜSᵖ[colidx]),
)
@. ᶜSqₜᵖ[colidx] -= ᶜSᵖ[colidx]
@. ᶜSqₛᵖ[colidx] += ᶜSᵖ[colidx]
Expand Down

0 comments on commit d57cd9a

Please sign in to comment.