Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ hyperdiff:
help: "Hyperdiffusion. Use `CAM_SE` for sensible default values and ClimaHyperdiffusion for user control. [`CAM_SE` (default), `ClimaHyperdiffusion` (or `true`), `none` (or `false`)]"
value: "CAM_SE"
amd_les:
help: "AMD LES closure [`true`, `false` (default)]"
value: false
help: "Anisotropic minimum dissipation diffusive closure [`nothing` (default), `UVW`, `UV`, `W`, `UV_W_decoupled`]"
value: ~
c_amd:
help: "Model coefficient for AMD-LES closure (TODO: Move to parameters.toml)"
value: 0.29
Expand Down
2 changes: 1 addition & 1 deletion src/cache/precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function precomputed_quantities(Y, atmos)
else
(;)
end
amd_les_quantities =
amd_les_quantities = # TODO: Combine?
if atmos.amd_les isa AnisotropicMinimumDissipation
uvw_vec = UVW(FT(0), FT(0), FT(0))
(;
Expand Down
10 changes: 6 additions & 4 deletions src/solver/model_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,12 @@ function get_smagorinsky_lilly_model(parsed_args)
end

function get_amd_les_model(parsed_args, ::Type{FT}) where {FT}
is_model_active = parsed_args["amd_les"]
@assert is_model_active in (true, false)
return is_model_active ? AnisotropicMinimumDissipation{FT}(parsed_args["c_amd"]) :
nothing
amd = parsed_args["amd_les"]
isnothing(amd) && return nothing
amd_symbol = Symbol(amd)
@assert amd_symbol in (:UVW, :UV, :W, :UV_W)
c_amd = FT(parsed_args["amd_coefficient"])
return AnisotropicMinimumDissipation{amd_symbol, FT}(; c_amd)
end

function get_rayleigh_sponge_model(parsed_args, params, ::Type{FT}) where {FT}
Expand Down
40 changes: 20 additions & 20 deletions src/solver/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Base.@kwdef struct ViscousSponge{FT} <: AbstractSponge
κ₂::FT
end

abstract type AbstractEddyViscosityModel end
abstract type AbstractEddyViscosityModel{AXES} end
"""
SmagorinskyLilly{AXES}

Expand All @@ -250,41 +250,41 @@ Smagorinsky-Lilly eddy viscosity model.
- `:W` (vertical axis)
- `:UV_W` (horizontal and vertical axes treated separately).
"""
struct SmagorinskyLilly{AXES} <: AbstractEddyViscosityModel end
struct SmagorinskyLilly{AXES} <: AbstractEddyViscosityModel{AXES} end

struct AnisotropicMinimumDissipation{AXES, FT} <: AbstractEddyViscosityModel{AXES}
c_amd::FT
end

"""
is_smagorinsky_UVW_coupled(model)
is_les_UVW_coupled(model)

Check if the Smagorinsky model is coupled along all axes.
Check if the LES model is coupled along all axes.
"""
is_smagorinsky_UVW_coupled(::SmagorinskyLilly{AXES}) where {AXES} = AXES == :UVW
is_smagorinsky_UVW_coupled(::Nothing) = false
is_les_UVW_coupled(::AbstractEddyViscosityModel{AXES}) where {AXES} = AXES == :UVW
is_les_UVW_coupled(::Nothing) = false

"""
is_smagorinsky_vertical(model)
is_les_vertical(model)

Check if the Smagorinsky model is applied along the vertical axis.
Check if the LES model is applied along the vertical axis.

See also [`is_smagorinsky_horizontal`](@ref).
See also [`is_les_horizontal`](@ref).
"""
is_smagorinsky_vertical(::SmagorinskyLilly{AXES}) where {AXES} =
is_les_vertical(::AbstractEddyViscosityModel{AXES}) where {AXES} =
AXES == :UVW || AXES == :W || AXES == :UV_W
is_smagorinsky_vertical(::Nothing) = false
is_les_vertical(::Nothing) = false

"""
is_smagorinsky_horizontal(model)
is_les_horizontal(model)

Check if the Smagorinsky model is applied along the horizontal axes.
Check if the LES model is applied along the horizontal axes.

See also [`is_smagorinsky_vertical`](@ref).
See also [`is_les_vertical`](@ref).
"""
is_smagorinsky_horizontal(::SmagorinskyLilly{AXES}) where {AXES} =
is_les_horizontal(::AbstractEddyViscosityModel{AXES}) where {AXES} =
AXES == :UVW || AXES == :UV || AXES == :UV_W
is_smagorinsky_horizontal(::Nothing) = false

struct AnisotropicMinimumDissipation{FT} <: AbstractEddyViscosityModel
c_amd::FT
end
is_les_horizontal(::Nothing) = false


Base.@kwdef struct RayleighSponge{FT} <: AbstractSponge
Expand Down
Loading