Skip to content

Commit

Permalink
Merge pull request #3475 from CliMA/aj/more_diffusion
Browse files Browse the repository at this point in the history
Add exponentially decaying with height diffusion option
  • Loading branch information
trontrytel authored Dec 12, 2024
2 parents d1aebff + 14b644b commit 9c20f6a
Show file tree
Hide file tree
Showing 32 changed files with 125 additions and 50 deletions.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ the atmosphere. PR [3476](https://github.com/CliMA/ClimaAtmos.jl/pull/3476)
v0.27.9
-------

### Features

### New option for vertical diffusion

When `vert_diff` is set to `DecayWithHeightDiffusion`, diffusion decays
exponentially with height.
PR [3475](https://github.com/CliMA/ClimaAtmos.jl/pull/3475)

v0.27.8
-------

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AtmosphericProfilesLibrary = "0.1.7"
ClimaComms = "0.6.4"
ClimaCore = "0.14.12"
ClimaDiagnostics = "0.2.4"
ClimaParams = "0.10.12"
ClimaParams = "0.10.17"
ClimaTimeSteppers = "0.7.33"
ClimaUtilities = "0.1.14"
CloudMicrophysics = "0.22.3"
Expand Down
4 changes: 2 additions & 2 deletions calibration/experiments/gcm_driven_scm/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ version = "0.2.8"

[[deps.ClimaParams]]
deps = ["TOML"]
git-tree-sha1 = "b43ca371c435056129295445122ea87fd843b505"
git-tree-sha1 = "df21e7c6101f38cfd61f82a9e965332eb3136854"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.14"
version = "0.10.17"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ version = "0.1.7"

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "0b5afc75bd3aa7c30d76c2d33b8361f961e86237"
git-tree-sha1 = "df21e7c6101f38cfd61f82a9e965332eb3136854"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.8"
version = "0.10.17"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
2 changes: 1 addition & 1 deletion config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ reference_job_id:
Identifier of job to use as the "reference" solution in the quicklook plot; the current job's results get compared to the results of the quicklook job on the main branch
value: ~
vert_diff:
help: "Vertical diffusion [`false` (default), `VerticalDiffusion`, `true` (defaults to `VerticalDiffusion`), `FriersonDiffusion`]"
help: "Vertical diffusion [`false` (default), `VerticalDiffusion`, `true` (defaults to `VerticalDiffusion`), `FriersonDiffusion`, `DecayWithHeightDiffusion`]"
value: false
hyperdiff:
help: "Hyperdiffusion [`ClimaHyperdiffusion` (or `true`; default), `none` (or `false`)]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ precip_model: 1M
rad: allskywithclear
idealized_insolation: false
dt_rad: 1hours
vert_diff: FriersonDiffusion
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
dt_cloud_fraction: 1hours
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
surface_setup: "DefaultMoninObukhov"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ws_1process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
surface_setup: "DefaultMoninObukhov"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ws_2process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
surface_setup: "DefaultMoninObukhov"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ws_4process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
surface_setup: "DefaultMoninObukhov"
Expand Down
2 changes: 1 addition & 1 deletion config/longrun_configs/longrun_aquaplanet_allsky_0M.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ rad: "allskywithclear"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
precip_model: "0M"
toml: [toml/longrun_aquaplanet.toml]
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ rad: "allskywithclear"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
precip_model: "0M"
toml: [toml/longrun_aquaplanet.toml]
2 changes: 1 addition & 1 deletion config/longrun_configs/longrun_aquaplanet_allsky_1M.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ rad: "allskywithclear"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
precip_model: "1M"
toml: [toml/longrun_aquaplanet.toml]
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ rad: "allskywithclear"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
toml: [toml/longrun_aquaplanet.toml]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ moist: "equil"
prognostic_surface: "PrognosticSurfaceTemperature"
albedo_model: "RegressionFunctionAlbedo"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
Expand Down
10 changes: 5 additions & 5 deletions config/longrun_configs/longrun_aquaplanet_dyamond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ rayleigh_sponge: true
viscous_sponge: true
implicit_diffusion: true
approximate_linear_solve_iters: 2
moist: "equil"
moist: "equil"
cloud_model: "grid_scale"
dt: "60secs"
dt: "60secs"
t_end: "30days"
dt_save_state_to_disk: "10days"
rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
precip_model: "0M"
surface_setup: "DefaultMoninObukhov"
vert_diff: "DecayWithHeightDiffusion"
precip_model: "0M"
toml: [toml/longrun_aquaplanet.toml]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ t_end: "5days"
moist: "equil"
precip_model: "0M"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
rad: "clearsky"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ t_end: "5days"
moist: "equil"
precip_model: "0M"
surface_setup: "DefaultMoninObukhov"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
rad: "clearsky"
Expand Down
2 changes: 1 addition & 1 deletion config/model_configs/gpu_aquaplanet_dyamond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
surface_setup: "DefaultMoninObukhov"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dz_bottom: 50.0
dt: "400secs"
t_end: "18hours"
dt_save_state_to_disk: "18hours"
vert_diff: "FriersonDiffusion"
vert_diff: "DecayWithHeightDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
cloud_model: "grid_scale"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vert_diff: true
vert_diff: "DecayWithHeightDiffusion"
surface_setup: "DefaultExchangeCoefficients"
moist: "equil"
rad: "clearsky"
Expand Down
4 changes: 2 additions & 2 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ version = "0.2.11"

[[deps.ClimaParams]]
deps = ["TOML"]
git-tree-sha1 = "489c5655993c62fb34293908a6b0877e32f183ee"
git-tree-sha1 = "df21e7c6101f38cfd61f82a9e965332eb3136854"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.16"
version = "0.10.17"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
4 changes: 2 additions & 2 deletions examples/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ version = "0.2.11"

[[deps.ClimaParams]]
deps = ["TOML"]
git-tree-sha1 = "489c5655993c62fb34293908a6b0877e32f183ee"
git-tree-sha1 = "df21e7c6101f38cfd61f82a9e965332eb3136854"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.16"
version = "0.10.17"

[[deps.ClimaReproducibilityTests]]
deps = ["OrderedCollections", "PrettyTables"]
Expand Down
4 changes: 2 additions & 2 deletions perf/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ version = "0.2.11"

[[deps.ClimaParams]]
deps = ["TOML"]
git-tree-sha1 = "489c5655993c62fb34293908a6b0877e32f183ee"
git-tree-sha1 = "df21e7c6101f38cfd61f82a9e965332eb3136854"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.16"
version = "0.10.17"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
32 changes: 22 additions & 10 deletions src/cache/precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,14 @@ function precomputed_quantities(Y, atmos)
ρatke_flux = similar(Fields.level(Y.f, half), C3{FT}),
precipitation_sgs_quantities...,
) : (;)
vert_diff_quantities = if atmos.vert_diff isa VerticalDiffusion
ᶜK_h = similar(Y.c, FT)
(; ᶜK_u = ᶜK_h, ᶜK_h) # ᶜK_u aliases ᶜK_h because they are always equal.
elseif atmos.vert_diff isa FriersonDiffusion
ᶜK_h = similar(Y.c, FT)
(; ᶜK_u = ᶜK_h, ᶜK_h) # ᶜK_u aliases ᶜK_h because they are always equal.
else
(;)
end
vert_diff_quantities =
if atmos.vert_diff isa
Union{VerticalDiffusion, DecayWithHeightDiffusion, FriersonDiffusion}
ᶜK_h = similar(Y.c, FT)
(; ᶜK_u = ᶜK_h, ᶜK_h) # ᶜK_u aliases ᶜK_h because they are always equal.
else
(;)
end
precipitation_quantities =
atmos.precip_model isa Microphysics1Moment ?
(;
Expand Down Expand Up @@ -333,6 +332,9 @@ ts_sgs(thermo_params, moisture_model, specific, K, Φ, p) = thermo_state(
p,
)

function eddy_diffusivity_coefficient_H(D₀, H, z_sfc, z)
return D₀ * exp(-(z - z_sfc) / H)
end
function eddy_diffusivity_coefficient(C_E, norm_v_a, z_a, p)
p_pbl = 85000
p_strato = 10000
Expand Down Expand Up @@ -544,7 +546,17 @@ NVTX.@annotate function set_precomputed_quantities!(Y, p, t)
)
end

if vert_diff isa VerticalDiffusion
if vert_diff isa DecayWithHeightDiffusion
(; ᶜK_h) = p.precomputed
ᶜz = Fields.coordinate_field(Y.c).z
ᶠz_sfc = Fields.level(Fields.coordinate_field(Y.f).z, Fields.half)
@. ᶜK_h = eddy_diffusivity_coefficient_H(
p.atmos.vert_diff.D₀,
p.atmos.vert_diff.H,
ᶠz_sfc,
ᶜz,
)
elseif vert_diff isa VerticalDiffusion
(; ᶜK_h) = p.precomputed
interior_uₕ = Fields.level(Y.c.uₕ, 1)
ᶜΔz_surface = Fields.Δz_field(interior_uₕ)
Expand Down
1 change: 1 addition & 0 deletions src/diagnostics/Diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import ClimaAtmos.RRTMGPInterface as RRTMGPI
# vert_diff
import ..VerticalDiffusion
import ..FriersonDiffusion
import ..DecayWithHeightDiffusion

# turbconv_model
import ..PrognosticEDMFX
Expand Down
12 changes: 10 additions & 2 deletions src/diagnostics/edmfx_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,11 @@ function compute_edt!(
state,
cache,
time,
vert_diff::Union{VerticalDiffusion, FriersonDiffusion},
vert_diff::Union{
VerticalDiffusion,
FriersonDiffusion,
DecayWithHeightDiffusion,
},
turbconv_model::Nothing,
)
if isnothing(out)
Expand Down Expand Up @@ -1072,7 +1076,11 @@ function compute_evu!(
state,
cache,
time,
vert_diff::Union{VerticalDiffusion, FriersonDiffusion},
vert_diff::Union{
VerticalDiffusion,
FriersonDiffusion,
DecayWithHeightDiffusion,
},
turbconv_model::Nothing,
)
if isnothing(out)
Expand Down
3 changes: 2 additions & 1 deletion src/parameters/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Base.@kwdef struct ClimaAtmosParameters{
SFP,
TCP,
STP,
VDP,
} <: ACAP
thermodynamics_params::TP
rrtmgp_params::RP
Expand All @@ -79,12 +80,12 @@ Base.@kwdef struct ClimaAtmosParameters{
surface_fluxes_params::SFP
turbconv_params::TCP
surface_temp_params::STP
vert_diff_params::VDP
Omega::FT
f_plane_coriolis_frequency::FT
planet_radius::FT
astro_unit::FT
c_smag::FT
C_E::FT
C_H::FT
# Held Suarez
ΔT_y_dry::FT
Expand Down
Loading

0 comments on commit 9c20f6a

Please sign in to comment.