Skip to content

Commit

Permalink
Call SPQ in step, remove from callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Oct 4, 2023
1 parent 68c34b7 commit 173f74a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
1 change: 0 additions & 1 deletion post_processing/post_processing_funcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ function postprocessing_plane(sol, output_dir, p)
)

Y = sol.u[end]
CA.set_precomputed_quantities!(Y, p, sol.t[end]) # sets ᶜts and ᶜu

## Plots for last timestep
function gen_plot_plane(
Expand Down
5 changes: 0 additions & 5 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ NVTX.@annotate function turb_conv_affect_filter!(integrator)
Y = integrator.u
tc_params = CAP.turbconv_params(param_set)

set_precomputed_quantities!(Y, p, t) # sets ᶜts for set_edmf_surface_bc
Fields.bycolumn(axes(Y.c)) do colidx
state = TC.tc_column_state(Y, p, nothing, colidx, t)
grid = TC.Grid(state)
Expand All @@ -76,8 +75,6 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
p = integrator.p
t = integrator.t

set_precomputed_quantities!(Y, p, t) # sets ᶜts and sfc_conditions

(; ᶜts, sfc_conditions, params, env_thermo_quad) = p
(; idealized_insolation, idealized_h2o, idealized_clouds) = p
(; insolation_tuple, ᶠradiation_flux, radiation_model) = p
Expand Down Expand Up @@ -255,8 +252,6 @@ NVTX.@annotate function compute_diagnostics(integrator)
FT = eltype(params)
thermo_params = CAP.thermodynamics_params(params)

set_precomputed_quantities!(Y, p, t) # sets ᶜu, ᶜK, ᶜts, ᶜp, & SGS analogues

(; ᶜu, ᶜK, ᶜts, ᶜp, sfc_conditions) = p
dycore_diagnostic = (;
common_diagnostics(p, ᶜu, ᶜts)...,
Expand Down
10 changes: 1 addition & 9 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -895,20 +895,12 @@ function get_integrator(config::AtmosConfig)
diagnostic_callbacks =
call_every_n_steps(orchestrate_diagnostics, skip_first = true)

# We need to ensure the precomputed quantities are indeed precomputed

# TODO: Remove this when we can assume that the precomputed_quantities are in sync with
# the state
sync_precomputed = call_every_n_steps(
(int) -> set_precomputed_quantities!(int.u, int.p, int.t),
)

# The generic constructor for SciMLBase.CallbackSet has to split callbacks into discrete
# and continuous. This is not hard, but can introduce significant latency. However, all
# the callbacks in ClimaAtmos are discrete_callbacks, so we directly pass this
# information to the constructor
continuous_callbacks = tuple()
discrete_callbacks = (callback..., sync_precomputed, diagnostic_callbacks)
discrete_callbacks = (callback..., diagnostic_callbacks)

s = @timed_str begin
all_callbacks =
Expand Down
2 changes: 1 addition & 1 deletion src/time_stepper/hc_ars343.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ function CTS.step_u!(
@. u += dt * b_imp[3] * T_imp[3]
@. u += dt * b_imp[4] * T_imp[4]
dss!(u, p, t_final)
# post_explicit!(u, p, t_final)
post_explicit!(u, p, t_final)
return u
end

0 comments on commit 173f74a

Please sign in to comment.