From b7fbfd4c9c1a136efabee95296e713ae79fa2557 Mon Sep 17 00:00:00 2001 From: Anna Jaruga Date: Mon, 8 Apr 2024 09:41:58 -0700 Subject: [PATCH] Add 1M microphysics to diagnostic edmf --- .buildkite/pipeline.yml | 14 +- .../gpu_diagnostic_edmfx_aquaplanet.yml | 20 +- .../diagnostic_edmfx_aquaplanet.yml | 16 +- .../diagnostic_edmfx_rico_box.yml | 10 +- .../diagnostic_edmfx_trmm_box.yml | 8 +- .../diagnostic_edmfx_trmm_box_0M.yml | 39 ++++ .../diagnostic_edmfx_trmm_stretched_box.yml | 4 +- post_processing/ci_plots.jl | 7 +- .../diagnostic_edmf_precomputed_quantities.jl | 191 +++++++++++++++--- src/cache/precomputed_quantities.jl | 8 +- .../microphysics/precipitation.jl | 42 +++- toml/diagnostic_edmfx_trmm_box.toml | 3 - toml/diagnostic_edmfx_trmm_box_0M.toml | 23 +++ 13 files changed, 315 insertions(+), 70 deletions(-) create mode 100644 config/model_configs/diagnostic_edmfx_trmm_box_0M.yml create mode 100644 toml/diagnostic_edmfx_trmm_box_0M.toml diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 29ac02e5f6c..fa5fb416787 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -501,7 +501,7 @@ steps: agents: slurm_mem: 20GB - - label: ":genie: Diagnostic EDMFX Rico in a box" + - label: ":umbrella: Diagnostic EDMFX Rico in a box" command: > julia --color=yes --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/diagnostic_edmfx_rico_box.yml @@ -509,7 +509,7 @@ steps: agents: slurm_mem: 20GB - - label: ":genie: Diagnostic EDMFX TRMM in a box" + - label: ":umbrella: Diagnostic EDMFX TRMM in a box" command: > julia --color=yes --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/diagnostic_edmfx_trmm_box.yml @@ -517,7 +517,7 @@ steps: agents: slurm_mem: 20GB - - label: ":genie: Diagnostic EDMFX TRMM stretched grid in a box" + - label: ":umbrella: Diagnostic EDMFX TRMM stretched grid in a box" command: > julia --color=yes --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/diagnostic_edmfx_trmm_stretched_box.yml @@ -525,6 +525,14 @@ steps: agents: slurm_mem: 20GB + - label: ":genie: Diagnostic EDMFX TRMM 0M in a box" + command: > + julia --color=yes --project=examples examples/hybrid/driver.jl + --config_file $CONFIG_PATH/diagnostic_edmfx_trmm_box_0M.yml + artifact_paths: "diagnostic_edmfx_trmm_box_0M/output_active/*" + agents: + slurm_mem: 20GB + - label: ":genie: Diagnostic EDMFX aquaplanet with TKE" command: > julia --color=yes --project=examples examples/hybrid/driver.jl diff --git a/config/gpu_configs/gpu_diagnostic_edmfx_aquaplanet.yml b/config/gpu_configs/gpu_diagnostic_edmfx_aquaplanet.yml index dd6d3491cd5..18a74fca623 100644 --- a/config/gpu_configs/gpu_diagnostic_edmfx_aquaplanet.yml +++ b/config/gpu_configs/gpu_diagnostic_edmfx_aquaplanet.yml @@ -1,20 +1,20 @@ dt_save_state_to_disk: "3hours" dt_save_to_sol: "Inf" job_id: gpu_diagnostic_edmfx_aquaplanet -surface_setup: DefaultMoninObukhov +surface_setup: DefaultMoninObukhov rad: clearsky -turbconv: diagnostic_edmfx +turbconv: diagnostic_edmfx implicit_diffusion: true approximate_linear_solve_iters: 2 prognostic_tke: true -edmfx_upwinding: first_order -edmfx_entr_model: "Generalized" -edmfx_detr_model: "Generalized" -edmfx_nh_pressure: true +edmfx_upwinding: first_order +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" +edmfx_nh_pressure: true edmfx_sgs_mass_flux: true edmfx_sgs_diffusive_flux: true -moist: equil -precip_model: 0M -dt: 100secs -t_end: 6hours +moist: equil +precip_model: 1M +dt: 100secs +t_end: 6hours toml: [toml/diagnostic_edmfx_box.toml] diff --git a/config/model_configs/diagnostic_edmfx_aquaplanet.yml b/config/model_configs/diagnostic_edmfx_aquaplanet.yml index af7ae8644d2..6172b0c9be2 100644 --- a/config/model_configs/diagnostic_edmfx_aquaplanet.yml +++ b/config/model_configs/diagnostic_edmfx_aquaplanet.yml @@ -1,21 +1,21 @@ job_id: diagnostic_edmfx_aquaplanet surface_setup: DefaultMoninObukhov rad: clearsky -turbconv: diagnostic_edmfx +turbconv: diagnostic_edmfx implicit_diffusion: true approximate_linear_solve_iters: 2 prognostic_tke: true -edmfx_upwinding: first_order -edmfx_entr_model: "Generalized" -edmfx_detr_model: "Generalized" -edmfx_nh_pressure: true +edmfx_upwinding: first_order +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" +edmfx_nh_pressure: true edmfx_sgs_mass_flux: true edmfx_sgs_diffusive_flux: true -moist: equil +moist: equil precip_model: 0M override_τ_precip: false -dt: 100secs -t_end: 12hours +dt: 100secs +t_end: 12hours dt_save_state_to_disk: 12hours regression_test: true toml: [toml/diagnostic_edmfx_trmm_box.toml] diff --git a/config/model_configs/diagnostic_edmfx_rico_box.yml b/config/model_configs/diagnostic_edmfx_rico_box.yml index 18116a921be..8d5dd0d75cf 100644 --- a/config/model_configs/diagnostic_edmfx_rico_box.yml +++ b/config/model_configs/diagnostic_edmfx_rico_box.yml @@ -8,13 +8,15 @@ implicit_diffusion: true approximate_linear_solve_iters: 2 prognostic_tke: true edmfx_upwinding: first_order -edmfx_entr_model: "Generalized" -edmfx_detr_model: "Generalized" +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" edmfx_nh_pressure: true edmfx_sgs_mass_flux: true edmfx_sgs_diffusive_flux: true moist: equil -precip_model: "0M" +apply_limiter: false +precip_model: "1M" +override_τ_precip: false config: box hyperdiff: "true" x_max: 1e8 @@ -35,3 +37,5 @@ diagnostics: period: 10mins - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix] period: 10mins + - short_name: [husra, hussn] + period: 10mins diff --git a/config/model_configs/diagnostic_edmfx_trmm_box.yml b/config/model_configs/diagnostic_edmfx_trmm_box.yml index ddd7b3c3cf9..ba163dc051f 100644 --- a/config/model_configs/diagnostic_edmfx_trmm_box.yml +++ b/config/model_configs/diagnostic_edmfx_trmm_box.yml @@ -7,14 +7,14 @@ implicit_diffusion: true approximate_linear_solve_iters: 2 prognostic_tke: true edmfx_upwinding: first_order -edmfx_entr_model: "Generalized" -edmfx_detr_model: "Generalized" +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" edmfx_nh_pressure: true edmfx_sgs_mass_flux: true edmfx_sgs_diffusive_flux: true moist: equil apply_limiter: false -precip_model: "0M" +precip_model: "1M" override_τ_precip: false config: box hyperdiff: "true" @@ -37,3 +37,5 @@ diagnostics: period: 10mins - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix] period: 10mins + - short_name: [husra, hussn] + period: 10mins diff --git a/config/model_configs/diagnostic_edmfx_trmm_box_0M.yml b/config/model_configs/diagnostic_edmfx_trmm_box_0M.yml new file mode 100644 index 00000000000..ef2cf177bd6 --- /dev/null +++ b/config/model_configs/diagnostic_edmfx_trmm_box_0M.yml @@ -0,0 +1,39 @@ +job_id: diagnostic_edmfx_trmm_box_0M +initial_condition: TRMM_LBA +rad: TRMM_LBA +surface_setup: TRMM_LBA +turbconv: diagnostic_edmfx +implicit_diffusion: true +approximate_linear_solve_iters: 2 +prognostic_tke: true +edmfx_upwinding: first_order +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" +edmfx_nh_pressure: true +edmfx_sgs_mass_flux: true +edmfx_sgs_diffusive_flux: true +moist: equil +apply_limiter: false +precip_model: "0M" +override_τ_precip: false +config: box +hyperdiff: "true" +x_max: 1e8 +y_max: 1e8 +x_elem: 2 +y_elem: 2 +z_elem: 82 +z_max: 16400 +z_stretch: false +dt: 200secs +t_end: 6hours +dt_save_state_to_disk: 10mins +FLOAT_TYPE: "Float64" +toml: [toml/diagnostic_edmfx_trmm_box_0M.toml] +netcdf_output_at_levels: true +netcdf_interpolation_num_points: [8, 8, 82] +diagnostics: + - short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl] + period: 10mins + - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix] + period: 10mins diff --git a/config/model_configs/diagnostic_edmfx_trmm_stretched_box.yml b/config/model_configs/diagnostic_edmfx_trmm_stretched_box.yml index d748638db84..e17f53bdf16 100644 --- a/config/model_configs/diagnostic_edmfx_trmm_stretched_box.yml +++ b/config/model_configs/diagnostic_edmfx_trmm_stretched_box.yml @@ -15,7 +15,7 @@ edmfx_sgs_mass_flux: true edmfx_sgs_diffusive_flux: true moist: equil apply_limiter: false -precip_model: "0M" +precip_model: "1M" override_τ_precip: false config: box hyperdiff: "true" @@ -39,3 +39,5 @@ diagnostics: period: 10mins - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, tke, lmix] period: 10mins + - short_name: [husra, hussn] + period: 10mins diff --git a/post_processing/ci_plots.jl b/post_processing/ci_plots.jl index 2e03d5f0f17..276141ae965 100644 --- a/post_processing/ci_plots.jl +++ b/post_processing/ci_plots.jl @@ -937,9 +937,7 @@ EDMFBoxPlots = Union{ Val{:diagnostic_edmfx_bomex_box}, Val{:diagnostic_edmfx_bomex_stretched_box}, Val{:diagnostic_edmfx_dycoms_rf01_box}, - Val{:diagnostic_edmfx_rico_box}, - Val{:diagnostic_edmfx_trmm_box}, - Val{:diagnostic_edmfx_trmm_stretched_box}, + Val{:diagnostic_edmfx_trmm_box_0M}, Val{:diagnostic_edmfx_dycoms_rf01_explicit_box}, Val{:prognostic_edmfx_adv_test_column}, Val{:prognostic_edmfx_gabls_column}, @@ -956,6 +954,9 @@ EDMFBoxPlots = Union{ EDMFBoxPlotsWithPrecip = Union{ Val{:prognostic_edmfx_rico_column}, Val{:prognostic_edmfx_trmm_column}, + Val{:diagnostic_edmfx_rico_box}, + Val{:diagnostic_edmfx_trmm_box}, + Val{:diagnostic_edmfx_trmm_stretched_box}, } diff --git a/src/cache/diagnostic_edmf_precomputed_quantities.jl b/src/cache/diagnostic_edmf_precomputed_quantities.jl index f64bb0d65af..e4aed64e3de 100644 --- a/src/cache/diagnostic_edmf_precomputed_quantities.jl +++ b/src/cache/diagnostic_edmf_precomputed_quantities.jl @@ -242,6 +242,11 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( ) = p.precomputed (; ᶠu³⁰, ᶜK⁰, ᶜtke⁰) = p.precomputed + if precip_model isa Microphysics1Moment + q_rai = p.precomputed.ᶜqᵣ + q_sno = p.precomputed.ᶜqₛ + end + thermo_params = CAP.thermodynamics_params(params) microphys_params = CAP.microphysics_precipitation_params(params) @@ -294,6 +299,11 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( z_prev_level = Fields.field_values(Fields.level(ᶜz, i - 1)) dz_prev_level = Fields.field_values(Fields.level(ᶜdz, i - 1)) + if precip_model isa Microphysics1Moment + q_rai_prev_level = Fields.field_values(Fields.level(q_rai, i - 1)) + q_sno_prev_level = Fields.field_values(Fields.level(q_sno, i - 1)) + end + local_geometry_prev_level = Fields.field_values( Fields.level(Fields.local_geometry_field(Y.c), i - 1), ) @@ -311,9 +321,17 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( ᶜentrʲ = ᶜentrʲs.:($j) ᶜdetrʲ = ᶜdetrʲs.:($j) ᶠnh_pressure³ʲ = ᶠnh_pressure³ʲs.:($j) - ᶜS_q_totʲ = - precip_model isa Microphysics0Moment ? - p.precomputed.ᶜSqₜᵖʲs.:($j) : p.scratch.ᶜtemp_scalar + + if precip_model isa Union{Microphysics0Moment, Microphysics1Moment} + ᶜS_q_totʲ = p.precomputed.ᶜSqₜᵖʲs.:($j) + end + if precip_model isa Microphysics1Moment + ᶜS_q_raiʲ = p.precomputed.ᶜSqᵣᵖʲs.:($j) + ᶜS_q_snoʲ = p.precomputed.ᶜSqₛᵖʲs.:($j) + ᶜS_e_totʲ = p.precomputed.ᶜSeₜᵖʲs.:($j) + ᶜSᵖ = p.scratch.ᶜtemp_scalar + ᶜSᵖ_snow = p.scratch.ᶜtemp_scalar_2 + end ρaʲ_level = Fields.field_values(Fields.level(ᶜρaʲ, i)) u³ʲ_halflevel = Fields.field_values(Fields.level(ᶠu³ʲ, i - half)) @@ -338,9 +356,25 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( Fields.field_values(Fields.level(ᶠnh_pressure³ʲ, i - 1 - half)) scale_height = CAP.R_d(params) * CAP.T_surf_ref(params) / CAP.grav(params) - S_q_totʲ_prev_level = - Fields.field_values(Fields.level(ᶜS_q_totʲ, i - 1)) + + if precip_model isa Union{Microphysics0Moment, Microphysics1Moment} + S_q_totʲ_prev_level = + Fields.field_values(Fields.level(ᶜS_q_totʲ, i - 1)) + end + if precip_model isa Microphysics1Moment + S_q_raiʲ_prev_level = + Fields.field_values(Fields.level(ᶜS_q_raiʲ, i - 1)) + S_q_snoʲ_prev_level = + Fields.field_values(Fields.level(ᶜS_q_snoʲ, i - 1)) + S_e_totʲ_prev_level = + Fields.field_values(Fields.level(ᶜS_e_totʲ, i - 1)) + Sᵖ_prev_level = Fields.field_values(Fields.level(ᶜSᵖ, i - 1)) + S_snow_prev_level = + Fields.field_values(Fields.level(ᶜSᵖ_snow, i - 1)) + end + tke_prev_level = Fields.field_values(Fields.level(ᶜtke⁰, i - 1)) + @. entrʲ_prev_level = entrainment( params, z_prev_level, @@ -401,14 +435,33 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( # Updraft q_tot sources from precipitation formation # To be applied in updraft continuity, moisture and energy # for updrafts and grid mean - @. S_q_totʲ_prev_level = q_tot_precipitation_sources( - precip_model, - thermo_params, - microphys_params, - dt, - q_totʲ_prev_level, - tsʲ_prev_level, - ) + if precip_model isa Microphysics0Moment + @. S_q_totʲ_prev_level = q_tot_precipitation_sources( + precip_model, + thermo_params, + microphys_params, + dt, + q_totʲ_prev_level, + tsʲ_prev_level, + ) + elseif precip_model isa Microphysics1Moment + compute_precipitation_sources!( + Sᵖ_prev_level, + S_snow_prev_level, + S_q_totʲ_prev_level, + S_q_raiʲ_prev_level, + S_q_snoʲ_prev_level, + S_e_totʲ_prev_level, + ρʲ_prev_level, + q_rai_prev_level, + q_sno_prev_level, + tsʲ_prev_level, + Φ_prev_level, + dt, + microphys_params, + thermo_params, + ) + end u³ʲ_datau³ʲ_data = p.scratch.temp_data_level # Using constant exponents in broadcasts allocate, so we use @@ -539,8 +592,16 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( (1 / local_geometry_halflevel.J) * ( local_geometry_prev_level.J * ρaʲ_prev_level * - (entrʲ_prev_level - detrʲ_prev_level + S_q_totʲ_prev_level) + (entrʲ_prev_level - detrʲ_prev_level) ) + if precip_model isa Union{Microphysics0Moment, Microphysics1Moment} + @. ρaʲu³ʲ_data += + (1 / local_geometry_halflevel.J) * ( + local_geometry_prev_level.J * + ρaʲ_prev_level * + S_q_totʲ_prev_level + ) + end @. u³ʲ_halflevel = ifelse( ( @@ -578,15 +639,32 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( ρaʲ_prev_level * ( entrʲ_prev_level * (h_tot_prev_level - K_prev_level) - - detrʲ_prev_level * mseʲ_prev_level + - S_q_totʲ_prev_level * - e_tot_0M_precipitation_sources_helper( - thermo_params, - tsʲ_prev_level, - Φ_prev_level, - ) + detrʲ_prev_level * mseʲ_prev_level ) ) + if precip_model isa Microphysics0Moment + @. ρaʲu³ʲ_datamse += + (1 / local_geometry_halflevel.J) * ( + local_geometry_prev_level.J * + ρaʲ_prev_level * + ( + S_q_totʲ_prev_level * + e_tot_0M_precipitation_sources_helper( + thermo_params, + tsʲ_prev_level, + Φ_prev_level, + ) + ) + ) + elseif precip_model isa Microphysics1Moment + @. ρaʲu³ʲ_datamse += + (1 / local_geometry_halflevel.J) * ( + local_geometry_prev_level.J * + ρaʲ_prev_level * + S_e_totʲ_prev_level + ) + end + @. mseʲ_level = ifelse( ( (u³ʲ_datau³ʲ_data < 10 * ∇Φ³_data_prev_level * eps(FT)) | (ρaʲu³ʲ_data < (minimum_value / ∂x³∂ξ³_level)) @@ -608,10 +686,18 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!( ρaʲ_prev_level * ( entrʲ_prev_level * q_tot_prev_level - - detrʲ_prev_level * q_totʲ_prev_level + - S_q_totʲ_prev_level + detrʲ_prev_level * q_totʲ_prev_level ) ) + if precip_model isa Union{Microphysics0Moment, Microphysics1Moment} + @. ρaʲu³ʲ_dataq_tot += + (1 / local_geometry_halflevel.J) * ( + local_geometry_prev_level.J * + ρaʲ_prev_level * + S_q_totʲ_prev_level + ) + end + @. q_totʲ_level = ifelse( ( (u³ʲ_datau³ʲ_data < 10 * ∇Φ³_data_prev_level * eps(FT)) | (ρaʲu³ʲ_data < (minimum_value / ∂x³∂ξ³_level)) @@ -706,6 +792,7 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_top_bc!( n = n_mass_flux_subdomains(p.atmos.turbconv_model) (; ᶜentrʲs, ᶜdetrʲs) = p.precomputed (; ᶠu³⁰, ᶠu³ʲs, ᶜuʲs, ᶠnh_pressure³ʲs) = p.precomputed + (; precip_model) = p.atmos # set values for the top level i_top = Spaces.nlevels(axes(Y.c)) @@ -734,11 +821,22 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_top_bc!( fill!(detrʲ_level, RecursiveApply.rzero(eltype(detrʲ_level))) @. ᶜuʲ = C123(Y.c.uₕ) + ᶜinterp(C123(ᶠu³ʲ)) - ᶜS_q_totʲ = - p.atmos.precip_model isa Microphysics0Moment ? - p.precomputed.ᶜSqₜᵖʲs.:($j) : p.scratch.ᶜtemp_scalar - S_q_totʲ_level = Fields.field_values(Fields.level(ᶜS_q_totʲ, i_top)) - @. S_q_totʲ_level = 0 + if precip_model isa Union{Microphysics0Moment, Microphysics1Moment} + ᶜS_q_totʲ = p.precomputed.ᶜSqₜᵖʲs.:($j) + S_q_totʲ_level = Fields.field_values(Fields.level(ᶜS_q_totʲ, i_top)) + @. S_q_totʲ_level = 0 + end + if precip_model isa Microphysics1Moment + ᶜS_q_raiʲ = p.precomputed.ᶜSqᵣᵖʲs.:($j) + ᶜS_q_snoʲ = p.precomputed.ᶜSqₛᵖʲs.:($j) + ᶜS_e_totʲ = p.precomputed.ᶜSeₜᵖʲs.:($j) + S_q_raiʲ_level = Fields.field_values(Fields.level(ᶜS_q_raiʲ, i_top)) + S_q_snoʲ_level = Fields.field_values(Fields.level(ᶜS_q_snoʲ, i_top)) + S_e_totʲ_level = Fields.field_values(Fields.level(ᶜS_e_totʲ, i_top)) + @. S_q_raiʲ_level = 0 + @. S_q_snoʲ_level = 0 + @. S_e_totʲ_level = 0 + end end return nothing end @@ -890,3 +988,40 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_precipita ) return nothing end +NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_precipitation!( + Y, + p, + t, + precip_model::Microphysics1Moment, +) + thermo_params = CAP.thermodynamics_params(p.params) + microphys_params = CAP.microphysics_precipitation_params(p.params) + + (; ᶜts, ᶜSqₜᵖ⁰, ᶜSeₜᵖ⁰, ᶜSqᵣᵖ⁰, ᶜSqₛᵖ⁰) = p.precomputed + (; q_tot) = p.precomputed.ᶜspecific + (; ᶜqᵣ, ᶜqₛ) = p.precomputed + + ᶜSᵖ = p.scratch.ᶜtemp_scalar + ᶜSᵖ_snow = p.scratch.ᶜtemp_scalar_2 + + Fields.bycolumn(axes(Y.c.ρ)) do colidx + # Environment precipitation sources (to be applied to grid mean) + compute_precipitation_sources!( + ᶜSᵖ[colidx], + ᶜSᵖ_snow[colidx], + ᶜSqₜᵖ⁰[colidx], + ᶜSqᵣᵖ⁰[colidx], + ᶜSqₛᵖ⁰[colidx], + ᶜSeₜᵖ⁰[colidx], + Y.c.ρ[colidx], + ᶜqᵣ[colidx], + ᶜqₛ[colidx], + ᶜts[colidx], + p.core.ᶜΦ[colidx], + p.dt, + microphys_params, + thermo_params, + ) + end + return nothing +end diff --git a/src/cache/precomputed_quantities.jl b/src/cache/precomputed_quantities.jl index 33761466828..f8b398a6306 100644 --- a/src/cache/precomputed_quantities.jl +++ b/src/cache/precomputed_quantities.jl @@ -497,6 +497,10 @@ NVTX.@annotate function set_precomputed_quantities!(Y, p, t) # compute_gm_mixing_length!(ᶜmixing_length, Y, p) # end + if precip_model isa Microphysics1Moment + set_precipitation_precomputed_quantities!(Y, p, t) + end + if turbconv_model isa PrognosticEDMFX set_prognostic_edmf_precomputed_quantities_draft_and_bc!(Y, p, ᶠuₕ³, t) set_prognostic_edmf_precomputed_quantities_environment!(Y, p, ᶠuₕ³, t) @@ -616,10 +620,6 @@ NVTX.@annotate function set_precomputed_quantities!(Y, p, t) ) end - if precip_model isa Microphysics1Moment - set_precipitation_precomputed_quantities!(Y, p, t) - end - # TODO if call_cloud_diagnostics_per_stage isa CallCloudDiagnosticsPerStage set_cloud_fraction!(Y, p, moisture_model, cloud_model) diff --git a/src/parameterized_tendencies/microphysics/precipitation.jl b/src/parameterized_tendencies/microphysics/precipitation.jl index 9abadeb21a5..24444000ab1 100644 --- a/src/parameterized_tendencies/microphysics/precipitation.jl +++ b/src/parameterized_tendencies/microphysics/precipitation.jl @@ -63,7 +63,6 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics0Moment, _) ᶜΦ[colidx], ) end - function compute_precipitation_cache!( Y, p, @@ -103,7 +102,6 @@ function compute_precipitation_cache!( ) end end - function compute_precipitation_cache!( Y, p, @@ -254,13 +252,12 @@ function compute_precipitation_cache!(Y, p, colidx, ::Microphysics1Moment, _) thp, ) end - function compute_precipitation_cache!( Y, p, colidx, ::Microphysics1Moment, - ::PrognosticEDMFX, + ::Union{DiagnosticEDMFX, PrognosticEDMFX}, ) FT = Spaces.undertype(axes(Y.c)) (; dt) = p @@ -323,7 +320,44 @@ function precipitation_tendency!( return nothing end +function precipitation_tendency!( + Yₜ, + Y, + p, + t, + colidx, + precip_model::Microphysics1Moment, + turbconv_model::DiagnosticEDMFX, +) + # Source terms from EDMFX environment + (; ᶜSeₜᵖ⁰, ᶜSqₜᵖ⁰, ᶜSqᵣᵖ⁰, ᶜSqₛᵖ⁰) = p.precomputed + # Source terms from EDMFX updrafts + (; ᶜSeₜᵖʲs, ᶜSqₜᵖʲs, ᶜSqᵣᵖʲs, ᶜSqₛᵖʲs) = p.precomputed + # Grid mean precipitation sinks + (; ᶜSqₜᵖ, ᶜSqᵣᵖ, ᶜSqₛᵖ, ᶜSeₜᵖ) = p.precipitation + + (; ᶜρaʲs) = p.precomputed + + compute_precipitation_cache!(Y, p, colidx, precip_model, turbconv_model) + + # Update from environment precipitation sources + # and the grid mean precipitation sinks + @. Yₜ.c.ρ[colidx] += Y.c.ρ[colidx] * (ᶜSqₜᵖ⁰[colidx] + ᶜSqₜᵖ[colidx]) + @. Yₜ.c.ρq_tot[colidx] += Y.c.ρ[colidx] * (ᶜSqₜᵖ⁰[colidx] + ᶜSqₜᵖ[colidx]) + @. Yₜ.c.ρe_tot[colidx] += Y.c.ρ[colidx] * (ᶜSeₜᵖ⁰[colidx] + ᶜSeₜᵖ[colidx]) + @. Yₜ.c.ρq_rai[colidx] += Y.c.ρ[colidx] * (ᶜSqᵣᵖ⁰[colidx] + ᶜSqᵣᵖ[colidx]) + @. Yₜ.c.ρq_sno[colidx] += Y.c.ρ[colidx] * (ᶜSqₛᵖ⁰[colidx] + ᶜSqₛᵖ[colidx]) + # Update from the updraft precipitation sources + n = n_mass_flux_subdomains(p.atmos.turbconv_model) + for j in 1:n + @. Yₜ.c.ρ[colidx] += ᶜρaʲs.:($$j)[colidx] * ᶜSqₜᵖʲs.:($$j)[colidx] + @. Yₜ.c.ρq_tot[colidx] += ᶜρaʲs.:($$j)[colidx] * ᶜSqₜᵖʲs.:($$j)[colidx] + @. Yₜ.c.ρe_tot[colidx] += ᶜρaʲs.:($$j)[colidx] * ᶜSeₜᵖʲs.:($$j)[colidx] + @. Yₜ.c.ρq_rai[colidx] += ᶜρaʲs.:($$j)[colidx] * ᶜSqᵣᵖʲs.:($$j)[colidx] + @. Yₜ.c.ρq_sno[colidx] += ᶜρaʲs.:($$j)[colidx] * ᶜSqₛᵖʲs.:($$j)[colidx] + end +end function precipitation_tendency!( Yₜ, Y, diff --git a/toml/diagnostic_edmfx_trmm_box.toml b/toml/diagnostic_edmfx_trmm_box.toml index 6957f41940b..051739d21ec 100644 --- a/toml/diagnostic_edmfx_trmm_box.toml +++ b/toml/diagnostic_edmfx_trmm_box.toml @@ -1,6 +1,3 @@ -[precipitation_timescale] -value = 600 - [entr_inv_tau] value = 0.002 diff --git a/toml/diagnostic_edmfx_trmm_box_0M.toml b/toml/diagnostic_edmfx_trmm_box_0M.toml new file mode 100644 index 00000000000..6957f41940b --- /dev/null +++ b/toml/diagnostic_edmfx_trmm_box_0M.toml @@ -0,0 +1,23 @@ +[precipitation_timescale] +value = 600 + +[entr_inv_tau] +value = 0.002 + +[entr_coeff] +value = 0 + +[detr_inv_tau] +value = 0 + +[detr_vertdiv_coeff] +value = 0.6 + +[detr_buoy_coeff] +value = 0.12 + +[min_area_limiter_scale] +value = 0 + +[max_area_limiter_scale] +value = 0