Skip to content

Commit

Permalink
Improve names
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Dec 15, 2023
1 parent a768974 commit 9410c6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
25 changes: 13 additions & 12 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,27 +476,28 @@ function print_walltime_estimate(integrator)
t = integrator.t
n_steps_total = ceil(Int, t_end / dt)
n_steps = ceil(Int, t / dt)
t_wall_ave_per_step = wte.∑Δt_wall / n_steps
twps = t_wall_ave_per_step
_twps = time_and_units(t_wall_ave_per_step)
wall_time_ave_per_step = wte.∑Δt_wall / n_steps
wall_time_ave_per_step_str = time_and_units_str(wall_time_ave_per_step)
percent_complete = round(t / t_end * 100; digits = 1)
n_steps_remaining = n_steps_total - n_steps
erwt = twps * n_steps_remaining
_erwt = time_and_units(erwt)
etwt = time_and_units(twps * n_steps_total)
spent = time_and_units(wte.∑Δt_wall)
t_sim = time_and_units(Float64(t))
wall_time_remaining = wall_time_ave_per_step * n_steps_remaining
wall_time_remaining_str = time_and_units_str(wall_time_remaining)
wall_time_total =
time_and_units_str(wall_time_ave_per_step * n_steps_total)
wall_time_spent = time_and_units_str(wte.∑Δt_wall)
simulation_time = time_and_units_str(Float64(t))
sypd = round(
simulated_years_per_day(
EfficiencyStats((zero(t), t), wte.∑Δt_wall),
);
digits = 3,
)
estimated_finish_date =
Dates.now() + compound_period(erwt, Dates.Second)
@info "Progress" simulation_time = t_sim n_steps_completed = n_steps wall_time_per_step =
_twps wall_time_total = etwt wall_time_remaining = erwt wall_time_spent =
spent percent_complete = "$percent_complete%" sypd = sypd date_now =
Dates.now() + compound_period(wall_time_remaining, Dates.Second)
@info "Progress" simulation_time = simulation_time n_steps_completed =
n_steps wall_time_per_step = wall_time_ave_per_step_str wall_time_total =
wall_time_total wall_time_remaining = wall_time_remaining_str wall_time_spent =
wall_time_spent percent_complete = "$percent_complete%" sypd = sypd date_now =
Dates.now() estimated_finish_date = estimated_finish_date
wte.n_next *= 2 # doubling factor (to reduce log noise)
end
Expand Down
5 changes: 3 additions & 2 deletions src/utils/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,13 @@ define_time_per_times([
])

"""
time_and_units(x::Real)
time_and_units_str(x::Real)
Returns a truncated string of time and units,
given a time `x` in Seconds.
"""
time_and_units(x::Real) = trunc_time(string(compound_period(x, Dates.Second)))
time_and_units_str(x::Real) =
trunc_time(string(compound_period(x, Dates.Second)))

"""
compound_period(x::Real, ::Type{T}) where {T <: Dates.Period}
Expand Down

0 comments on commit 9410c6e

Please sign in to comment.