diff --git a/.buildkite/longruns/pipeline.yml b/.buildkite/longruns/pipeline.yml index 261595ba68f..8fc43b5be73 100644 --- a/.buildkite/longruns/pipeline.yml +++ b/.buildkite/longruns/pipeline.yml @@ -26,13 +26,14 @@ steps: - echo "--- Instantiate" - "julia --project=examples -e 'using Pkg; Pkg.instantiate(;verbose=true)'" - "julia --project=examples -e 'using Pkg; Pkg.precompile()'" - - "julia --project=examples -e 'using CUDA; CUDA.precompile_runtime()'" + # - "julia --project=examples -e 'using CUDA; CUDA.precompile_runtime()'" - "julia --project=examples -e 'using Pkg; Pkg.status()'" - "julia --project=examples artifacts/download_artifacts.jl" agents: - slurm_cpus_per_task: 8 - slurm_gpus: 1 + # slurm_cpus_per_task: 8 + # slurm_gpus: 1 + slurm_ntasks: 1 env: JULIA_NUM_PRECOMPILE_TASKS: 8 @@ -54,40 +55,52 @@ steps: # env: # JOB_NAME: "longrun_zalesak_tracer_energy_bw_rhoe_equil_highres" - - label: ":computer: SSP baroclinic wave (ρe_tot) equilmoist high resolution centered diff" - command: - - "srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml" - artifact_paths: "$$JOB_NAME/output_active/*" - agents: - slurm_ntasks: 32 - slurm_nodes: 2 - slurm_time: 24:00:00 - env: - JOB_NAME: "longrun_ssp_bw_rhoe_equil_highres" + # - label: ":computer: SSP baroclinic wave (ρe_tot) equilmoist high resolution centered diff" + # command: + # - "srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml" + # artifact_paths: "$$JOB_NAME/output_active/*" + # agents: + # slurm_ntasks: 32 + # slurm_nodes: 2 + # slurm_time: 24:00:00 + # env: + # JOB_NAME: "longrun_ssp_bw_rhoe_equil_highres" + + # - label: ":computer: aquaplanet equilmoist clearsky radiation + prognostic edmf diffusion only + 0M microphysics" + # command: + # - srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml + # artifact_paths: "$$JOB_NAME/output_active/*" + # agents: + # slurm_ntasks: 64 + # slurm_nodes: 4 + # slurm_mem_per_cpu: 16GB + # slurm_time: 24:00:00 + # env: + # JOB_NAME: "longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_diffonly_0M" - - label: ":computer: aquaplanet equilmoist clearsky radiation + prognostic edmf diffusion only + 0M microphysics" + - label: ":computer: aquaplanet equilmoist clearsky radiation + prognostic edmf + 0M microphysics" command: - srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml artifact_paths: "$$JOB_NAME/output_active/*" agents: - slurm_ntasks: 64 - slurm_nodes: 4 + slurm_ntasks: 128 + slurm_nodes: 8 slurm_mem_per_cpu: 16GB slurm_time: 24:00:00 env: - JOB_NAME: "longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_diffonly_0M" + JOB_NAME: "longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M" - - group: "Low resolution long runs" + # - group: "Low resolution long runs" - steps: + # steps: - - label: ":computer: low resolution aquaplanet equilmoist clearsky radiation + time-varying insolation + slab ocean" - command: - - srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml - artifact_paths: "$$JOB_NAME/output_active/*" - agents: - slurm_ntasks: 8 - slurm_mem_per_cpu: 16GB - slurm_time: 24:00:00 - env: - JOB_NAME: "longrun_aquaplanet_rhoe_equil_clearsky_tvinsol_0M_slabocean" + # - label: ":computer: low resolution aquaplanet equilmoist clearsky radiation + time-varying insolation + slab ocean" + # command: + # - srun julia --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/$$JOB_NAME.yml + # artifact_paths: "$$JOB_NAME/output_active/*" + # agents: + # slurm_ntasks: 8 + # slurm_mem_per_cpu: 16GB + # slurm_time: 24:00:00 + # env: + # JOB_NAME: "longrun_aquaplanet_rhoe_equil_clearsky_tvinsol_0M_slabocean" diff --git a/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_0M.yml b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_0M.yml new file mode 100644 index 00000000000..4f1d186e8dc --- /dev/null +++ b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_0M.yml @@ -0,0 +1,24 @@ +h_elem: 12 +z_max: 55000.0 +z_elem: 30 +dz_bottom: 100.0 +dz_top: 3000.0 +moist: "equil" +precip_model: "0M" +override_τ_precip: false +rad: "clearsky" +dt_rad: "6hours" +surface_setup: "DefaultMoninObukhov" +vert_diff: "FriersonDiffusion" +rayleigh_sponge: true +dt_save_state_to_disk: "10days" +dt: "200secs" +t_end: "100days" +job_id: "longrun_aquaplanet_equil_helem12_clearsky_0M" +toml: [toml/longrun_aquaplanet_equil_helem12_clearsky_0M.toml] +netcdf_output_at_levels: true +diagnostics: + - short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl] + period: 10days + - short_name: [lmix, bgrad, strain, edt, evu] + period: 10days diff --git a/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.yml b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.yml new file mode 100644 index 00000000000..717d4ffd565 --- /dev/null +++ b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.yml @@ -0,0 +1,25 @@ +h_elem: 12 +z_max: 55000.0 +z_elem: 30 +dz_bottom: 100.0 +dz_top: 3000.0 +moist: "equil" +precip_model: "0M" +override_τ_precip: false +rad: "clearsky" +dt_rad: "6hours" +surface_setup: "DefaultMoninObukhov" +vert_diff: "FriersonDiffusion" +rayleigh_sponge: true +viscous_sponge: true +dt_save_state_to_disk: "10days" +dt: "200secs" +t_end: "100days" +job_id: "longrun_aquaplanet_equil_helem12_clearsky_0M_viscous" +toml: [toml/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.toml] +netcdf_output_at_levels: true +diagnostics: + - short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl] + period: 10days + - short_name: [lmix, bgrad, strain, edt, evu] + period: 10days diff --git a/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.yml b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.yml new file mode 100644 index 00000000000..a96b60ae749 --- /dev/null +++ b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.yml @@ -0,0 +1,40 @@ +h_elem: 12 +z_max: 55000.0 +z_elem: 30 +dz_bottom: 100.0 +dz_top: 3000.0 +moist: "equil" +precip_model: "0M" +override_τ_precip: false +rad: "clearsky" +dt_rad: "6hours" +surface_setup: "DefaultMoninObukhov" +turbconv: "prognostic_edmfx" +implicit_sgs_advection: true +implicit_diffusion: true +approximate_linear_solve_iters: 2 +max_newton_iters_ode: 3 +prognostic_tke: true +edmfx_upwinding: "first_order" +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" +edmfx_nh_pressure: true +edmfx_velocity_relaxation: true +edmfx_sgs_mass_flux: true +edmfx_sgs_diffusive_flux: true +rayleigh_sponge: true +viscous_sponge: true +restart_file: "/central/groups/esm/zhaoyi/climaatmos/longrun_1514/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M/output_active/day20.0.hdf5" +dt_save_state_to_disk: "3hours" +dt: "40secs" +t_end: "100days" +job_id: "longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M" +toml: [toml/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.toml] +netcdf_output_at_levels: true +diagnostics: + - short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl] + period: 3hours + - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, taen, thetaaen, haen, husen, huren, clwen, clien, tke] + period: 3hours + - short_name: [entr, detr, lmix, bgrad, strain, edt, evu] + period: 3hours diff --git a/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M_asym.yml b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M_asym.yml new file mode 100644 index 00000000000..bc0f7d79005 --- /dev/null +++ b/config/longrun_configs/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M_asym.yml @@ -0,0 +1,39 @@ +h_elem: 12 +z_max: 55000.0 +z_elem: 30 +dz_bottom: 100.0 +dz_top: 3000.0 +moist: "equil" +precip_model: "0M" +override_τ_precip: false +surface_temperature: "ZonallyAsymmetric" +rad: "clearsky" +dt_rad: "6hours" +surface_setup: "DefaultMoninObukhov" +turbconv: "prognostic_edmfx" +implicit_sgs_advection: true +implicit_diffusion: true +approximate_linear_solve_iters: 2 +max_newton_iters_ode: 3 +prognostic_tke: true +edmfx_upwinding: "first_order" +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" +edmfx_nh_pressure: true +edmfx_velocity_relaxation: true +edmfx_sgs_mass_flux: true +edmfx_sgs_diffusive_flux: true +rayleigh_sponge: true +dt_save_state_to_disk: "10days" +dt: "40secs" +t_end: "100days" +job_id: "longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M_asym" +toml: [toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml] +netcdf_output_at_levels: true +diagnostics: + - short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl] + period: 10days + - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, taen, thetaaen, haen, husen, huren, clwen, clien, tke] + period: 10days + - short_name: [entr, detr, lmix, bgrad, strain, edt, evu] + period: 10days diff --git a/config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.yml b/config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.yml new file mode 100644 index 00000000000..5638e9f2881 --- /dev/null +++ b/config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.yml @@ -0,0 +1,38 @@ +h_elem: 16 +z_max: 55000.0 +z_elem: 63 +dz_bottom: 30.0 +dz_top: 3000.0 +moist: "equil" +precip_model: "0M" +override_τ_precip: false +rad: "clearsky" +dt_rad: "6hours" +surface_setup: "DefaultMoninObukhov" +turbconv: "prognostic_edmfx" +implicit_sgs_advection: true +implicit_diffusion: true +approximate_linear_solve_iters: 2 +max_newton_iters_ode: 3 +prognostic_tke: true +edmfx_upwinding: "first_order" +edmfx_entr_model: "Generalized" +edmfx_detr_model: "Generalized" +edmfx_nh_pressure: true +edmfx_velocity_relaxation: true +edmfx_sgs_mass_flux: true +edmfx_sgs_diffusive_flux: true +rayleigh_sponge: true +dt_save_state_to_disk: "3hours" +dt: "40secs" +t_end: "10days" +job_id: "longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M" +toml: [toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml] +netcdf_output_at_levels: true +diagnostics: + - short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl] + period: 1days + - short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, taen, thetaaen, haen, husen, huren, clwen, clien, tke] + period: 1days + - short_name: [entr, detr, lmix, bgrad, strain, edt, evu] + period: 1days diff --git a/post_processing/ci_plots.jl b/post_processing/ci_plots.jl index 2e03d5f0f17..af09617b09e 100644 --- a/post_processing/ci_plots.jl +++ b/post_processing/ci_plots.jl @@ -1042,26 +1042,26 @@ function make_plots( short_names = [ "ua", - "wa", + "va", + "tke", + "lmix", + "bgrad", + "strain", "thetaa", "thetaaup", "ta", "taup", "ha", "haup", + "wa", "waup", - "tke", - "lmix", "arup", "hus", "husup", "hur", "hurup", - "cl", "clw", "clwup", - "cli", - "cliup", precip_names..., ] reduction = "inst" @@ -1083,6 +1083,13 @@ function make_plots( ([slice(v, time = LAST_SNAP) for v in group]...,) for group in var_groups_zt ] + # var_groups_z = [ + # ( + # [ + # ClimaAnalysis.window(v, "time", left = 14400, right = 21600) |> ClimaAnalysis.average_time for v in group + # ]..., + # ) for group in var_groups_zt + # ] tmp_file = make_plots_generic( output_paths, diff --git a/src/cache/precomputed_quantities.jl b/src/cache/precomputed_quantities.jl index 33761466828..07dd73faad9 100644 --- a/src/cache/precomputed_quantities.jl +++ b/src/cache/precomputed_quantities.jl @@ -38,7 +38,7 @@ function precomputed_quantities(Y, atmos) !(atmos.turbconv_model isa DiagnosticEDMFX) @assert !(atmos.moisture_model isa DryModel) || !(atmos.turbconv_model isa PrognosticEDMFX) - @assert isnothing(atmos.turbconv_model) || isnothing(atmos.vert_diff) + # @assert isnothing(atmos.turbconv_model) || isnothing(atmos.vert_diff) TST = thermo_state_type(atmos.moisture_model, FT) SCT = SurfaceConditions.surface_conditions_type(atmos, FT) cspace = axes(Y.c) @@ -53,6 +53,8 @@ function precomputed_quantities(Y, atmos) ᶜp = similar(Y.c, FT), ᶜh_tot = similar(Y.c, FT), ᶜmixing_length = similar(Y.c, FT), + ᶜlinear_buoygrad = similar(Y.c, FT), + ᶜstrain_rate_norm = similar(Y.c, FT), sfc_conditions = Fields.Field(SCT, Spaces.level(axes(Y.f), half)), ) cloud_diagnostics = (; ᶜcloud_fraction = similar(Y.c, FT),) @@ -83,8 +85,6 @@ function precomputed_quantities(Y, atmos) ᶜq_tot⁰ = similar(Y.c, FT), ᶜts⁰ = similar(Y.c, TST), ᶜρ⁰ = similar(Y.c, FT), - ᶜlinear_buoygrad = similar(Y.c, FT), - ᶜstrain_rate_norm = similar(Y.c, FT), ᶜK_u = similar(Y.c, FT), ᶜK_h = similar(Y.c, FT), ρatke_flux = similar(Fields.level(Y.f, half), C3{FT}), diff --git a/src/cache/prognostic_edmf_precomputed_quantities.jl b/src/cache/prognostic_edmf_precomputed_quantities.jl index 4fa1a940a60..b5dd1ead381 100644 --- a/src/cache/prognostic_edmf_precomputed_quantities.jl +++ b/src/cache/prognostic_edmf_precomputed_quantities.jl @@ -256,7 +256,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!( ᶜentrʲs.:($$j), ᶜvert_div, ᶜmassflux_vert_div, - ᶜtke⁰, + max(ᶜtke⁰, 0), p.atmos.edmfx_detr_model, ) @. ᶜdetrʲs.:($$j) = limit_detrainment( @@ -324,7 +324,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!( turbconv_params = CAP.turbconv_params(params) c_m = CAP.tke_ed_coeff(turbconv_params) - @. ᶜK_u = c_m * ᶜmixing_length * sqrt(max(ᶜtke⁰, 0)) + @. ᶜK_u = max(c_m * ᶜmixing_length * sqrt(max(ᶜtke⁰, 0)), 0) @. ᶜK_h = ᶜK_u / ᶜprandtl_nvec ρatke_flux_values = Fields.field_values(ρatke_flux) diff --git a/src/diagnostics/core_diagnostics.jl b/src/diagnostics/core_diagnostics.jl index c710c7c057d..de2aa0eafd5 100644 --- a/src/diagnostics/core_diagnostics.jl +++ b/src/diagnostics/core_diagnostics.jl @@ -246,6 +246,38 @@ add_diagnostic_variable!( end, ) +### +# Buoyancy gradient (3d) +### +add_diagnostic_variable!( + short_name = "bgrad", + long_name = "Linearized Buoyancy Gradient", + units = "s^-2", + compute! = (out, state, cache, time) -> begin + if isnothing(out) + return copy(cache.precomputed.ᶜlinear_buoygrad) + else + out .= cache.precomputed.ᶜlinear_buoygrad + end + end, +) + +### +# Strain rate magnitude (3d) +### +add_diagnostic_variable!( + short_name = "strain", + long_name = "String Rate Magnitude", + units = "s^-2", + compute! = (out, state, cache, time) -> begin + if isnothing(out) + return copy(cache.precomputed.ᶜstrain_rate_norm) + else + out .= cache.precomputed.ᶜstrain_rate_norm + end + end, +) + ### # Relative humidity (3d) ### diff --git a/src/diagnostics/edmfx_diagnostics.jl b/src/diagnostics/edmfx_diagnostics.jl index a7eb2f2d0df..cfd6982a862 100644 --- a/src/diagnostics/edmfx_diagnostics.jl +++ b/src/diagnostics/edmfx_diagnostics.jl @@ -882,64 +882,6 @@ add_diagnostic_variable!( compute! = compute_tke!, ) -### -# Buoyancy gradient (3d) -### -compute_bgrad!(out, state, cache, time) = - compute_bgrad!(out, state, cache, time, cache.atmos.turbconv_model) -compute_bgrad!(_, _, _, _, turbconv_model::T) where {T} = - error_diagnostic_variable("bgrad", turbconv_model) - -function compute_bgrad!( - out, - state, - cache, - time, - turbconv_model::Union{PrognosticEDMFX, DiagnosticEDMFX}, -) - if isnothing(out) - return copy(cache.precomputed.ᶜlinear_buoygrad) - else - out .= cache.precomputed.ᶜlinear_buoygrad - end -end - -add_diagnostic_variable!( - short_name = "bgrad", - long_name = "Linearized Buoyancy Gradient", - units = "s^-2", - compute! = compute_bgrad!, -) - -### -# Strain rate magnitude (3d) -### -compute_strain!(out, state, cache, time) = - compute_strain!(out, state, cache, time, cache.atmos.turbconv_model) -compute_strain!(_, _, _, _, turbconv_model::T) where {T} = - error_diagnostic_variable("strain", turbconv_model) - -function compute_strain!( - out, - state, - cache, - time, - turbconv_model::Union{PrognosticEDMFX, DiagnosticEDMFX}, -) - if isnothing(out) - return copy(cache.precomputed.ᶜstrain_rate_norm) - else - out .= cache.precomputed.ᶜstrain_rate_norm - end -end - -add_diagnostic_variable!( - short_name = "strain", - long_name = "String Rate Magnitude", - units = "s^-2", - compute! = compute_strain!, -) - ### # Diffusivity of heat (3d) ### diff --git a/src/initial_conditions/initial_conditions.jl b/src/initial_conditions/initial_conditions.jl index fd1f6caa342..19918d3a004 100644 --- a/src/initial_conditions/initial_conditions.jl +++ b/src/initial_conditions/initial_conditions.jl @@ -774,6 +774,13 @@ end The `InitialCondition` described in [Brown2002](@cite), but with a hydrostatically balanced pressure profile. """ + +bomex_tke(::Type{FT}) where {FT} = z -> if (z <= 2500.0) + FT(1) - z / 3000 +else + FT(0) +end + Base.@kwdef struct ARM_SGP <: InitialCondition prognostic_tke::Bool = false end @@ -811,7 +818,7 @@ for IC in (:Soares, :Bomex, :LifeCycleTan2018, :ARM_SGP) ), velocity = Geometry.UVector(u(z)), turbconv_state = EDMFState(; - tke = prognostic_tke ? FT(0) : tke(z), + tke = prognostic_tke ? bomex_tke(FT)(z) : tke(z), ), ) end diff --git a/src/prognostic_equations/edmfx_closures.jl b/src/prognostic_equations/edmfx_closures.jl index 55df94579d8..d341a67eec7 100644 --- a/src/prognostic_equations/edmfx_closures.jl +++ b/src/prognostic_equations/edmfx_closures.jl @@ -110,8 +110,37 @@ function edmfx_nh_pressure_tendency!( ᶠlg = Fields.local_geometry_field(Y.f) scale_height = CAP.R_d(params) * CAP.T_surf_ref(params) / CAP.grav(params) + FT = eltype(Y) + ᶜz = Fields.coordinate_field(Y.c).z + z_sfc = Fields.level(Fields.coordinate_field(Y.f).z, Fields.half) + z_sfc_data = Fields.field_values(z_sfc[colidx]) + turbconv_params = CAP.turbconv_params(params) + a_min = CAP.min_area(turbconv_params) + ᶜupdraft_top = p.scratch.ᶜtemp_scalar for j in 1:n + # # look for updraft top + # ᶜupdraft_top_data = Fields.field_values(ᶜupdraft_top[colidx]) + # @. ᶜupdraft_top_data = FT(0) + # for level in 1:Spaces.nlevels(axes(ᶜz)) + # ρaʲ_lev = Fields.field_values( + # Spaces.level(Y.c.sgsʲs.:($j).ρa[colidx], level), + # ) + # ρʲ_lev = + # Fields.field_values(Spaces.level(ᶜρʲs.:($j)[colidx], level)) + # ᶜz_lev = Fields.field_values(Spaces.level(ᶜz[colidx], level)) + # @. ᶜupdraft_top_data = ifelse( + # draft_area(ρaʲ_lev, ρʲ_lev) > a_min, + # ᶜz_lev, + # ᶜupdraft_top_data, + # ) + # end + # @. ᶜupdraft_top_data = ᶜupdraft_top_data - z_sfc_data + + # # There's only one updraft_top per column, so it's + # # safe to use at cell centers and cell faces, correct?: + # ᶠupdraft_top = Fields.Field(ᶜupdraft_top_data, axes(ᶠu₃⁰[colidx])) + @. ᶠnh_pressure₃ʲs.:($$j)[colidx] = ᶠupdraft_nh_pressure( params, p.atmos.edmfx_nh_pressure, @@ -247,9 +276,15 @@ function mixing_length( l_TKE > l_z ? l_z : l_TKE, l_W > l_z ? l_z : l_W, ) + # l = SA.SVector( + # (l_N < eps(FT) || l_N > l_z) ? l_z : l_N, + # (l_TKE < eps(FT) || l_TKE > l_z) ? l_z : l_TKE, + # (l_W < eps(FT) || l_W > l_z) ? l_z : l_W, + # ) # get soft minimum l_smin = lamb_smooth_minimum(l, smin_ub, smin_rm) l_limited = max(l_smag, min(l_smin, l_z)) + #l_limited = min(200, l_z) return l_limited end @@ -305,11 +340,25 @@ function edmfx_velocity_relaxation_tendency!( n = n_mass_flux_subdomains(turbconv_model) (; dt) = p + (; ᶜK, ᶜh_tot, ᶜspecific) = p.precomputed + ᶜu₃ʲ = p.scratch.ᶜtemp_C3 if p.atmos.edmfx_velocity_relaxation for j in 1:n @. Yₜ.f.sgsʲs.:($$j).u₃[colidx] -= C3(min(Y.f.sgsʲs.:($$j).u₃[colidx].components.data.:1, 0)) / dt + @. Yₜ.c.sgsʲs.:($$j).ρa[colidx] -= min(Y.c.sgsʲs.:($$j).ρa[colidx], 0) / dt + # @. ᶜu₃ʲ[colidx] = ᶜinterp(Y.f.sgsʲs.:($$j).u₃[colidx]) + # @. Yₜ.c.sgsʲs.:($$j).mse[colidx] -= ifelse( + # ᶜu₃ʲ[colidx].components.data.:1 < 0, + # (Y.c.sgsʲs.:($$j).mse[colidx] - (ᶜh_tot[colidx] - ᶜK[colidx])) / dt, + # 0, + # ) + # @. Yₜ.c.sgsʲs.:($$j).q_tot[colidx] -= ifelse( + # ᶜu₃ʲ[colidx].components.data.:1 < 0, + # (Y.c.sgsʲs.:($$j).q_tot[colidx] - ᶜspecific.q_tot[colidx]) / dt, + # 0, + # ) end end end diff --git a/src/prognostic_equations/gm_sgs_closures.jl b/src/prognostic_equations/gm_sgs_closures.jl index 6635d2a4ce6..84adff65441 100644 --- a/src/prognostic_equations/gm_sgs_closures.jl +++ b/src/prognostic_equations/gm_sgs_closures.jl @@ -29,10 +29,9 @@ NVTX.@annotate function compute_gm_mixing_length!(ᶜmixing_length, Y, p) ᶜdz = Fields.Δz_field(axes(Y.c)) ᶜlg = Fields.local_geometry_field(Y.c) - (; ᶜts, ᶜp, ᶠu³) = p.precomputed + (; ᶜts, ᶠu³, ᶜlinear_buoygrad, ᶜstrain_rate_norm) = p.precomputed (; obukhov_length) = p.precomputed.sfc_conditions - ᶜlinear_buoygrad = p.scratch.ᶜtemp_scalar @. ᶜlinear_buoygrad = buoyancy_gradients( BuoyGradMean(), thermo_params, @@ -53,13 +52,14 @@ NVTX.@annotate function compute_gm_mixing_length!(ᶜmixing_length, Y, p) @. ᶠu = C123(ᶠinterp(Y.c.uₕ)) + C123(ᶠu³) ᶜstrain_rate = p.scratch.ᶜtemp_UVWxUVW compute_strain_rate_center!(ᶜstrain_rate, ᶠu) + @. ᶜstrain_rate_norm = norm_sqr(ᶜstrain_rate) ᶜprandtl_nvec = p.scratch.ᶜtemp_scalar_2 @. ᶜprandtl_nvec = turbulent_prandtl_number( params, obukhov_length, ᶜlinear_buoygrad, - norm_sqr(ᶜstrain_rate), + ᶜstrain_rate_norm, ) @. ᶜmixing_length = smagorinsky_lilly_length( diff --git a/toml/longrun_aquaplanet_equil_helem12_clearsky_0M.toml b/toml/longrun_aquaplanet_equil_helem12_clearsky_0M.toml new file mode 100644 index 00000000000..5697ca1f47e --- /dev/null +++ b/toml/longrun_aquaplanet_equil_helem12_clearsky_0M.toml @@ -0,0 +1,11 @@ +[zd_rayleigh] +value = 35000.0 + +[alpha_rayleigh_uh] +value = 0.0 + +[alpha_rayleigh_w] +value = 10.0 + +[precipitation_timescale] +value = 600 diff --git a/toml/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.toml b/toml/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.toml new file mode 100644 index 00000000000..76e5a39ca27 --- /dev/null +++ b/toml/longrun_aquaplanet_equil_helem12_clearsky_0M_viscous.toml @@ -0,0 +1,14 @@ +[zd_rayleigh] +value = 35000.0 + +[alpha_rayleigh_uh] +value = 0.0 + +[zd_viscous] +value = 35000.0 + +[kappa_2_sponge] +value = 4e6 + +[precipitation_timescale] +value = 600 diff --git a/toml/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.toml b/toml/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.toml new file mode 100644 index 00000000000..96f612eac63 --- /dev/null +++ b/toml/longrun_aquaplanet_equil_helem12_clearsky_progedmf_0M.toml @@ -0,0 +1,56 @@ +[zd_rayleigh] +value = 35000.0 + +[alpha_rayleigh_uh] +value = 0.0 + +[alpha_rayleigh_w] +value = 10.0 + +[zd_viscous] +value = 35000.0 + +[kappa_2_sponge] +value = 4e6 + +[precipitation_timescale] +value = 600 + +[EDMF_surface_area] +value = 0.1 + +[EDMF_min_area] +value = 1.0e-5 + +[EDMF_max_area] +value = 0.7 + +[entr_inv_tau] +value = 0.0002 + +[entr_coeff] +value = 0.2 + +[min_area_limiter_scale] +value = 0 + +[min_area_limiter_power] +value = 100 + +[detr_inv_tau] +value = 0 + +[detr_coeff] +value = 0 + +[detr_buoy_coeff] +value = 0 + +[detr_vertdiv_coeff] +value = 0 + +[detr_massflux_vertdiv_coeff] +value = 1 + +[pressure_normalmode_drag_coeff] +value = 40.0 diff --git a/toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml b/toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml index c78bc0e113e..c76bd0e1e89 100644 --- a/toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml +++ b/toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml @@ -8,7 +8,7 @@ value = 0.0 value = 600 [EDMF_surface_area] -value = 0 +value = 0.1 [EDMF_min_area] value = 1.0e-5