From 7911210d059fc9dffa1a349e0dbec9f4635522ec Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 13 Dec 2022 18:31:51 -0500 Subject: [PATCH] Fixed issue with time keeping during recursion steps --- examples/Fragmentation/Fragmentation_Movie.py | 6 ++---- src/symba/symba_encounter_check.f90 | 1 + src/symba/symba_step.f90 | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/Fragmentation/Fragmentation_Movie.py b/examples/Fragmentation/Fragmentation_Movie.py index af8fa377c..6822c71de 100644 --- a/examples/Fragmentation/Fragmentation_Movie.py +++ b/examples/Fragmentation/Fragmentation_Movie.py @@ -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) diff --git a/src/symba/symba_encounter_check.f90 b/src/symba/symba_encounter_check.f90 index f016af9d9..f53061b93 100644 --- a/src/symba/symba_encounter_check.f90 +++ b/src/symba/symba_encounter_check.f90 @@ -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) diff --git a/src/symba/symba_step.f90 b/src/symba/symba_step.f90 index 3b217305f..216855118 100644 --- a/src/symba/symba_step.f90 +++ b/src/symba/symba_step.f90 @@ -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 @@ -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)