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

Commit

Permalink
Fixed issue with time keeping during recursion steps
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 13, 2022
1 parent 44d0a75 commit 7911210
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 2 additions & 4 deletions examples/Fragmentation/Fragmentation_Movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,18 @@ def setup_plot(self):
ax.set_title(self.title)
fig.add_axes(ax)

self.scatter_artist = ax.scatter([], [], animated=True)
self.scatter_artist = ax.scatter([], [], animated=True, c='k', edgecolors='face')
return fig, ax

def update_plot(self, frame):
# Define a function to calculate the center of mass of the system.
def center(Gmass, x, y):
x = x[~np.isnan(x)]
y = y[~np.isnan(y)]
Gmass = Gmass[~np.isnan(Gmass)]
x_com = np.sum(Gmass * x) / np.sum(Gmass)
y_com = np.sum(Gmass * y) / np.sum(Gmass)
return x_com, y_com

Gmass, rh, point_rad = next(self.data_stream(frame))
point_rad*=2
x_com, y_com = center(Gmass, rh[:,0], rh[:,1])
self.scatter_artist.set_offsets(np.c_[rh[:,0] - x_com, rh[:,1] - y_com])
self.scatter_artist.set_sizes(point_rad**2)
Expand Down
1 change: 1 addition & 0 deletions src/symba/symba_encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module function symba_encounter_check_pl(self, param, system, dt, irec) result(l

if (lany_encounter) then
do k = 1_I8B, nenc
plplenc_list%t = system%t
i = plplenc_list%index1(k)
j = plplenc_list%index2(k)
plplenc_list%id1(k) = pl%id(i)
Expand Down
12 changes: 6 additions & 6 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ recursive module subroutine symba_step_recur_system(self, param, t, ireci)
call pl%drift(system, param, dtl)
call tp%drift(system, param, dtl)

if (lencounter) call system%recursive_step(param, t+dth,irecp)
if (lencounter) call system%recursive_step(param, t + (j-1)*dtl, irecp)
system%irec = ireci

if (param%lgr) then
Expand All @@ -241,13 +241,13 @@ recursive module subroutine symba_step_recur_system(self, param, t, ireci)
end if

if (param%lclose) then
call plplenc_list%collision_check(system, param, t+dtl, dtl, ireci, lplpl_collision)
call pltpenc_list%collision_check(system, param, t+dtl, dtl, ireci, lpltp_collision)
call plplenc_list%collision_check(system, param, t+j*dtl, dtl, ireci, lplpl_collision)
call pltpenc_list%collision_check(system, param, t+j*dtl, dtl, ireci, lpltp_collision)

if (lplpl_collision) call plplenc_list%resolve_collision(system, param, t+dtl, dtl, ireci)
if (lpltp_collision) call pltpenc_list%resolve_collision(system, param, t+dtl, dtl, ireci)
if (lplpl_collision) call plplenc_list%resolve_collision(system, param, t+j*dtl, dtl, ireci)
if (lpltp_collision) call pltpenc_list%resolve_collision(system, param, t+j*dtl, dtl, ireci)
end if
if (param%lenc_save_trajectory) call encounter_history%take_snapshot(param, self, t+dtl, "trajectory")
if (param%lenc_save_trajectory) call encounter_history%take_snapshot(param, self, t+j*dtl, "trajectory")

call self%set_recur_levels(ireci)

Expand Down

0 comments on commit 7911210

Please sign in to comment.