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

Commit

Permalink
Updated collision_id particle info and maxid_collision parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlisle April Wishard committed Oct 15, 2021
1 parent 6ea96ea commit 3b9a75b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg)
read(param_value, *, err = 667, iomsg = iomsg) param%Euntracked
case ("MAXID")
read(param_value, *, err = 667, iomsg = iomsg) param%maxid
case ("MAXID_COLLISION")
read(param_value, *, err = 667, iomsg = iomsg) param%maxid_collision
case ("PARTICLE_OUT")
param%particle_out = param_value
case ("NPLMAX", "NTPMAX", "GMTINY", "MIN_GMFRAG", "FRAGMENTATION", "SEED", "YARKOVSKY", "YORP") ! Ignore SyMBA-specific, not-yet-implemented, or obsolete input parameters
Expand Down Expand Up @@ -1007,6 +1009,7 @@ module subroutine io_param_writer(self, unit, iotype, v_list, iostat, iomsg)
end if
call io_param_writer_one("FIRSTKICK",param%lfirstkick, unit)
call io_param_writer_one("MAXID",param%maxid, unit)
call io_param_writer_one("MAXID_COLLISION",param%maxid_collision, unit)

iostat = 0
iomsg = "UDIO not implemented"
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 @@ -96,6 +96,7 @@ module swiftest_classes
integer(I4B) :: integrator = UNKNOWN_INTEGRATOR !! Symbolic name of the nbody integrator used
character(STRMAX) :: param_file_name = "param.in" !! The default name of the parameter input file
integer(I4B) :: maxid = -1 !! The current maximum particle id number
integer(I4B) :: maxid_collision = -1 !! The current maximum collision id number
real(DP) :: t0 = -1.0_DP !! Integration start time
real(DP) :: t = -1.0_DP !! Integration current time
real(DP) :: tstop = -1.0_DP !! Integration stop time
Expand Down
1 change: 0 additions & 1 deletion src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ module symba_classes
class(symba_plplenc), allocatable :: plplenc_list !! List of massive body-massive body encounters in a single step
class(symba_plplenc), allocatable :: plplcollision_list !! List of massive body-massive body collisions in a single step
integer(I4B) :: irec !! System recursion level
integer(I4B) :: collision_counter !! Counter for number of collisions over total simulation
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
Expand Down
2 changes: 2 additions & 0 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ module subroutine netcdf_read_particle_info_base(self, iu, ind)
strlen = len(trim(adjustl(self%info%origin_type)))
call check( nf90_get_var(iu%ncid, iu%origin_type_varid, self%info%origin_type, start=[1, idslot], count=[strlen, 1]) )

call check( nf90_get_var(iu%ncid, iu%collision_id_varid, self%info%collision_id, start=[idslot]) )
call check( nf90_get_var(iu%ncid, iu%origin_time_varid, self%info%origin_time, start=[idslot]) )
call check( nf90_get_var(iu%ncid, iu%origin_xhx_varid, self%info%origin_xh(1), start=[idslot]) )
call check( nf90_get_var(iu%ncid, iu%origin_xhy_varid, self%info%origin_xh(2), start=[idslot]) )
Expand Down Expand Up @@ -943,6 +944,7 @@ module subroutine netcdf_write_particle_info_base(self, iu)
call check( nf90_put_var(iu%ncid, iu%origin_type_varid, emptystr, start=[1, idslot], count=[NAMELEN, 1]) )
call check( nf90_put_var(iu%ncid, iu%origin_type_varid, charstring, start=[1, idslot], count=[strlen, 1]) )

call check( nf90_put_var(iu%ncid, iu%collision_id_varid, self%info%collision_id, start=[idslot]) )
call check( nf90_put_var(iu%ncid, iu%origin_time_varid, self%info%origin_time, start=[idslot]) )
call check( nf90_put_var(iu%ncid, iu%origin_xhx_varid, self%info%origin_xh(1), start=[idslot]) )
call check( nf90_put_var(iu%ncid, iu%origin_xhy_varid, self%info%origin_xh(2), start=[idslot]) )
Expand Down
6 changes: 3 additions & 3 deletions src/setup/setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ module subroutine setup_initialize_particle_info_system(self, param)

associate(cb => self%cb, pl => self%pl, npl => self%pl%nbody, tp => self%tp, ntp => self%tp%nbody)

call cb%info%set_value(particle_type=CB_TYPE_NAME, status="ACTIVE", origin_type="Initial conditions", origin_time=param%t0, origin_xh=[0.0_DP, 0.0_DP, 0.0_DP], origin_vh=[0.0_DP, 0.0_DP, 0.0_DP], collision_id=0)
call cb%info%set_value(particle_type=CB_TYPE_NAME, status="ACTIVE", origin_type="Initial conditions", origin_time=param%t0, origin_xh=[0.0_DP, 0.0_DP, 0.0_DP], origin_vh=[0.0_DP, 0.0_DP, 0.0_DP])
do i = 1, self%pl%nbody
call pl%info(i)%set_value(particle_type=PL_TYPE_NAME, status="ACTIVE", origin_type="Initial conditions", origin_time=param%t0, origin_xh=self%pl%xh(:,i), origin_vh=self%pl%vh(:,i), collision_id=0)
call pl%info(i)%set_value(particle_type=PL_TYPE_NAME, status="ACTIVE", origin_type="Initial conditions", origin_time=param%t0, origin_xh=self%pl%xh(:,i), origin_vh=self%pl%vh(:,i))
end do
do i = 1, self%tp%nbody
call tp%info(i)%set_value(particle_type=TP_TYPE_NAME, status="ACTIVE", origin_type="Initial conditions", origin_time=param%t0, origin_xh=self%tp%xh(:,i), origin_vh=self%tp%vh(:,i), collision_id=0)
call tp%info(i)%set_value(particle_type=TP_TYPE_NAME, status="ACTIVE", origin_type="Initial conditions", origin_time=param%t0, origin_xh=self%tp%xh(:,i), origin_vh=self%tp%vh(:,i))
end do

end associate
Expand Down
10 changes: 6 additions & 4 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,9 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
ncolliders = colliders%ncoll
nfrag = frag%nbody

system%collision_counter = system%collision_counter + 1
param%maxid_collision = max(param%maxid_collision, maxval(system%pl%info(:)%collision_id))
param%maxid_collision = param%maxid_collision + 1

! Setup new bodies
allocate(plnew, mold=pl)
call plnew%setup(nfrag, param)
Expand Down Expand Up @@ -746,7 +748,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
plnew%status(1:nfrag) = NEW_PARTICLE
do i = 1, nfrag
write(newname, FRAGFMT) frag%id(i)
call plnew%info(i)%set_value(origin_type="Disruption", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=system%collision_counter)
call plnew%info(i)%set_value(origin_type="Disruption", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=param%maxid_collision)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) then
Expand All @@ -760,7 +762,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
plnew%status(1:nfrag) = NEW_PARTICLE
do i = 1, nfrag
write(newname, FRAGFMT) frag%id(i)
call plnew%info(i)%set_value(origin_type="Supercatastrophic", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=system%collision_counter)
call plnew%info(i)%set_value(origin_type="Supercatastrophic", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=param%maxid_collision)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) then
Expand All @@ -775,7 +777,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
plnew%status(1) = OLD_PARTICLE
do i = 2, nfrag
write(newname, FRAGFMT) frag%id(i)
call plnew%info(i)%set_value(origin_type="Hit and run fragment", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=system%collision_counter)
call plnew%info(i)%set_value(origin_type="Hit and run fragment", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=param%maxid_collision)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) cycle
Expand Down

0 comments on commit 3b9a75b

Please sign in to comment.