fixed assymetry in momentum-overflow handling

This commit is contained in:
Daniel Knüttel 2019-07-12 22:28:39 +02:00
parent fca61cd47a
commit 2475186d79
1 changed files with 4 additions and 2 deletions

View File

@ -38,8 +38,10 @@ class BrownIterator(object):
return self.x, self.y
self.px, self.py = self._interaction(self.x, self.y, self.px, self.py)
self.px[np.isnan(self.px)] = self.speed_of_light
self.py[np.isnan(self.py)] = self.speed_of_light
# XXX: We need the (-1)**i to make the problem
# symmetric.
self.px[np.isnan(self.px)] = self.speed_of_light * (-1)**self._i
self.py[np.isnan(self.py)] = self.speed_of_light * (-1)**self._i
self._reflect_at_borders()
self.x += self.dt * self.px