Skip to content

Commit 3ac4307

Browse files
Try revised version of tracer_names
1 parent aef46a5 commit 3ac4307

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/ClimaAtmos.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import LinearAlgebra
66
import NullBroadcasts: NullBroadcasted
77
import LazyBroadcast
88
import LazyBroadcast: lazy
9+
import ClimaCore.MatrixFields: @name
910
import Thermodynamics as TD
1011
import Thermodynamics
1112

src/utils/utilities.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ import ClimaComms
55
import ClimaCore: Spaces, Topologies, Fields, Geometry
66
import LinearAlgebra: norm_sqr
77

8-
is_energy_var(symbol) = symbol in (:ρe_tot, :ρae_tot)
9-
is_momentum_var(symbol) = symbol in (:uₕ, :ρuₕ, :u₃, :ρw)
10-
is_turbconv_var(symbol) = symbol in (:turbconv, :sgsʲs, :sgs⁰)
11-
is_tracer_var(symbol) = !(
12-
symbol == ||
13-
symbol == :ρa ||
14-
is_energy_var(symbol) ||
15-
is_momentum_var(symbol) ||
16-
is_turbconv_var(symbol)
8+
is_energy_var(name) = name in (@name(ρe_tot), @name(ρae_tot))
9+
is_momentum_var(name) = name in (@name(uₕ), @name(ρuₕ), @name(u₃), @name(ρw))
10+
is_turbconv_var(name) = name in (@name(turbconv), @name(sgsʲs), @name(sgs⁰))
11+
is_tracer_var(name) = !(
12+
name == @name(ρ) ||
13+
name == @name(ρa) ||
14+
is_energy_var(name) ||
15+
is_momentum_var(name) ||
16+
is_turbconv_var(name)
1717
)
1818

19+
is_tracer_var(symbol::Symbol) = is_tracer_var(@name(symbol))
20+
1921
# we may be hitting a slow path:
2022
# https://stackoverflow.com/questions/14687665/very-slow-stdpow-for-bases-very-close-to-1
2123
fast_pow(x, y) = exp(y * log(x))

src/utils/variable_manipulations.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ Returns:
6868
- A `Tuple` of `ClimaCore.MatrixFields.FieldName`s corresponding to the tracers.
6969
"""
7070
tracer_names(field) =
71-
unrolled_filter(MatrixFields.top_level_names(field)) do name
72-
!(name in (@name(ρ), @name(ρe_tot), @name(uₕ)))
73-
end
71+
unrolled_filter(is_tracer_var, MatrixFields.top_level_names(field))
7472

7573
"""
7674
foreach_tracer(f::F, Yₜ, Y) where {F}

0 commit comments

Comments
 (0)