Skip to content

Commit

Permalink
allow initial time not equal to 0 for simulation percentage (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert authored Oct 13, 2023
1 parent 2d8e6fe commit eb46f7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ function (analysis_callback::AnalysisCallback)(io, u_ode, integrator, semi)
@unpack analysis_errors, analysis_integrals, tstops, errors, integrals = analysis_callback
@unpack t, dt = integrator
push!(tstops, t)
t_final = integrator.sol.prob.tspan[2]
t_initial = first(integrator.sol.prob.tspan)
t_final = last(integrator.sol.prob.tspan)
sim_time_percentage = (t - t_initial) / (t_final - t_initial) * 100
iter = integrator.stats.naccept

# Compute the total runtime since the analysis callback has been initialized, in seconds
Expand Down Expand Up @@ -237,7 +239,7 @@ function (analysis_callback::AnalysisCallback)(io, u_ode, integrator, semi)
" " *
" └── GC time: " *
@sprintf("%10.8e s (%5.3f%%)", gc_time_absolute, gc_time_percentage))
println(io, " sim. time: " * @sprintf("%10.8e (%5.3f%%)", t, t / t_final*100))
println(io, " sim. time: " * @sprintf("%10.8e (%5.3f%%)", t, sim_time_percentage))
println(io,
" #DOF: " * @sprintf("% 14d", nnodes(semi)) *
" " *
Expand Down

0 comments on commit eb46f7e

Please sign in to comment.