From be30886c80ed5513711dbaaef6118167c338324f Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 23 Sep 2021 17:18:21 -0400 Subject: [PATCH] Removed the first call to io_conservation_report from the first dump call, as no dumping is actually happening any more and it is confusing --- src/io/io.f90 | 88 +++++++++++++++++------------------- src/main/swiftest_driver.f90 | 2 +- 2 files changed, 42 insertions(+), 48 deletions(-) diff --git a/src/io/io.f90 b/src/io/io.f90 index eb174f4b4..d6adf265d 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -277,57 +277,51 @@ module subroutine io_dump_system(self, param) real(DP) :: tfrac character(*), parameter :: statusfmt = '("Time = ", ES12.5, "; fraction done = ", F6.3, "; Number of active pl, tp = ", I5, ", ", I5)' character(*), parameter :: symbastatfmt = '("Time = ", ES12.5, "; fraction done = ", F6.3, "; Number of active plm, pl, tp = ", I5, ", ", I5, ", ", I5)' - logical, save :: lfirst = .true. - - if (lfirst) then - lfirst = .false. - if (param%lenergy) call self%conservation_report(param, lterminal=.false.) - else - allocate(dump_param, source=param) - param_file_name = trim(adjustl(DUMP_PARAM_FILE(idx))) - dump_param%in_form = XV - dump_param%out_form = XV - dump_param%out_stat = 'APPEND' - if ((param%out_type == REAL8_TYPE) .or. (param%out_type == REAL4_TYPE)) then - dump_param%incbfile = trim(adjustl(DUMP_CB_FILE(idx))) - dump_param%inplfile = trim(adjustl(DUMP_PL_FILE(idx))) - dump_param%intpfile = trim(adjustl(DUMP_TP_FILE(idx))) - dump_param%in_type = REAL8_TYPE - else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then - dump_param%outfile = trim(adjustl(DUMP_NC_FILE(idx))) - dump_param%in_type = NETCDF_DOUBLE_TYPE - end if - dump_param%T0 = param%t - dump_param%ioutput = 0 - - call dump_param%dump(param_file_name) - - if ((param%out_type == REAL8_TYPE) .or. (param%out_type == REAL4_TYPE)) then - call self%cb%dump(dump_param) - call self%pl%dump(dump_param) - call self%tp%dump(dump_param) - else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then - call dump_param%nciu%initialize(dump_param) - call self%write_hdr(dump_param%nciu, dump_param) - call self%cb%write_frame(dump_param%nciu, dump_param) - call self%pl%write_frame(dump_param%nciu, dump_param) - call self%tp%write_frame(dump_param%nciu, dump_param) - call dump_param%nciu%close(dump_param) - end if + + allocate(dump_param, source=param) + param_file_name = trim(adjustl(DUMP_PARAM_FILE(idx))) + dump_param%in_form = XV + dump_param%out_form = XV + dump_param%out_stat = 'APPEND' + if ((param%out_type == REAL8_TYPE) .or. (param%out_type == REAL4_TYPE)) then + dump_param%incbfile = trim(adjustl(DUMP_CB_FILE(idx))) + dump_param%inplfile = trim(adjustl(DUMP_PL_FILE(idx))) + dump_param%intpfile = trim(adjustl(DUMP_TP_FILE(idx))) + dump_param%in_type = REAL8_TYPE + else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then + dump_param%outfile = trim(adjustl(DUMP_NC_FILE(idx))) + dump_param%in_type = NETCDF_DOUBLE_TYPE + end if + dump_param%T0 = param%t + dump_param%ioutput = 0 - idx = idx + 1 - if (idx > NDUMPFILES) idx = 1 + call dump_param%dump(param_file_name) - tfrac = (param%t - param%t0) / (param%tstop - param%t0) - - select type(pl => self%pl) - class is (symba_pl) - write(*, symbastatfmt) param%t, tfrac, pl%nplm, pl%nbody, self%tp%nbody - class default - write(*, statusfmt) param%t, tfrac, pl%nbody, self%tp%nbody - end select + if ((param%out_type == REAL8_TYPE) .or. (param%out_type == REAL4_TYPE)) then + call self%cb%dump(dump_param) + call self%pl%dump(dump_param) + call self%tp%dump(dump_param) + else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then + call dump_param%nciu%initialize(dump_param) + call self%write_hdr(dump_param%nciu, dump_param) + call self%cb%write_frame(dump_param%nciu, dump_param) + call self%pl%write_frame(dump_param%nciu, dump_param) + call self%tp%write_frame(dump_param%nciu, dump_param) + call dump_param%nciu%close(dump_param) end if + idx = idx + 1 + if (idx > NDUMPFILES) idx = 1 + + tfrac = (param%t - param%t0) / (param%tstop - param%t0) + + select type(pl => self%pl) + class is (symba_pl) + write(*, symbastatfmt) param%t, tfrac, pl%nplm, pl%nbody, self%tp%nbody + class default + write(*, statusfmt) param%t, tfrac, pl%nbody, self%tp%nbody + end select + return end subroutine io_dump_system diff --git a/src/main/swiftest_driver.f90 b/src/main/swiftest_driver.f90 index d6c3e30d9..c00d08d94 100644 --- a/src/main/swiftest_driver.f90 +++ b/src/main/swiftest_driver.f90 @@ -63,7 +63,7 @@ program swiftest_driver else old_t_final = t0 if (istep_out > 0) call nbody_system%write_frame(param) - call nbody_system%dump(param) + if (param%lenergy) call nbody_system%conservation_report(param, lterminal=.false.) ! This will save the initial values of energy and momentum end if !> Define the maximum number of threads