diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index cf6872846..c16644b1d 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -194,14 +194,13 @@ module symba_classes type, extends(swiftest_storage) :: symba_encounter_storage !! A class that that is used to store simulation history data between file output - type(symba_io_encounter_parameters) :: nc !! NetCDF parameter object - real(DP), dimension(nframes) :: tvals !! Stored time values for snapshots + class(symba_io_encounter_parameters), allocatable :: nc !! NetCDF parameter object + real(DP), dimension(nframes) :: tvals !! Stored time values for snapshots contains procedure :: dump => symba_io_encounter_dump !! Dumps contents of encounter history to file final :: symba_util_final_encounter_storage end type symba_encounter_storage - type :: symba_encounter_snapshot !! A simplified version of a SyMBA nbody system object for storing minimal snapshots of the system state during encounters type(symba_pl) :: pl !! Massive body data structure diff --git a/src/setup/setup.f90 b/src/setup/setup.f90 index ea6d3db23..e95505b9b 100644 --- a/src/setup/setup.f90 +++ b/src/setup/setup.f90 @@ -68,7 +68,6 @@ module subroutine setup_construct_system(system, param) allocate(symba_pltpenc :: system%pltpenc_list) allocate(symba_plplenc :: system%plplenc_list) allocate(symba_plplenc :: system%plplcollision_list) - allocate(symba_encounter_storage :: system%encounter_history) end select case (RINGMOONS) write(*,*) 'RINGMOONS-SyMBA integrator not yet enabled' diff --git a/src/symba/symba_io.f90 b/src/symba/symba_io.f90 index a4e5a9922..c5ed78f2a 100644 --- a/src/symba/symba_io.f90 +++ b/src/symba/symba_io.f90 @@ -384,7 +384,10 @@ module subroutine symba_io_start_encounter(self, param, t) class(symba_parameters), intent(inout) :: param !! Current run configuration parameters real(DP), intent(in) :: t !! Current simulation time - if (.not. allocated(self%encounter_history)) allocate(symba_encounter_storage :: self%encounter_history) + if (.not. allocated(self%encounter_history)) then + allocate(symba_encounter_storage :: self%encounter_history) + allocate(symba_io_encounter_parameters :: self%encounter_history%nc) + end if call self%encounter_history%reset() ! Empty out the time slot array for the next pass diff --git a/src/symba/symba_util.f90 b/src/symba/symba_util.f90 index 41fd746ad..b66fe7ed1 100644 --- a/src/symba/symba_util.f90 +++ b/src/symba/symba_util.f90 @@ -955,6 +955,7 @@ module subroutine symba_util_resize_storage(self, nnew) nbig = nbig * 2 end do allocate(symba_encounter_storage(nbig) :: tmp) + call move_alloc(self%encounter_history%nc, tmp%nc) tmp%tvals(1:nold) = self%encounter_history%tvals(1:nold) tmp%tvals(nold+1:nbig) = huge(1.0_DP) if (lmalloc) then