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

Commit

Permalink
Updated structure of the symba storage class to make the netcdf param…
Browse files Browse the repository at this point in the history
…eter a class instead of a type for easier extending
  • Loading branch information
daminton committed Dec 8, 2022
1 parent 51d0853 commit ba67441
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/setup/setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion src/symba/symba_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba67441

Please sign in to comment.