From c720137eeaf2f7c324e9606b609e2630546a7fb7 Mon Sep 17 00:00:00 2001 From: Ben Wilfong <48168887+wilfonba@users.noreply.github.com> Date: Fri, 3 Apr 2026 09:21:27 -0400 Subject: [PATCH 1/2] add ETA print to time-step output --- src/post_process/m_start_up.fpp | 20 ++++++++++++++++---- src/post_process/p_main.fpp | 10 ++++++++-- src/simulation/m_start_up.fpp | 21 ++++++++++++++++----- src/simulation/m_time_steppers.fpp | 14 +++++++++++--- 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/post_process/m_start_up.fpp b/src/post_process/m_start_up.fpp index 74a15d04db..638ce37722 100644 --- a/src/post_process/m_start_up.fpp +++ b/src/post_process/m_start_up.fpp @@ -201,17 +201,29 @@ contains impure subroutine s_perform_time_step(t_step) integer, intent(inout) :: t_step + + integer :: eta_hh, eta_mm, eta_ss + real(wp) :: eta_sec + if (proc_rank == 0) then if (cfl_dt) then - print '(" [", I3, "%] Saving ", I8, " of ", I0, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, "")', & + eta_sec = wall_time_avg*real(n_save - t_step, wp) + eta_hh = int(eta_sec)/3600 + eta_mm = mod(int(eta_sec), 3600)/60 + eta_ss = mod(int(eta_sec), 60) + print '(" [", I3, "%] Saving ", I8, " of ", I0, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, " ETA (HH:MM:SS) = ", I0, ":", I2.2, ":", I2.2)', & int(ceiling(100._wp*(real(t_step - n_start)/(n_save)))), & - t_step, n_save, wall_time_avg, wall_time + t_step, n_save, wall_time_avg, wall_time, eta_hh, eta_mm, eta_ss else - print '(" [", I3, "%] Saving ", I8, " of ", I0, " @ t_step = ", I8, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, "")', & + eta_sec = wall_time_avg*real((t_step_stop - t_step)/t_step_save + 1, wp) + eta_hh = int(eta_sec)/3600 + eta_mm = mod(int(eta_sec), 3600)/60 + eta_ss = mod(int(eta_sec), 60) + print '(" [", I3, "%] Saving ", I8, " of ", I0, " @ t_step = ", I8, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, " ETA (HH:MM:SS) = ", I0, ":", I2.2, ":", I2.2)', & int(ceiling(100._wp*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), & (t_step - t_step_start)/t_step_save + 1, & (t_step_stop - t_step_start)/t_step_save + 1, & - t_step, wall_time_avg, wall_time + t_step, wall_time_avg, wall_time, eta_hh, eta_mm, eta_ss end if end if diff --git a/src/post_process/p_main.fpp b/src/post_process/p_main.fpp index b8980ac012..7ccc5c502d 100644 --- a/src/post_process/p_main.fpp +++ b/src/post_process/p_main.fpp @@ -27,6 +27,7 @@ program p_main real(wp) :: c real(wp) :: H real(wp) :: start, finish + integer :: nt_step call s_initialize_mpi_domain() @@ -60,8 +61,13 @@ program p_main wall_time = abs(finish - start) - if (t_step >= 2) then - wall_time_avg = (wall_time + (t_step - 2)*wall_time_avg)/(t_step - 1) + if (cfl_dt) then + nt_step = t_step - n_start + 1 + else + nt_step = (t_step - t_step_start)/t_step_save + 1 + end if + if (nt_step >= 2) then + wall_time_avg = (wall_time + (nt_step - 2)*wall_time_avg)/(nt_step - 1) else wall_time_avg = 0._wp end if diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 925ad55db0..915830a4b8 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -790,7 +790,8 @@ contains integer, intent(inout) :: t_step real(wp), intent(inout) :: time_avg - integer :: i + integer :: i, eta_hh, eta_mm, eta_ss + real(wp) :: eta_sec if (cfl_dt) then if (cfl_const_dt .and. t_step == 0) call s_compute_dt() @@ -819,23 +820,33 @@ contains if (cfl_dt) then if (proc_rank == 0 .and. mod(t_step - t_step_start, t_step_print) == 0) then - print '(" [", I3, "%] Time ", ES16.6, " dt = ", ES16.6, " @ Time Step = ", I8, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, "")', & + eta_sec = wall_time_avg*(t_stop - mytime)/max(dt, tiny(dt)) + eta_hh = int(eta_sec)/3600 + eta_mm = mod(int(eta_sec), 3600)/60 + eta_ss = mod(int(eta_sec), 60) + print '(" [", I3, "%] Time ", ES16.6, " dt = ", ES16.6, " @ Time Step = ", I8, " Time Avg = ", ES16.6, " Time/step = ", ES12.6, " ETA (HH:MM:SS) = ", I0, ":", I2.2, ":", I2.2)', & int(ceiling(100._wp*(mytime/t_stop))), & mytime, & dt, & t_step, & wall_time_avg, & - wall_time + wall_time, & + eta_hh, eta_mm, eta_ss end if else if (proc_rank == 0 .and. mod(t_step - t_step_start, t_step_print) == 0) then - print '(" [", I3, "%] Time step ", I8, " of ", I0, " @ t_step = ", I8, " Time Avg = ", ES12.6, " Time/step= ", ES12.6, "")', & + eta_sec = wall_time_avg*real(t_step_stop - t_step, wp) + eta_hh = int(eta_sec)/3600 + eta_mm = mod(int(eta_sec), 3600)/60 + eta_ss = mod(int(eta_sec), 60) + print '(" [", I3, "%] Time step ", I8, " of ", I0, " @ t_step = ", I8, " Time Avg = ", ES12.6, " Time/step= ", ES12.6, " ETA (HH:MM:SS) = ", I0, ":", I2.2, ":", I2.2)', & int(ceiling(100._wp*(real(t_step - t_step_start)/(t_step_stop - t_step_start + 1)))), & t_step - t_step_start + 1, & t_step_stop - t_step_start + 1, & t_step, & wall_time_avg, & - wall_time + wall_time, & + eta_hh, eta_mm, eta_ss end if end if diff --git a/src/simulation/m_time_steppers.fpp b/src/simulation/m_time_steppers.fpp index 2835055667..9c7937d70b 100644 --- a/src/simulation/m_time_steppers.fpp +++ b/src/simulation/m_time_steppers.fpp @@ -652,10 +652,18 @@ contains wall_time = abs(finish - start) - if (t_step >= 2) then - wall_time_avg = (wall_time + (t_step - 2)*wall_time_avg)/(t_step - 1) + if (cfl_dt) then + if (t_step >= 2) then + wall_time_avg = (wall_time + (t_step - 2)*wall_time_avg)/(t_step - 1) + else + wall_time_avg = 0._wp + end if else - wall_time_avg = 0._wp + if (t_step - t_step_start >= 2) then + wall_time_avg = (wall_time + (t_step - t_step_start - 2)*wall_time_avg)/(t_step - t_step_start - 1) + else + wall_time_avg = 0._wp + end if end if end subroutine s_tvd_rk From 00d3a2463b19d34676a7fdafc7628067665dff89 Mon Sep 17 00:00:00 2001 From: Ben Wilfong <48168887+wilfonba@users.noreply.github.com> Date: Fri, 3 Apr 2026 09:39:13 -0400 Subject: [PATCH 2/2] bug fixes from merge --- src/post_process/p_main.fpp | 2 +- src/simulation/m_start_up.fpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/post_process/p_main.fpp b/src/post_process/p_main.fpp index 49dce2fc03..64da30aa6b 100644 --- a/src/post_process/p_main.fpp +++ b/src/post_process/p_main.fpp @@ -10,7 +10,7 @@ program p_main implicit none - integer :: t_step !< Iterator for the main time-stepping loop + integer :: t_step, nt_step !< Iterator for the main time-stepping loop !> Generic storage for the name(s) of the flow variable(s) that will be added to the formatted database file(s) character(LEN=name_len) :: varname real(wp) :: pres diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 4bab2aa5c8..526259417f 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -613,7 +613,6 @@ contains real(wp) :: eta_sec integer, intent(inout) :: t_step real(wp), intent(inout) :: time_avg - integer :: i if (cfl_dt) then if (cfl_const_dt .and. t_step == 0) call s_compute_dt()