Skip to content

Commit b06e174

Browse files
Improve names
1 parent 70f051f commit b06e174

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/parameterized_tendencies/les_sgs_models/smagorinsky_lilly.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function horizontal_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLill
107107
@. Yₜ.c.ρe_tot += wdivₕ(Y.c.ρ * ᶜD_smag * gradₕ(ᶜh_tot))
108108

109109
## Tracer diffusion and associated mass changes
110-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
110+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
111111
ᶜχ = @. lazy(specific(ᶜρχ, Y.c.ρ))
112112
ᶜρχₜ_diffusion = @. lazy(wdivₕ(Y.c.ρ * ᶜD_smag * gradₕ(ᶜχ)))
113113
@. ᶜρχₜ += ᶜρχₜ_diffusion
@@ -161,7 +161,7 @@ function vertical_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLilly)
161161
bottom = Operators.SetValue(C3(FT(0))),
162162
)
163163

164-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
164+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
165165
ᶜ∇ᵥρD∇χₜ = @. lazy(ᶜdivᵥ_ρχ(-(ᶠρ * ᶠD_smag * ᶠgradᵥ(specific(ᶜρχ, Y.c.ρ)))))
166166
@. ᶜρχₜ -= ᶜ∇ᵥρD∇χₜ
167167
# Rain and snow does not affect the mass

src/prognostic_equations/advection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
213213
ᶜρ = Y.c.ρ
214214

215215
# Full vertical advection of passive tracers (like liq, rai, etc) ...
216-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
216+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
217217
if !is_ρq_tot
218218
ᶜχ = @. lazy(specific(ᶜρχ, Y.c.ρ))
219219
vtt = vertical_transport(ᶜρ, ᶠu³, ᶜχ, float(dt), tracer_upwinding)

src/prognostic_equations/remaining_tendency.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ NVTX.@annotate function additional_tendency!(Yₜ, Y, p, t)
166166
@. Yₜ.c.ρe_tot += vst_ρe_tot
167167

168168
# TODO: can we write this out explicitly?
169-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
169+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
170170
ᶜχ = @. lazy(specific(ᶜρχ, Y.c.ρ))
171171
vst_tracer = viscous_sponge_tendency_tracer(ᶜρ, ᶜχ, viscous_sponge)
172172
@. ᶜρχₜ += vst_tracer

src/prognostic_equations/surface_flux.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function surface_flux_tendency!(Yₜ, Y, p, t)
115115
btt = boundary_tendency_scalar(ᶜh_tot, sfc_conditions.ρ_flux_h_tot)
116116
@. Yₜ.c.ρe_tot -= btt
117117
ρ_flux_χ = p.scratch.sfc_temp_C3
118-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
118+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
119119
ᶜχ = @. lazy(specific(ᶜρχ, Y.c.ρ))
120120
if is_ρq_tot
121121
@. ρ_flux_χ = sfc_conditions.ρ_flux_q_tot

src/prognostic_equations/vertical_diffusion_boundary_layer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function vertical_diffusion_boundary_layer_tendency!(
100100
top = Operators.SetValue(C3(0)),
101101
bottom = Operators.SetValue(C3(0)),
102102
)
103-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
103+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
104104
if ρχ_name in (:ρq_rai, :ρq_sno, :ρn_rai)
105105
@. ᶜK_h_scaled = α_vert_diff_tracer * ᶜK_h
106106
else

src/utils/variable_manipulations.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Arguments:
5454
end
5555

5656
"""
57-
scalar_names(field)
57+
tracer_names(field)
5858
5959
Filters and returns the names of the variables from a given state
6060
vector component, excluding `ρ`, `ρe_tot`, and `uₕ`
@@ -67,20 +67,20 @@ Returns:
6767
6868
- A `Tuple` of `ClimaCore.MatrixFields.FieldName`s corresponding to the tracers.
6969
"""
70-
scalar_names(field) =
70+
tracer_names(field) =
7171
unrolled_filter(MatrixFields.top_level_names(field)) do name
7272
!(name in (@name(ρ), @name(ρe_tot), @name(uₕ)))
7373
end
7474

7575
"""
76-
foreach_scalar(f::F, Yₜ, Y) where {F}
76+
foreach_tracer(f::F, Yₜ, Y) where {F}
7777
7878
Applies a given function `f` to each scalar variable (except `ρ` and `ρe_tot`)
7979
in the state `Y` and its corresponding tendency `Yₜ`.
8080
This utility abstracts the process of iterating over all scalars. It uses
81-
`scalar_names` to identify the relevant variables and `unrolled_foreach` to
82-
ensure a performant loop. For each tracer, it calls the provided function `f`
83-
with the tendency field, the state field, and a boolean flag indicating if
81+
`tracer_names` to identify the relevant variables and `unrolled_foreach` to
82+
ensure a performant loop. For each tracer, it calls the provided function `f`
83+
with the tendency field, the state field, and a boolean flag indicating if
8484
the current tracer is `ρq_tot` (to allow for special handling).
8585
8686
Arguments:
@@ -94,7 +94,7 @@ Arguments:
9494
# Example
9595
9696
```julia
97-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
97+
foreach_tracer(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
9898
# Apply some operation, e.g., a sponge layer
9999
@. ᶜρχₜ += some_sponge_function(ᶜρχ)
100100
if is_ρq_tot
@@ -103,8 +103,8 @@ foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
103103
end
104104
```
105105
"""
106-
foreach_scalar(f::F, Yₜ, Y) where {F} =
107-
unrolled_foreach(scalar_names(Y.c)) do scalar_name
106+
foreach_tracer(f::F, Yₜ, Y) where {F} =
107+
unrolled_foreach(tracer_names(Y.c)) do scalar_name
108108
ᶜρχₜ = MatrixFields.get_field(Yₜ.c, scalar_name)
109109
ᶜρχ = MatrixFields.get_field(Y.c, scalar_name)
110110
is_ρq_tot = scalar_name == @name(ρq_tot)

0 commit comments

Comments
 (0)