Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed problem in which the name of the main binary output file was lo…
Browse files Browse the repository at this point in the history
…st from the dump files when in NetCDF output mode
  • Loading branch information
daminton committed Oct 14, 2021
1 parent 385b215 commit ed1a17a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -275,29 +275,30 @@ module subroutine io_dump_system(self, param)
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%in_type = REAL8_TYPE
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
dump_param%in_netcdf = trim(adjustl(DUMP_NC_FILE(idx)))
dump_param%nciu%id_chunk = self%pl%nbody + self%tp%nbody
dump_param%nciu%time_chunk = 1
end if
dump_param%T0 = param%t
dump_param%ioutput = 0

call dump_param%dump(param_file_name)

dump_param%out_form = XV
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
dump_param%outfile = trim(adjustl(DUMP_NC_FILE(idx)))
dump_param%ioutput = 0
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)
Expand Down Expand Up @@ -575,6 +576,8 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg)
param%inplfile = param_value
case ("TP_IN")
param%intpfile = param_value
case ("NC_IN")
param%in_netcdf = param_value
case ("IN_TYPE")
call io_toupper(param_value)
param%in_type = param_value
Expand Down Expand Up @@ -935,10 +938,15 @@ module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg)
call io_param_writer_one("T0", param%t0, unit)
call io_param_writer_one("TSTOP", param%tstop, unit)
call io_param_writer_one("DT", param%dt, unit)
call io_param_writer_one("CB_IN", param%incbfile, unit)
call io_param_writer_one("PL_IN", param%inplfile, unit)
call io_param_writer_one("TP_IN", param%intpfile, unit)
call io_param_writer_one("IN_TYPE", param%in_type, unit)
if ((param%in_type == REAL4_TYPE) .or. (param%in_type == REAL8_TYPE)) then
call io_param_writer_one("CB_IN", param%incbfile, unit)
call io_param_writer_one("PL_IN", param%inplfile, unit)
call io_param_writer_one("TP_IN", param%intpfile, unit)
else if ((param%in_type == NETCDF_FLOAT_TYPE) .or. (param%in_type == NETCDF_DOUBLE_TYPE)) then
call io_param_writer_one("NC_IN", param%in_netcdf, unit)
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%istep_out > 0) then
Expand All @@ -948,7 +956,7 @@ module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg)
call io_param_writer_one("OUT_FORM", param%out_form, unit)
call io_param_writer_one("OUT_STAT", "APPEND", unit)
end if
if ((param%out_type /= REAL4_TYPE) .and. (param%out_type /= REAL8_TYPE)) then
if ((param%out_type == REAL4_TYPE) .or. (param%out_type == REAL8_TYPE)) then
call io_param_writer_one("PARTICLE_OUT", param%particle_out, unit)
end if
if (param%enc_out /= "") then
Expand Down
1 change: 1 addition & 0 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module swiftest_classes
character(STRMAX) :: incbfile = CB_INFILE !! Name of input file for the central body
character(STRMAX) :: inplfile = PL_INFILE !! Name of input file for massive bodies
character(STRMAX) :: intpfile = TP_INFILE !! Name of input file for test particles
character(STRMAX) :: in_netcdf = NC_INFILE !! Name of system input file for NetCDF input
character(STRMAX) :: in_type = ASCII_TYPE !! Data representation type of input data files
character(STRMAX) :: in_form = XV !! Format of input data files (EL or XV)
integer(I4B) :: istep_out = -1 !! Number of time steps between binary outputs
Expand Down
3 changes: 2 additions & 1 deletion src/modules/swiftest_globals.f90
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ module swiftest_globals
character(*), parameter :: CB_INFILE = 'cb.in'
character(*), parameter :: PL_INFILE = 'pl.in'
character(*), parameter :: TP_INFILE = 'tp.in'
character(*), parameter :: BIN_OUTFILE = 'bin.dat'
character(*), parameter :: NC_INFILE = 'in.nc'
character(*), parameter :: BIN_OUTFILE = 'bin.nc'
integer(I4B), parameter :: BINUNIT = 20 !! File unit number for the binary output file
character(*), parameter :: PARTICLE_OUTFILE = 'particle.dat'
integer(I4B), parameter :: PARTICLEUNIT = 44 !! File unit number for the binary particle info output file
Expand Down

0 comments on commit ed1a17a

Please sign in to comment.