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

Commit

Permalink
Merge branch 'Fragmentation' of https://github.itap.purdue.edu/Minton…
Browse files Browse the repository at this point in the history
…Group/swiftest into Fragmentation
  • Loading branch information
daminton committed Jun 11, 2021
2 parents 6757766 + f68942a commit 96292ce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
25 changes: 10 additions & 15 deletions examples/symba_energy_momentum/collision_movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
ymin = -20.0
ymax = 20.0

#cases = ['supercat_head', 'supercat_off', 'disruption_head', 'disruption_off']
cases = ['disruption_off', 'supercat_off']
cases = ['supercat_head', 'supercat_off', 'disruption_head', 'disruption_off']
#cases = ['disruption_off', 'supercat_off']

def scale_sim(ds, config):

Expand Down Expand Up @@ -169,14 +169,12 @@ def spin_arrows(self, pl, id, len):
py = pl[:, 1]
sarrowend = []
sarrowtip = []
idxactive = np.arange(id.size)[self.mask]
for i in range(pl.shape[0]):
endrel = np.array([0.0, len[i], 0.0])
tiprel = np.array([0.0, -len[i], 0.0])
endrel = np.array([len[i], 0.0, 0.0])
tiprel = np.array([-len[i], 0.0, 0.0])
r = R.from_rotvec(self.rot_angle[id[i]])
if i in idxactive:
endrel = r.apply(endrel)
tiprel = r.apply(tiprel)
endrel = r.apply(endrel)
tiprel = r.apply(tiprel)
send = (px[i] + endrel[0], py[i] + endrel[1])
stip = (px[i] + tiprel[0], py[i] + tiprel[1])
sarrowend.append(send)
Expand Down Expand Up @@ -268,20 +266,17 @@ def data_stream(self, frame=0):
roty = np.nan_to_num(roty, copy=False)
rotz = np.nan_to_num(rotz, copy=False)
rotvec = np.array([rotx, roty, rotz])
self.rotvec = dict(zip(id, zip(*rotvec)))

if frame == 0:
tmp = np.zeros_like(rotvec)
self.rot_angle = dict(zip(id, zip(*tmp)))
else:
t0 = self.ds.coords['time'].values[frame-1]
dt = t - t0
for i in np.arange(npl):
if id[i] in self.rot_angle:
self.rot_angle[id[i]] = self.rot_angle[id[i]] + dt * rotvec[:,i]
self.rot_angle[id[i]] = self.rot_angle[id[i]] % (2 * np.pi)
else:
self.rot_angle[id[i]] = np.zeros(3)

idxactive = np.arange(id.size)[self.mask]
for i in id[idxactive]:
self.rot_angle[i] = self.rot_angle[i] + dt * np.array(self.rotvec[i])
frame += 1
yield t, name, mass, radius, npl, np.c_[x, y, vx, vy], radmarker, origin

Expand Down
4 changes: 2 additions & 2 deletions examples/symba_energy_momentum/disruption_headon.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
1.0 -4.20E-05 0.0
0.00 6.28 0.0
0.4 0.4 0.4 !Ip
0.0 0.0 0.0 !rot
0.0 0.0 6.0e4 !rot
3 7e-10 0.0004
3.25e-06
1.0 4.20E-05 0.0
0.00 -6.28 0.0
0.4 0.4 0.4 !Ip
0.0 0.0 0.0 !rot
0.0 0.0 1.0e5 !rot
4 changes: 2 additions & 2 deletions examples/symba_energy_momentum/supercatastrophic_headon.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
1.0 -4.20E-05 0.0
0.00 6.28 0.0
0.4 0.4 0.4 !Ip
0.0 0.0 0.0 !rot
0.0 0.0 -6.0e4 !rot
3 1e-08 0.0004
3.25e-06
1.0 4.20E-05 0.0
0.00 -6.28 0.0
0.4 0.4 0.4 !Ip
0.0 0.0 0.0 !rot
0.0 0.0 1.0e5 !rot

0 comments on commit 96292ce

Please sign in to comment.