Skip to content

Commit

Permalink
trying out relaxation tendency
Browse files Browse the repository at this point in the history
  • Loading branch information
trontrytel committed Sep 27, 2023
1 parent 0473937 commit de3d4a1
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 29 deletions.
5 changes: 3 additions & 2 deletions config/model_configs/edmfx_gabls_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ x_elem: 2
y_elem: 2
z_elem: 8
z_stretch: false
dt: "10secs"
dt: "4secs"
t_end: "9hours"
dt_save_to_disk: "10mins"
perturb_initstate: false
FLOAT_TYPE: "Float64"
toml: [toml/edmfx_box_gabls.toml]
toml: [toml/edmfx_box.toml]
#toml: [toml/edmfx_box_gabls.toml]
2 changes: 1 addition & 1 deletion src/ClimaAtmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ include(joinpath("utils", "discrete_hydrostatic_balance.jl"))

include(joinpath("prognostic_equations", "pressure_work.jl"))
include(joinpath("prognostic_equations", "zero_velocity.jl"))
include(joinpath("prognostic_equations", "filter_sgs_u3_tendency.jl"))
include(joinpath("prognostic_equations", "helper_sgs_tendencies.jl"))

include(joinpath("prognostic_equations", "implicit", "wfact.jl"))
include(joinpath("prognostic_equations", "implicit", "schur_complement_W.jl"))
Expand Down
19 changes: 0 additions & 19 deletions src/prognostic_equations/filter_sgs_u3_tendency.jl

This file was deleted.

22 changes: 22 additions & 0 deletions src/prognostic_equations/helper_sgs_tendencies.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
###
### sgs u3 relaxation for a < a_min
###
function relax_sgs_u3_if_small_area!(Yₜ, Y, p, t, colidx)
if p.atmos.turbconv_model isa EDMFX
FT = eltype(Y)
n = n_mass_flux_subdomains(p.atmos.turbconv_model)
a_min = p.atmos.turbconv_model.a_half
dt = p.simulation.dt
for j in 1:n
@. Yₜ.f.sgsʲs.:($$j).u₃[colidx] += ifelse(
draft_area(
ᶠinterp(Y.c.sgsʲs.:($$j).ρa[colidx]),
ᶠinterp(p.ᶜρʲs.:($$j)[colidx])
) <= a_min,
(Yₜ.f.u₃[colidx] - Yₜ.f.sgsʲs.:($$j).u₃[colidx]) / dt,
FT(0) * Yₜ.f.sgsʲs.:($$j).u₃[colidx]
)
end
end
return nothing
end
11 changes: 5 additions & 6 deletions src/prognostic_equations/remaining_tendency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ NVTX.@annotate function additional_tendency!(Yₜ, Y, p, t)
# NOTE: All ρa tendencies should be applied before calling this function
pressure_work_tendency!(Yₜ, Y, p, t, colidx, p.atmos.turbconv_model)

# NOTE: This will set the sgs momentum tendency to the grid mean momentum tendency
# if the updraft area fraction is equal or smaller than zero.
# NOTE: This adds an additional sgs momentum tendency
# that is a relaxation term to the grid mean momentum
# if updraft area fraction is smaller than a_min
# We should not need this, but right now we are diverging slightly
# (maybe starting from diverging densities?)
# TODO - A better way to implement this would be to
# make sgs_e_int = gm_e_int when a == 0 and then recompute sgs_e_tot
# based on w and the new sgs_e_int
filter_sgs_u3_tendency!(Yₜ, Y, p, t, colidx)
# and the differences grow even when we increase the entrainment.
relax_sgs_u3_if_small_area!(Yₜ, Y, p, t, colidx)

# NOTE: This will zero out all monmentum tendencies in the edmfx advection test
# please DO NOT add additional velocity tendencies after this function
Expand Down
14 changes: 13 additions & 1 deletion toml/edmfx_box_gabls.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ alias = "C_E"
value = 0.044
type = "float"

[entr_coeff]
alias = "entr_coeff"
value = 0.1
type = "float"
description = "TODO: Remove this. Constant entrainment coefficient used for testing EDMF"

[detr_coeff]
alias = "detr_coeff"
value = 0.05
type = "float"
description = "TODO: Remove this. Constant entrainment coefficient used for testing EDMF"

[EDMF_surface_area]
alias = "surface_area"
value = 0.1
value = 1e-1
type = "float"

[EDMF_min_area]
Expand Down

0 comments on commit de3d4a1

Please sign in to comment.