Skip to content

Commit

Permalink
Merge #2180
Browse files Browse the repository at this point in the history
2180: fix for Rayleigh sponge r=charleskawczynski a=simonbyrne



Co-authored-by: Simon Byrne <simonbyrne@gmail.com>
  • Loading branch information
bors[bot] and simonbyrne authored Oct 3, 2023
2 parents fab2f3c + d594643 commit ef53062
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parameterized_tendencies/sponge/rayleigh_sponge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ function rayleigh_sponge_cache(rs::RayleighSponge, Y)
(; zd, α_uₕ, α_w) = rs
ᶜz = Fields.coordinate_field(Y.c).z
ᶠz = Fields.coordinate_field(Y.f).z
ᶜαₘ_uₕ = @. ifelse(ᶜz > zd, α_uₕ, FT(0))
ᶠαₘ_w = @. ifelse(ᶠz > zd, α_w, FT(0))
ᶜαₘ_uₕ = @. ifelse(ᶜz > zd, α_uₕ, $(FT(0)))
ᶠαₘ_w = @. ifelse(ᶠz > zd, α_w, $(FT(0)))
zmax = maximum(ᶠz)
ᶜβ_rayleigh_uₕ = @. ᶜαₘ_uₕ * sin(FT(π) / 2 * (ᶜz - zd) / (zmax - zd))^2
ᶠβ_rayleigh_w = @. ᶠαₘ_w * sin(FT(π) / 2 * (ᶠz - zd) / (zmax - zd))^2
ᶜβ_rayleigh_uₕ = @. ᶜαₘ_uₕ * sin($(FT)) / 2 * (ᶜz - zd) / (zmax - zd))^2
ᶠβ_rayleigh_w = @. ᶠαₘ_w * sin($(FT)) / 2 * (ᶠz - zd) / (zmax - zd))^2
return (; ᶜβ_rayleigh_uₕ, ᶠβ_rayleigh_w)
end

Expand Down

0 comments on commit ef53062

Please sign in to comment.