diff --git a/sources/system.F90 b/sources/system.F90 index 72bca69..d0b691b 100644 --- a/sources/system.F90 +++ b/sources/system.F90 @@ -420,13 +420,15 @@ module system ! subroutine evolve_system(verbose, status) - use blocks , only : get_nleafs - use evolution, only : step, time, dt, errtol - use evolution, only : advance, new_time_step - use helpers , only : print_message - use io , only : update_dtp, write_restart_snapshot - use mpitools , only : check_status - use timers , only : get_timer_total + use blocks , only : get_nleafs + use evolution , only : step, time, dt + use evolution , only : error_control, errtol, nrejections + use evolution , only : advance, new_time_step + use helpers , only : print_message + use io , only : update_dtp, write_restart_snapshot + use iso_fortran_env, only : output_unit + use mpitools , only : check_status + use timers , only : get_timer_total implicit none @@ -435,34 +437,45 @@ module system logical :: proceed = .true. integer :: ed = 9999, eh = 23, em = 59, es = 59 - real(kind=8) :: thrs = 0.0d+00, tprn = 0.0d+00 + real(kind=8) :: thrs = 0.0d+00, tprn = 0.0d+00, ss = 0.0d+00 real(kind=8), dimension(8) :: tsim = 0.0d+00, tclc = 0.0d+00 + character(len=132) :: hfmt, sfmt + character(len=*), parameter :: loc = 'SYSTEM::evolve_system()' !------------------------------------------------------------------------------- ! status = 0 + hfmt = "('" // achar(10) // "',1x,'Evolving the system:','" // achar(10) //& + "',5x,'step',4x,'time',10x,'timestep',2x," + sfmt = "(i9,2(1x,1es13.6)," + if (error_control) then + hfmt = adjustl(trim(hfmt)) // "3x,'err/tol',2x,'nrejs'," + sfmt = adjustl(trim(sfmt)) // "1x,1es9.2,1x,i6," + end if + hfmt = adjustl(trim(hfmt)) // "4x,'blocks',4x,'completed in')" + sfmt = adjustl(trim(sfmt)) // & + "1x,i9,2x,1i4.1,'d',1i2.2,'h',1i2.2,'m',1i2.2,'s'," // & + "15x,'" // achar(13) // "')" + if (verbose) then tsim(:) = time tclc(:) = get_timer_total() - write(*,*) - write(*,"(1x,a)" ) "Evolving the system:" - write(*,"(4x,'step',5x,'time',11x,'timestep',6x,'err/tol',4x," // & - "'blocks',2x,'time to complete')") -#ifdef __INTEL_COMPILER - write(*,"(i8,2(1x,1es14.6),1x,1es10.2,2x,i8,3x," // & - "1i4.1,'d',1i2.2,'h',1i2.2,'m',1i2.2,'s',15x,a1,$)") & - step, time, dt, errtol, get_nleafs(), ed, eh, em, es, char(13) -#else /* __INTEL_COMPILER */ - write(*,"(i8,2(1x,1es14.6),1x,1es10.2,2x,i8,3x," // & - "1i4.1,'d',1i2.2,'h',1i2.2,'m',1i2.2,'s',15x,a1)",advance="no") & - step, time, dt, errtol, get_nleafs(), ed, eh, em, es, char(13) -#endif /* __INTEL_COMPILER */ + write(output_unit, hfmt) + if (error_control) then + write(output_unit, sfmt, advance="no") step, time, dt, & + errtol, nrejections, & + get_nleafs(), ed, eh, em, es + else + write(output_unit, sfmt, advance="no") step, time, dt, & + get_nleafs(), ed, eh, em, es + end if + flush(output_unit) end if @@ -496,8 +509,7 @@ module system call print_message(loc, "Could not store the restart snapshot!") if (check_status(status /= 0)) return - proceed = (nsteps <= nmax) .and. (time < tmax) .and. & - (thrs <= trun) + proceed = (nsteps <= nmax) .and. (time < tmax) .and. (thrs <= trun) #ifdef SIGNALS proceed = proceed .and. .not. check_status(quit /= 0) #endif /* SIGNALS */ @@ -510,9 +522,9 @@ module system if (time >= tmax .or. (tclc(8) - tprn) >= 1.0d+00) then - es = int((tclc(8) - tclc(1)) * (tmax - time) / & - max(1.0d-08 * tmax, time - tsim(1)), kind = 4) - es = max(0, min(863999999, es)) + ss = (tclc(8) - tclc(1)) * ((tmax - time) / & + max(1.0d-08 * tmax, time - tsim(1))) + es = int(max(0.0d+00, min(8.63999999d+08, ss)), kind=4) ed = es / 86400 es = mod(es, 86400) eh = es / 3600 @@ -520,15 +532,15 @@ module system em = es / 60 es = mod(es, 60) -#ifdef __INTEL_COMPILER - write(*,"(i8,2(1x,1es14.6),1x,1es10.2,2x,i8,3x,1i4.1," // & - "'d',1i2.2,'h',1i2.2,'m',1i2.2,'s',15x,a1,$)") & - step, time, dt, errtol, get_nleafs(), ed, eh, em, es, char(13) -#else /* __INTEL_COMPILER */ - write(*,"(i8,2(1x,1es14.6),1x,1es10.2,2x,i8,3x,1i4.1," // & - "'d',1i2.2,'h',1i2.2,'m',1i2.2,'s',15x,a1)",advance="no") & - step, time, dt, errtol, get_nleafs(), ed, eh, em, es, char(13) -#endif /* __INTEL_COMPILER */ + if (error_control) then + write(output_unit, sfmt, advance="no") step, time, dt, & + errtol, nrejections, & + get_nleafs(), ed, eh, em, es + else + write(output_unit, sfmt, advance="no") step, time, dt, & + get_nleafs(), ed, eh, em, es + end if + flush(output_unit) tprn = tclc(8) end if