From 0a279e15ff9fe6a09ea093ae8fe467424e61ed3f Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Wed, 11 Oct 2023 14:38:23 +0200 Subject: [PATCH] generalize for general initial time --- src/callbacks_step/alive.jl | 3 ++- src/callbacks_step/analysis.jl | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/callbacks_step/alive.jl b/src/callbacks_step/alive.jl index 8ea637a30fa..9df7181521e 100644 --- a/src/callbacks_step/alive.jl +++ b/src/callbacks_step/alive.jl @@ -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, diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 02483fc31d5..e5b4a01a885 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -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() -