From 5e53f8db64ac4e4f1b61a28bb30107c1111d0d75 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Thu, 21 Nov 2024 09:21:26 -0500 Subject: [PATCH] Eliminate subsidence cache --- src/cache/cache.jl | 4 ---- src/prognostic_equations/forcing/subsidence.jl | 17 +++-------------- test/coupler_compatibility.jl | 1 - 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/cache/cache.jl b/src/cache/cache.jl index 54c0513609..dde0f73a7b 100644 --- a/src/cache/cache.jl +++ b/src/cache/cache.jl @@ -17,7 +17,6 @@ struct AtmosCache{ RS, VS, PR, - SUB, LSAD, EXTFORCING, EDMFCOR, @@ -80,7 +79,6 @@ struct AtmosCache{ rayleigh_sponge::RS viscous_sponge::VS precipitation::PR - subsidence::SUB large_scale_advection::LSAD external_forcing::EXTFORCING edmf_coriolis::EDMFCOR @@ -188,7 +186,6 @@ function build_cache(Y, atmos, params, surface_setup, sim_info, aerosol_names) rayleigh_sponge = rayleigh_sponge_cache(Y, atmos) viscous_sponge = viscous_sponge_cache(Y, atmos) precipitation = precipitation_cache(Y, atmos) - subsidence = subsidence_cache(Y, atmos) large_scale_advection = large_scale_advection_cache(Y, atmos) external_forcing = external_forcing_cache(Y, atmos, params) edmf_coriolis = edmf_coriolis_cache(Y, atmos) @@ -217,7 +214,6 @@ function build_cache(Y, atmos, params, surface_setup, sim_info, aerosol_names) rayleigh_sponge, viscous_sponge, precipitation, - subsidence, large_scale_advection, external_forcing, edmf_coriolis, diff --git a/src/prognostic_equations/forcing/subsidence.jl b/src/prognostic_equations/forcing/subsidence.jl index 2901dadda1..11f688871c 100644 --- a/src/prognostic_equations/forcing/subsidence.jl +++ b/src/prognostic_equations/forcing/subsidence.jl @@ -7,26 +7,16 @@ import ClimaCore.Spaces as Spaces import ClimaCore.Fields as Fields import ClimaCore.Operators as Operators -subsidence_cache(Y, atmos::AtmosModel) = subsidence_cache(Y, atmos.subsidence) - ##### ##### No subsidence ##### -subsidence_cache(Y, ::Nothing) = (;) subsidence_tendency!(Yₜ, Y, p, t, ::Nothing) = nothing ##### ##### Subsidence ##### -function subsidence_cache(Y, ::Subsidence) - FT = Spaces.undertype(axes(Y.f)) - return (; - ᶠsubsidence = similar(Y.f, FT), # TODO: fix types - ) -end - subsidence!(ᶜρχₜ, ᶜρ, ᶠu³, ᶜχ, ::Val{:none}) = @. ᶜρχₜ -= ᶜρ * (ᶜsubdivᵥ(ᶠu³ * ᶠinterp(ᶜχ)) - ᶜχ * ᶜsubdivᵥ(ᶠu³)) subsidence!(ᶜρχₜ, ᶜρ, ᶠu³, ᶜχ, ::Val{:first_order}) = @@ -37,14 +27,13 @@ subsidence!(ᶜρχₜ, ᶜρ, ᶠu³, ᶜχ, ::Val{:third_order}) = function subsidence_tendency!(Yₜ, Y, p, t, ::Subsidence) (; moisture_model) = p.atmos subsidence_profile = p.atmos.subsidence.prof - (; ᶠsubsidence) = p.subsidence (; ᶜh_tot, ᶜspecific) = p.precomputed - ᶠz = Fields.coordinate_field(axes(ᶠsubsidence)).z + ᶠz = Fields.coordinate_field(axes(Y.f)).z ᶠlg = Fields.local_geometry_field(Y.f) - @. ᶠsubsidence = subsidence_profile(ᶠz) ᶠsubsidence³ = p.scratch.ᶠtemp_CT3 - @. ᶠsubsidence³ = ᶠsubsidence * CT3(unit_basis_vector_data(CT3, ᶠlg)) + @. ᶠsubsidence³ = + subsidence_profile(ᶠz) * CT3(unit_basis_vector_data(CT3, ᶠlg)) # LS Subsidence subsidence!(Yₜ.c.ρe_tot, Y.c.ρ, ᶠsubsidence³, ᶜh_tot, Val{:first_order}()) diff --git a/test/coupler_compatibility.jl b/test/coupler_compatibility.jl index c36201caa2..311d31313e 100644 --- a/test/coupler_compatibility.jl +++ b/test/coupler_compatibility.jl @@ -83,7 +83,6 @@ const T2 = 290 p.rayleigh_sponge, p.viscous_sponge, p.precipitation, - p.subsidence, p.large_scale_advection, p.external_forcing, p.edmf_coriolis,