Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make KE functional #3489

Merged
merged 1 commit into from
Dec 21, 2024
Merged
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
41 changes: 18 additions & 23 deletions src/cache/diagnostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,26 @@ import NVTX
import Thermodynamics as TD
import ClimaCore: Spaces, Fields, RecursiveApply

NVTX.@annotate function kinetic_energy!(
K_level,
@inline function kinetic_energy(
uₕ_level,
u³_halflevel,
local_geometry_level,
local_geometry_halflevel,
)
@. K_level =
(
dot(
C123(uₕ_level, local_geometry_level),
CT123(uₕ_level, local_geometry_level),
) +
dot(
C123(u³_halflevel, local_geometry_halflevel),
CT123(u³_halflevel, local_geometry_halflevel),
) +
2 * dot(
CT123(uₕ_level, local_geometry_level),
C123(u³_halflevel, local_geometry_halflevel),
)
) / 2
return (
dot(
C123(uₕ_level, local_geometry_level),
CT123(uₕ_level, local_geometry_level),
) +
dot(
C123(u³_halflevel, local_geometry_halflevel),
CT123(u³_halflevel, local_geometry_halflevel),
) +
2 * dot(
CT123(uₕ_level, local_geometry_level),
C123(u³_halflevel, local_geometry_halflevel),
)
) / 2
end

NVTX.@annotate function set_diagnostic_edmfx_draft_quantities_level!(
Expand Down Expand Up @@ -71,8 +69,7 @@ NVTX.@annotate function set_diagnostic_edmfx_env_quantities_level!(
ρ_level,
turbconv_model,
)
kinetic_energy!(
K⁰_level,
@. K⁰_level = kinetic_energy(
uₕ_level,
u³⁰_halflevel,
local_geometry_level,
Expand Down Expand Up @@ -177,8 +174,7 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_bottom_bc!(
local_geometry_int_halflevel,
)

kinetic_energy!(
Kʲ_int_level,
@. Kʲ_int_level = kinetic_energy(
uₕ_int_level,
u³ʲ_int_halflevel,
local_geometry_int_level,
Expand Down Expand Up @@ -798,8 +794,7 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!(
)
end

kinetic_energy!(
Kʲ_level,
@. Kʲ_level = kinetic_energy(
uₕ_level,
u³ʲ_halflevel,
local_geometry_level,
Expand Down
Loading