Skip to content

Commit 29486b8

Browse files
committed
turn p.dt into an FT
1 parent 80c5d90 commit 29486b8

File tree

13 files changed

+29
-32
lines changed

13 files changed

+29
-32
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ steps:
12811281
CLIMACOMMS_DEVICE: "CUDA"
12821282
CLIMA_NAME_CUDA_KERNELS_FROM_STACK_TRACE: "true"
12831283
agents:
1284-
slurm_mem: 32GB
1284+
slurm_mem: 24GB
12851285
slurm_gpus: 1
12861286

12871287
- group: "Flame graphs"

post_processing/jacobian_summary.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function print_jacobian_summary(integrator)
1919

2020
FT = eltype(Y)
2121
γs = filter(!iszero, CA.LinearAlgebra.diag(tableau_coefficients))
22-
dtγ = FT(dt) * FT(γs[end])
22+
dtγ = dt * FT(γs[end])
2323
scalar_names = CA.scalar_field_names(Y)
2424
block_keys = Iterators.product(scalar_names, scalar_names)
2525

src/cache/cache.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
struct AtmosCache{
2-
TT,
2+
FT,
33
AM,
44
NUM,
55
CAP,
@@ -20,7 +20,7 @@ struct AtmosCache{
2020
CONSCHECK,
2121
}
2222
"""Timestep of the simulation (in seconds). This is also used by callbacks and tendencies"""
23-
dt::TT
23+
dt::FT
2424

2525
"""AtmosModel"""
2626
atmos::AM
@@ -94,6 +94,7 @@ function build_cache(
9494
)
9595
(; dt, start_date, output_dir) = sim_info
9696
FT = eltype(params)
97+
dt = FT(dt)
9798

9899
ᶜcoord = Fields.local_geometry_field(Y.c).coordinates
99100
ᶠcoord = Fields.local_geometry_field(Y.f).coordinates

src/cache/diagnostic_edmf_precomputed_quantities.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!(
449449
ᶜdz = Fields.Δz_field(axes(Y.c))
450450
(; params) = p
451451
(; dt) = p
452-
dt = FT(dt)
453452
(; ᶜΦ, ᶜgradᵥ_ᶠΦ) = p.core
454453
(; ᶜp, ᶠu³, ᶜts, ᶜK) = p.precomputed
455454
(;

src/cache/precipitation_precomputed_quantities.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,6 @@ sources from the sub-domains.
580580
set_precipitation_cache!(Y, p, _, _) = nothing
581581
function set_precipitation_cache!(Y, p, ::Microphysics0Moment, _)
582582
(; params, dt) = p
583-
FT = eltype(p.params)
584-
dt = FT(dt)
585583
(; ᶜts) = p.precomputed
586584
(; ᶜS_ρq_tot, ᶜS_ρe_tot) = p.precomputed
587585
(; ᶜΦ) = p.core

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
283283
buoyancy_flux_val < 0 || ᶜaʲ_int_val >= $(FT(turbconv_params.surface_area)),
284284
entr_int_val,
285285
detr_int_val +
286-
($(FT(turbconv_params.surface_area)) / ᶜaʲ_int_val - 1) / FT(dt),
286+
($(FT(turbconv_params.surface_area)) / ᶜaʲ_int_val - 1) / dt,
287287
),
288288
ᶜaʲ_int_val,
289289
dt,

src/callbacks/callbacks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
128128
Y = integrator.u
129129
p = integrator.p
130130
t = integrator.t
131-
131+
FT = eltype(Y)
132132
(; params) = p
133133
(; ᶠradiation_flux, rrtmgp_model) = p.radiation
134134
(; radiation_mode) = p.atmos
@@ -138,7 +138,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
138138
set_insolation_variables!(Y, p, t, p.atmos.insolation)
139139
set_surface_albedo!(Y, p, t, p.atmos.surface_albedo)
140140

141-
RRTMGPI.update_fluxes!(rrtmgp_model, UInt32(floor(t / integrator.p.dt)))
141+
RRTMGPI.update_fluxes!(rrtmgp_model, UInt32(floor(FT(t) / integrator.p.dt)))
142142
Fields.field2array(ᶠradiation_flux) .= rrtmgp_model.face_flux
143143
return nothing
144144
end

src/parameterized_tendencies/microphysics/microphysics_wrappers.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ end
2525
# Helper function to compute the limit of the tendency in the traingle limiter.
2626
# The limit is defined as the available amont / n times model time step.
2727
function limit(q, dt, n::Int)
28-
FT = eltype(q)
29-
return q / FT(dt) / n
28+
return q / dt / n
3029
end
3130

3231
function moisture_fixer(q, qᵥ, dt)
3332
FT = eltype(q)
3433
return triangle_inequality_limiter(
35-
-min(FT(0), q / FT(dt)),
36-
limit(qᵥ, FT(dt), 5),
34+
-min(FT(0), q / dt),
35+
limit(qᵥ, dt, 5),
3736
FT(0),
3837
)
3938
end
@@ -161,10 +160,9 @@ Returns the qₜ source term due to precipitation formation
161160
defined as Δm_tot / (m_dry + m_tot) for the 0-moment scheme
162161
"""
163162
function q_tot_0M_precipitation_sources(thp, cmp::CMP.Parameters0M, dt, qₜ, ts)
164-
FT = eltype(qₜ)
165163
return -triangle_inequality_limiter(
166164
-CM0.remove_precipitation(cmp, PP(thp, ts)),
167-
qₜ / FT(dt),
165+
qₜ / dt,
168166
)
169167
end
170168

@@ -570,7 +568,7 @@ function aerosol_activation_sources(
570568
return ifelse(
571569
S_max < S || isnan(n_act) || n_act < nₗ,
572570
FT(0),
573-
(n_act - nₗ) / FT(dt),
571+
(n_act - nₗ) / dt,
574572
)
575573
end
576574

src/prognostic_equations/edmfx_entr_detr.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ function edmfx_first_interior_entr_tendency!(
664664
sgsʲs_ρaₜ_int_val = Fields.field_values(Fields.level(Yₜ.c.sgsʲs.:($j).ρa, 1))
665665
@. sgsʲs_ρaₜ_int_val += ifelse(buoyancy_flux_val < 0,
666666
0,
667-
max(0, (sgsʲs_ρ_int_val * $(eps(FT)) - sgsʲs_ρa_int_val) / FT(dt)),
667+
max(0, (sgsʲs_ρ_int_val * $(eps(FT)) - sgsʲs_ρa_int_val) / dt),
668668
)
669669

670670
# Apply entrainment tendencies in the first model cell for moist static energy (mse)
@@ -718,16 +718,16 @@ end
718718
limit_entrainment(entr::FT, a, dt) where {FT} = max(
719719
min(
720720
entr,
721-
FT(0.9) * (1 - a) / max(a, eps(FT)) / FT(dt),
722-
FT(0.9) * 1 / FT(dt),
721+
FT(0.9) * (1 - a) / max(a, eps(FT)) / dt,
722+
FT(0.9) * 1 / dt,
723723
),
724724
0,
725725
)
726726
limit_detrainment(detr::FT, a, dt) where {FT} =
727-
max(min(detr, FT(0.9) * 1 / FT(dt)), 0)
727+
max(min(detr, FT(0.9) * 1 / dt), 0)
728728

729729
function limit_turb_entrainment(dyn_entr::FT, turb_entr, dt) where {FT}
730-
return max(min((FT(0.9) * 1 / FT(dt)) - dyn_entr, turb_entr), 0)
730+
return max(min((FT(0.9) * 1 / dt) - dyn_entr, turb_entr), 0)
731731
end
732732

733733
# limit entrainment and detrainment rates for diagnostic EDMF

src/prognostic_equations/edmfx_sgs_flux.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ function edmfx_sgs_diffusive_flux_tendency!(
448448
ᶜtke⁰,
449449
ᶜmixing_length_field,
450450
),
451-
Y.c.sgs⁰.ρatke / FT(dt),
451+
Y.c.sgs⁰.ρatke / dt,
452452
)
453453
end
454454
if !(p.atmos.moisture_model isa DryModel)
@@ -595,7 +595,7 @@ function edmfx_sgs_diffusive_flux_tendency!(
595595
ᶜtke⁰,
596596
ᶜmixing_length_field,
597597
),
598-
Y.c.sgs⁰.ρatke / FT(dt),
598+
Y.c.sgs⁰.ρatke / dt,
599599
)
600600
end
601601

0 commit comments

Comments
 (0)