From 13acd7e370519b6c23c3acccbc9e58a47c941e29 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 1 Dec 2022 09:17:41 -0500 Subject: [PATCH] Replaced istep_dump parameter variable with dump_cadence. This specifies the number of output steps between file dumps --- src/io/io.f90 | 15 ++++++++++----- src/main/swiftest_driver.f90 | 9 +++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/io/io.f90 b/src/io/io.f90 index 91f20ed23..5e1d69767 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -527,7 +527,7 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg) call io_toupper(param_value) param%out_stat = param_value case ("DUMP_CADENCE") - read(param_value, *, err = 667, iomsg = iomsg) param%istep_dump + read(param_value, *, err = 667, iomsg = iomsg) param%dump_cadence case ("CHK_CLOSE") call io_toupper(param_value) if (param_value == "YES" .or. param_value == 'T') param%lclose = .true. @@ -672,8 +672,13 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg) iostat = -1 return end if - if ((param%istep_out <= 0) .and. (param%istep_dump <= 0)) then - write(iomsg,*) 'Invalid istep' + if (param%istep_out <= 0) then + write(iomsg,*) 'Invalid ISTEP_OUT. Must be a positive integer' + iostat = -1 + return + end if + if (param%dump_cadence < 0) then + write(iomsg,*) 'Invalid DUMP_CADENCE. Must be a positive integer or 0.' iostat = -1 return end if @@ -870,7 +875,7 @@ module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg) end if call io_param_writer_one("IN_FORM", param%in_form, unit) - if (param%istep_dump > 0) call io_param_writer_one("ISTEP_DUMP",param%istep_dump, unit) + if (param%dump_cadence > 0) call io_param_writer_one("DUMP_CADENCE",param%dump_cadence, unit) if (param%istep_out > 0) then call io_param_writer_one("ISTEP_OUT", param%istep_out, unit) call io_param_writer_one("BIN_OUT", param%outfile, unit) @@ -1503,7 +1508,7 @@ module subroutine io_write_frame_system(self, param) logical :: fileExists param%nciu%id_chunk = self%pl%nbody + self%tp%nbody - param%nciu%time_chunk = max(param%istep_dump / param%istep_out, 1) + param%nciu%time_chunk = max(param%dump_cadence / param%istep_out, 1) if (lfirst) then inquire(file=param%outfile, exist=fileExists) diff --git a/src/main/swiftest_driver.f90 b/src/main/swiftest_driver.f90 index 037592432..f0b9b5013 100644 --- a/src/main/swiftest_driver.f90 +++ b/src/main/swiftest_driver.f90 @@ -72,7 +72,7 @@ program swiftest_driver tstop => param%tstop, & iloop => param%iloop, & istep_out => param%istep_out, & - istep_dump => param%istep_dump, & + dump_cadence => param%dump_cadence, & ioutput => param%ioutput, & display_style => param%display_style, & display_unit => param%display_unit) @@ -81,7 +81,7 @@ program swiftest_driver t = t0 iloop = 0 iout = istep_out - idump = istep_dump + idump = dump_cadence nloops = ceiling((tstop - t0) / dt, kind=I8B) ioutput_t0 = int(t0 / dt / istep_out, kind=I8B) ioutput = ioutput_t0 @@ -123,6 +123,7 @@ program swiftest_driver ioutput = ioutput_t0 + iloop / istep_out call nbody_system%write_frame(param) + tfrac = (param%t - param%t0) / (param%tstop - param%t0) select type(pl => nbody_system%pl) @@ -148,11 +149,11 @@ program swiftest_driver end if !> If the loop counter is at the dump cadence value, dump the state of the system to a file in case it needs to be restarted - if (istep_dump > 0) then + if (dump_cadence > 0) then idump = idump - 1 if (idump == 0) then call nbody_system%dump(param) - idump = istep_dump + idump = dump_cadence end if end if end do