Skip to content

Commit

Permalink
Merge pull request #86 from FluidNumerics/feature/wall-time-monitoring
Browse files Browse the repository at this point in the history
Add wall-time, wall-time per time step, sim-time/wall-time
  • Loading branch information
fluidnumerics-joe authored Nov 28, 2024
2 parents aa8ce58 + ea426a0 commit 4d8e6aa
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/SELF_Model.f90
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,58 @@ subroutine ForwardStep_Model(this,tn,dt,ioInterval)
! Local
real(prec) :: targetTime,tNext
integer :: i,nIO
character(10) :: ntimesteps
real(prec) :: t1,t2
character(len=:),allocatable :: str
character(len=20) :: modelTime

this%dt = dt
targetTime = tn

write(ntimesteps,"(I10)") int(ioInterval/this%dt)
nIO = int((targetTime-this%t)/ioInterval)
do i = 1,nIO

tNext = this%t+ioInterval
call cpu_time(t1)
call this%timeIntegrator(tNext)
call cpu_time(t2)

open(output_unit,ENCODING='utf-8')
write(output_unit,'(A)',ADVANCE='no') ' --------------------------------------------------------'
write(output_unit,'(A)',ADVANCE='yes') '----------------------------------------------------------------------- '
write(output_unit,'(A)',ADVANCE='no') ' <><><><><><><><><><><><><><><><><><><><><><><><><><><><>'
write(output_unit,'(A)',ADVANCE='yes') '<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> '
write(output_unit,'(A)',ADVANCE='no') ' --------------------------------------------------------'
write(output_unit,'(A)',ADVANCE='yes') '------------------------------------------------------------------------ '
write(modelTime,"(ES16.7E3)") this%t
! Write the wall-time
write(output_unit,'(1x, A," : ")',ADVANCE='no') __FILE__
str = 'tᵢ ='//trim(modelTime)
write(output_unit,'(A)',ADVANCE='no') str
str = ' | Time to complete '//trim(ntimesteps)//' time steps (s) : '
write(output_unit,'(A)',ADVANCE='no') str
write(str,"(ES16.7E3)") t2-t1
write(output_unit,'(A)',ADVANCE='yes') str

! Wall-time per time step
write(output_unit,'(1x, A," : ")',ADVANCE='no') __FILE__
str = 'tᵢ ='//trim(modelTime)
write(output_unit,'(A)',ADVANCE='no') str
str = ' | Wall-time per time step : '
write(output_unit,'(A)',ADVANCE='no') str
write(str,"(ES16.7E3)")(t2-t1)/(floor(ioInterval/this%dt))
write(output_unit,'(A)',ADVANCE='yes') str

! Wall-time per simulation time
write(output_unit,'(1x, A," : ")',ADVANCE='no') __FILE__
str = 'tᵢ ='//trim(modelTime)
write(output_unit,'(A)',ADVANCE='no') str
str = ' | Wall-time per simulation time : '
write(output_unit,'(A)',ADVANCE='no') str
write(str,"(ES16.7E3)")(t2-t1)/(ioInterval)
write(output_unit,'(A)',ADVANCE='yes') str

this%t = tNext

call this%CalculateEntropy()
Expand Down

0 comments on commit 4d8e6aa

Please sign in to comment.