Skip to content

Commit

Permalink
generalize for general initial time
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert committed Oct 11, 2023
1 parent c1ce0f9 commit 0a279e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/callbacks_step/alive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ function (alive_callback::AliveCallback)(integrator)
println()
elseif mpi_isroot()
t = integrator.t
t_initial = first(integrator.sol.prob.tspan)
t_final = last(integrator.sol.prob.tspan)
sim_time_percentage = t / t_final * 100
sim_time_percentage = (t - t_initial) / (t_final - t_initial) * 100
runtime_absolute = 1.0e-9 * (time_ns() - alive_callback.start_time)
println(rpad(@sprintf("#timesteps: %6d │ Δt: %.4e │ sim. time: %.4e (%5.3f%%)",
integrator.stats.naccept, integrator.dt, t,
Expand Down
4 changes: 3 additions & 1 deletion src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi)
iter = integrator.stats.naccept

# Compute the percentage of the simulation that is done
t = integrator.t
t_initial = first(integrator.sol.prob.tspan)
t_final = last(integrator.sol.prob.tspan)
sim_time_percentage = t / t_final * 100
sim_time_percentage = (t - t_initial) / (t_final - t_initial) * 100

# Record performance measurements and compute performance index (PID)
runtime_since_last_analysis = 1.0e-9 * (time_ns() -
Expand Down

0 comments on commit 0a279e1

Please sign in to comment.