diff --git a/src/cache/cache.jl b/src/cache/cache.jl index 510d096d0b4..e22dc629ae2 100644 --- a/src/cache/cache.jl +++ b/src/cache/cache.jl @@ -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)) @@ -57,7 +55,6 @@ function build_cache(Y, atmos, params, surface_setup, simulation) core = ( ᶜΦ, ᶠgradᵥ_ᶜΦ = ᶠgradᵥ.(ᶜΦ), - ᶠΦ, ᶜρ_ref, ᶜp_ref, ᶜT = similar(Y.c, FT), diff --git a/src/prognostic_equations/advection.jl b/src/prognostic_equations/advection.jl index c01fdab943c..68e4b94e59c 100644 --- a/src/prognostic_equations/advection.jl +++ b/src/prognostic_equations/advection.jl @@ -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 @@ -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(