Skip to content

Commit f4592c3

Browse files
committed
Make nogw_callback no-op when there's no GW
The code crashes when one calls `nogw_model_callback` without turning on gravity waves. This commit changes it so that it will just be a no-op.
1 parent 52734d3 commit f4592c3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/callbacks/callbacks.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,11 @@ NVTX.@annotate function nogw_model_callback!(integrator)
407407
Y = integrator.u
408408
p = integrator.p
409409

410-
non_orographic_gravity_wave_compute_tendency!(Y, p)
410+
non_orographic_gravity_wave_compute_tendency!(
411+
Y,
412+
p,
413+
p.atmos.non_orographic_gravity_wave,
414+
)
411415
return nothing
412416
end
413417

src/parameterized_tendencies/gravity_wave_drag/non_orographic_gravity_wave.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ function non_orographic_gravity_wave_cache(Y, gw::NonOrographicGravityWave)
131131
end
132132
end
133133

134-
function non_orographic_gravity_wave_compute_tendency!(Y, p)
134+
non_orographic_gravity_wave_compute_tendency!(Y, p, ::Nothing) = nothing
135+
136+
function non_orographic_gravity_wave_compute_tendency!(
137+
Y,
138+
p,
139+
::NonOrographicGravityWave,
140+
)
135141
#unpack
136142
ᶜT = p.scratch.ᶜtemp_scalar
137143
(; ᶜts) = p.precomputed

0 commit comments

Comments
 (0)