Skip to content

Commit

Permalink
Merge pull request #369 from SpeedyWeather/mk/speedstring
Browse files Browse the repository at this point in the history
Speedstring precompilation warning
  • Loading branch information
milankl authored Aug 30, 2023
2 parents 190e646 + 3e16ef7 commit 1564fe9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/dynamics/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ except for `model.output` and `model.feedback` which are always called
at in `time_stepping!`."""
function initialize!(model::Barotropic)
(;spectral_grid,forcing,horizontal_diffusion) = model

spectral_grid.nlev > 1 && @warn "Only nlev=1 supported for BarotropicModel, \
SpectralGrid with nlev=$(spectral_grid.nlev) provided."

initialize!(forcing,model)
initialize!(horizontal_diffusion,model)

Expand Down Expand Up @@ -109,6 +113,9 @@ function initialize!(model::ShallowWater)
(;spectral_grid,forcing,horizontal_diffusion,
orography,planet,spectral_transform,geometry) = model

spectral_grid.nlev > 1 && @warn "Only nlev=1 supported for ShallowWaterModel, \
SpectralGrid with nlev=$(spectral_grid.nlev) provided."

initialize!(forcing,model)
initialize!(horizontal_diffusion,model)
initialize!(orography,planet,spectral_transform,geometry)
Expand Down
8 changes: 5 additions & 3 deletions src/output/feedback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ end
# constant from the ProgressMeter module
const DT_IN_SEC = Ref(1800)

# overwrite the speedstring function from ProgressMeter
function ProgressMeter.speedstring(sec_per_iter,dt_in_sec=SpeedyWeather.DT_IN_SEC)
speedstring(sec_per_iter,dt_in_sec[])
# "extend" the speedstring function from ProgressMeter by defining it for ::AbstractFloat
# not just ::Any to effectively overwrite it
function ProgressMeter.speedstring(sec_per_iter::AbstractFloat)
dt_in_sec = SpeedyWeather.DT_IN_SEC[] # pull global "constant"
speedstring(sec_per_iter,dt_in_sec)
end

"""
Expand Down

0 comments on commit 1564fe9

Please sign in to comment.