diff --git a/src/encounter/encounter_io.f90 b/src/encounter/encounter_io.f90 index aece1e89f..025b923fc 100644 --- a/src/encounter/encounter_io.f90 +++ b/src/encounter/encounter_io.f90 @@ -29,10 +29,10 @@ module subroutine encounter_io_dump(self, param) select type(snapshot => self%frame(i)%item) class is (fraggle_collision_snapshot) - call snapshot%write_frame(self%ncc,param) - call snapshot%encounter_snapshot%write_frame(self%nce,param) + call snapshot%write_frame(self%nc,param) + call snapshot%encounter_snapshot%write_frame(self%nc,param) class is (encounter_snapshot) - call snapshot%write_frame(self%nce,param) + call snapshot%write_frame(self%nc,param) end select else exit diff --git a/src/modules/encounter_classes.f90 b/src/modules/encounter_classes.f90 index 69ed90e19..95f230344 100644 --- a/src/modules/encounter_classes.f90 +++ b/src/modules/encounter_classes.f90 @@ -66,8 +66,7 @@ module encounter_classes !> A class that that is used to store simulation history data between file output type, extends(swiftest_storage) :: encounter_storage - class(encounter_io_parameters), allocatable :: nce !! NetCDF parameter object containing the details about the encounter file attached to this storage object - class(encounter_io_parameters), allocatable :: ncc !! NetCDF parameter object containing the details about the collision file attached to this storage object + class(encounter_io_parameters), allocatable :: nc !! NetCDF parameter object containing the details about the file attached to this storage object contains procedure :: dump => encounter_io_dump !! Dumps contents of encounter history to file final :: encounter_util_final_storage diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index 93640a8d1..a31d042f9 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -192,6 +192,7 @@ module symba_classes class(fraggle_colliders), allocatable :: colliders !! Fraggle colliders object class(fraggle_fragments), allocatable :: fragments !! Fraggle fragmentation system object type(encounter_storage(nframes=:)), allocatable :: encounter_history !! Stores encounter history for later retrieval and saving to file + type(encounter_storage(nframes=:)), allocatable :: collision_history !! Stores encounter history for later retrieval and saving to file contains procedure :: write_discard => symba_io_write_discard !! Write out information about discarded and merged planets and test particles in SyMBA procedure :: initialize => symba_setup_initialize_system !! Performs SyMBA-specific initilization steps diff --git a/src/setup/setup.f90 b/src/setup/setup.f90 index 9123514ad..ea822f45d 100644 --- a/src/setup/setup.f90 +++ b/src/setup/setup.f90 @@ -74,16 +74,21 @@ module subroutine setup_construct_system(system, param) if (param%lencounter_save) then allocate(encounter_storage :: system%encounter_history) associate (encounter_history => system%encounter_history) - allocate(encounter_io_parameters :: encounter_history%nce) + allocate(encounter_io_parameters :: encounter_history%nc) call encounter_history%reset() - select type(nce => encounter_history%nce) + select type(nc => encounter_history%nc) class is (encounter_io_parameters) - nce%file_number = param%iloop / param%dump_cadence + nc%file_number = param%iloop / param%dump_cadence end select - allocate(fraggle_io_parameters :: encounter_history%ncc) - select type(ncc => encounter_history%ncc) + end associate + + allocate(encounter_storage :: system%collision_history) + associate (collision_history => system%collision_history) + allocate(fraggle_io_parameters :: collision_history%nc) + call collision_history%reset() + select type(nc => collision_history%nc) class is (fraggle_io_parameters) - ncc%file_number = param%iloop / param%dump_cadence + nc%file_number = param%iloop / param%dump_cadence end select end associate end if diff --git a/src/symba/symba_io.f90 b/src/symba/symba_io.f90 index d76bb9e59..94f53d3f9 100644 --- a/src/symba/symba_io.f90 +++ b/src/symba/symba_io.f90 @@ -23,21 +23,25 @@ module subroutine symba_io_dump_encounter(self, param) if (self%encounter_history%iframe == 0) return ! No enounters in this interval - associate(encounter_history => self%encounter_history, nce => self%encounter_history%nce, ncc => self%encounter_history%ncc, iframe => self%encounter_history%iframe) + associate(encounter_history => self%encounter_history, nce => self%encounter_history%nc, eframe => self%encounter_history%iframe,& + collision_history => self%collision_history, ncc => self%collision_history%nc, cframe => self%collision_history%iframe) ! Create and save the output files for this encounter and fragmentation nce%file_number = nce%file_number + 1 - ncc%file_number = ncc%file_number + 1 nce%time_dimsize = maxval(encounter_history%tslot(:)) - ncc%time_dimsize = maxval(encounter_history%tslot(:)) write(nce%file_name, '("encounter_",I0.6,".nc")') nce%file_number - write(ncc%file_name, '("collision_",I0.6,".nc")') ncc%file_number call nce%initialize(param) - call ncc%initialize(param) call encounter_history%dump(param) call nce%close() - call ncc%close() call encounter_history%reset() + + ncc%file_number = ncc%file_number + 1 + write(ncc%file_name, '("collision_",I0.6,".nc")') ncc%file_number + ncc%time_dimsize = maxval(collision_history%tslot(:)) + call ncc%initialize(param) + call collision_history%dump(param) + call ncc%close() + call collision_history%reset() end associate return diff --git a/src/symba/symba_util.f90 b/src/symba/symba_util.f90 index 9b6d11463..d90c3268c 100644 --- a/src/symba/symba_util.f90 +++ b/src/symba/symba_util.f90 @@ -903,8 +903,7 @@ subroutine symba_util_save_storage(system, snapshot, t) tmp%tslot(1:nold) = system%encounter_history%tslot(1:nold) tmp%tslot(nold+1:nbig) = 0 tmp%iframe = system%encounter_history%iframe - call move_alloc(system%encounter_history%nce, tmp%nce) - call move_alloc(system%encounter_history%ncc, tmp%ncc) + call move_alloc(system%encounter_history%nc, tmp%nc) do i = 1, nold if (allocated(system%encounter_history%frame(i)%item)) call move_alloc(system%encounter_history%frame(i)%item, tmp%frame(i)%item)