Skip to content

Commit

Permalink
use temporary cache
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Nov 9, 2023
1 parent 6a4ec3b commit 75ee02b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/cache/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ function build_cache(Y, atmos, params, surface_setup, simulation)
FT = eltype(params)

ᶜcoord = Fields.local_geometry_field(Y.c).coordinates
ᶠcoord = Fields.local_geometry_field(Y.f).coordinates
grav = FT(CAP.grav(params))
ᶜΦ = grav .* ᶜcoord.z
ᶠΦ = grav .* ᶠcoord.z

if atmos.numerics.use_reference_state
R_d = FT(CAP.R_d(params))
Expand Down Expand Up @@ -57,7 +55,6 @@ function build_cache(Y, atmos, params, surface_setup, simulation)
core = (
ᶜΦ,
ᶠgradᵥ_ᶜΦ = ᶠgradᵥ.(ᶜΦ),
ᶠΦ,
ᶜρ_ref,
ᶜp_ref,
ᶜT = similar(Y.c, FT),
Expand Down
8 changes: 7 additions & 1 deletion src/prognostic_equations/advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
n = n_prognostic_mass_flux_subdomains(turbconv_model)
advect_tke = use_prognostic_tke(turbconv_model)
point_type = eltype(Fields.coordinate_field(Y.c))
(; params) = p
(; dt) = p.simulation
ᶜJ = Fields.local_geometry_field(Y.c).J
(; ᶜf, ᶠΦ) = p.core
(; ᶜf, ᶜΦ) = p.core
(; ᶜu, ᶠu³, ᶜK) = p.precomputed
(; edmfx_upwinding) = n > 0 || advect_tke ? p.atmos.numerics : all_nothing
(; ᶜp, ᶜuʲs, ᶠu³ʲs, ᶜKʲs, ᶜρʲs) = n > 0 ? p.precomputed : all_nothing
Expand Down Expand Up @@ -110,6 +111,11 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
end
# Without the CT12(), the right-hand side would be a CT1 or CT2 in 2D space.

ᶠcoord = Fields.local_geometry_field(Y.f).coordinates
grav = FT(CAP.grav(params))
ᶠΦ = p.scratch.ᶠtemp_scalar
ᶠΦ = grav .* ᶠcoord.z

Fields.bycolumn(axes(Y.c)) do colidx
@. Yₜ.c.uₕ[colidx] -=
ᶜinterp(
Expand Down

0 comments on commit 75ee02b

Please sign in to comment.