-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
104 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
##### | ||
##### Surface flux tendencies | ||
##### | ||
|
||
import ClimaCore.Geometry: ⊗ | ||
import ClimaCore.Operators as Operators | ||
|
||
surface_flux_tendency!(Yₜ, Y, p, t) = | ||
surface_flux_tendency!(Yₜ, Y, p, t, p.atmos.surface_flux_model) | ||
|
||
surface_flux_tendency!(Yₜ, Y, p, t, ::Nothing) = nothing | ||
|
||
function surface_flux_tendency!(Yₜ, Y, p, t, _) | ||
FT = eltype(Y) | ||
(; ᶜh_tot, ᶜspecific, sfc_conditions) = p.precomputed | ||
ᶠgradᵥ = Operators.GradientC2F() # apply BCs to ᶜdivᵥ, which wraps ᶠgradᵥ | ||
|
||
if diffuse_momentum(p.atmos.vert_diff) || !isnothing(p.atmos.turbconv_model) | ||
ᶜdivᵥ_uₕ = Operators.DivergenceF2C( | ||
top = Operators.SetValue(C3(FT(0)) ⊗ C12(FT(0), FT(0))), | ||
bottom = Operators.SetValue(sfc_conditions.ρ_flux_uₕ), | ||
) | ||
@. Yₜ.c.uₕ -= ᶜdivᵥ_uₕ(-(FT(0) * ᶠgradᵥ(Y.c.uₕ))) / Y.c.ρ | ||
end | ||
|
||
ᶜdivᵥ_ρe_tot = Operators.DivergenceF2C( | ||
top = Operators.SetValue(C3(FT(0))), | ||
bottom = Operators.SetValue(sfc_conditions.ρ_flux_h_tot), | ||
) | ||
@. Yₜ.c.ρe_tot -= ᶜdivᵥ_ρe_tot(-(FT(0) * ᶠgradᵥ(ᶜh_tot))) | ||
|
||
ᶜρχₜ_diffusion = p.scratch.ᶜtemp_scalar | ||
ρ_flux_χ = p.scratch.sfc_temp_C3 | ||
for (ᶜρχₜ, ᶜχ, χ_name) in matching_subfields(Yₜ.c, ᶜspecific) | ||
χ_name == :e_tot && continue | ||
if χ_name == :q_tot | ||
@. ρ_flux_χ = sfc_conditions.ρ_flux_q_tot | ||
else | ||
@. ρ_flux_χ = C3(FT(0)) | ||
end | ||
ᶜdivᵥ_ρχ = Operators.DivergenceF2C( | ||
top = Operators.SetValue(C3(FT(0))), | ||
bottom = Operators.SetValue(ρ_flux_χ), | ||
) | ||
@. ᶜρχₜ_diffusion = ᶜdivᵥ_ρχ(-(FT(0) * ᶠgradᵥ(ᶜχ))) | ||
@. ᶜρχₜ -= ᶜρχₜ_diffusion | ||
if !(χ_name in (:q_rai, :q_sno)) | ||
@. Yₜ.c.ρ -= ᶜρχₜ_diffusion | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters