Skip to content

Commit

Permalink
Add 1/s entr/detr dim scales with total entr rate option. Change mf grad
Browse files Browse the repository at this point in the history
order.
  • Loading branch information
costachris committed Mar 15, 2024
1 parent 9d18d79 commit e6b6160
Show file tree
Hide file tree
Showing 12 changed files with 839 additions and 358 deletions.
171 changes: 91 additions & 80 deletions docs/Manifest.toml

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions driver/compute_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function io_dictionary_diagnostics()
"nondim_entrainment_ml" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).ε_ml_nondim),
"detrainment_ml" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).detr_ml),
"nondim_detrainment_ml" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).δ_ml_nondim),
"entr_rate_inv_s" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).entr_rate_inv_s),
"detr_rate_inv_s" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).detr_rate_inv_s),
"asp_ratio" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).asp_ratio),
"massflux" => (; dims = ("zc", "t"), group = "profiles", field = state -> center_diagnostics_turbconv(state).massflux),
"rain_flux" => (; dims = ("zf", "t"), group = "profiles", field = state -> face_diagnostics_precip(state).rain_flux),
Expand Down Expand Up @@ -278,6 +280,9 @@ function compute_diagnostics!(
diag_svpc.cloud_base_mean[cent] = cloud_base_gm
diag_svpc.cloud_top_mean[cent] = cloud_top_gm




#####
##### Fluxes
#####
Expand All @@ -299,15 +304,18 @@ function compute_diagnostics!(
diag_tc.δ_ml_nondim[k] = 0
diag_tc.asp_ratio[k] = 0
diag_tc.frac_turb_entr[k] = 0
diag_tc.entr_rate_inv_s[k] = 0
diag_tc.detr_rate_inv_s[k] = 0
diag_tc.Π₁[k] = 0
diag_tc.Π₂[k] = 0
diag_tc.Π₃[k] = 0
diag_tc.Π₄[k] = 0
diag_tc.Π₅[k] = 0
diag_tc.Π₆[k] = 0
if a_up_bulk_k > 0.0
if a_up_bulk_k > edmf.minimum_area * N_up
@inbounds for i in 1:N_up
aux_up_i = aux_up[i]

diag_tc.entr_sc[k] += aux_up_i.area[k] * aux_up_i.entr_sc[k] / a_up_bulk_k
diag_tc.ε_nondim[k] += aux_up_i.area[k] * aux_up_i.ε_nondim[k] / a_up_bulk_k
diag_tc.detr_sc[k] += aux_up_i.area[k] * aux_up_i.detr_sc[k] / a_up_bulk_k
Expand All @@ -319,6 +327,9 @@ function compute_diagnostics!(
diag_tc.asp_ratio[k] += aux_up_i.area[k] * aux_up_i.asp_ratio[k] / a_up_bulk_k
diag_tc.frac_turb_entr[k] += aux_up_i.area[k] * aux_up_i.frac_turb_entr[k] / a_up_bulk_k

diag_tc.entr_rate_inv_s[k] += aux_up_i.area[k] * aux_up_i.entr_rate_inv_s[k] / a_up_bulk_k
diag_tc.detr_rate_inv_s[k] += aux_up_i.area[k] * aux_up_i.detr_rate_inv_s[k] / a_up_bulk_k

for Π_i in 1:length(pi_subset)
sub_script = ""
for digit in string(pi_subset[Π_i])
Expand Down Expand Up @@ -380,8 +391,8 @@ function compute_diagnostics!(
diag_svpc.cutoff_precipitation_rate[cent] = sum(f)
end

lwp = sum(i -> sum(ρ_c .* aux_up[i].q_liq .* aux_up[i].area .* (aux_up[i].area .> 1e-3)), 1:N_up)
iwp = sum(i -> sum(ρ_c .* aux_up[i].q_ice .* aux_up[i].area .* (aux_up[i].area .> 1e-3)), 1:N_up)
lwp = sum(i -> sum(ρ_c .* aux_up[i].q_liq .* aux_up[i].area .* (aux_up[i].area .> edmf.minimum_area)), 1:N_up)
iwp = sum(i -> sum(ρ_c .* aux_up[i].q_ice .* aux_up[i].area .* (aux_up[i].area .> edmf.minimum_area)), 1:N_up)

plume_scale_height = map(1:N_up) do i
TC.compute_plume_scale_height(grid, state, edmf.H_up_min, i)
Expand Down
5 changes: 4 additions & 1 deletion driver/generate_namelist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,14 @@ function default_namelist(

namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["updraft_number"] = 1
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["entrainment"] = "moisture_deficit" # {"moisture_deficit", "None"}
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["entrainment_type"] = "fractional" # {"fractional", "total_rate"}
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["ml_entrainment"] = "None" # {"None", "NN", "NN_nonlocal", "Linear", "FNO", "RF"}
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["entr_dim_scale"] = "buoy_vel" # {"buoy_vel", "inv_scale_height", "inv_z", "none"}
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["detr_dim_scale"] = "buoy_vel" # {"buoy_vel", "inv_scale_height", "inv_z", "none"}
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["entr_pi_subset"] = ntuple(i -> i, 6) # or, e.g., (1, 3, 6)
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["pi_norm_consts"] = [10.0, 5.0, 1.0, 1.0, 1.0, 1.0] # normalization constants for Pi groups
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["pi_norm_consts"] = [100.0, 2.0, 1.0, 1.0, 1.0, 1.0] # normalization constants for Pi groups
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["entr_nondim_norm_factor"] = 1.0
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["detr_nondim_norm_factor"] = 1.0
namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["stochastic_entrainment"] = "deterministic" # {"deterministic", "noisy_relaxation_process", "lognormal_scaling", "prognostic_noisy_relaxation_process"}

namelist_defaults["turbulence"]["EDMF_PrognosticTKE"]["pressure_closure_buoy"] = "normalmode"
Expand Down
Loading

0 comments on commit e6b6160

Please sign in to comment.