From 7bda5cadfcb8d2558cdea70a469b658dff0c572c Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 1 Dec 2022 13:39:13 -0500 Subject: [PATCH] Cleaned up io_dump_system_storage and wrote more verbose comments --- src/io/io.f90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/io/io.f90 b/src/io/io.f90 index 129f1e82d..7ee5b9cbd 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -269,10 +269,14 @@ module subroutine io_dump_system(self, param) return end subroutine io_dump_system + module subroutine io_dump_system_storage(self, param) !! author: David A. Minton !! - !! Dumps the time history of the simulation to file + !! Dumps the time history of the simulation to file. Each time it writes a frame to file, it deallocates the system + !! object from inside. It will only dump frames with systems that are allocated, so this can be called at the end of + !! a simulation for cases when the number of saved frames is not equal to the dump cadence (for instance, if the dump + !! cadence is not divisible by the total number of loops). implicit none ! Arguments class(swiftest_storage(*)), intent(inout) :: self !! Swiftest simulation history storage object @@ -282,8 +286,8 @@ module subroutine io_dump_system_storage(self, param) iloop_start = param%iloop - param%istep_out * param%dump_cadence + 1_I8B do i = 1_I8B, param%dump_cadence - param%ioutput = int(iloop_start / param%istep_out, kind=I8B) + i if (allocated(self%frame(i)%system)) then + param%ioutput = int(iloop_start / param%istep_out, kind=I8B) + i call self%frame(i)%system%write_frame(param) deallocate(self%frame(i)%system) end if