diff --git a/examples/Fragmentation/Fragmentation_Movie.py b/examples/Fragmentation/Fragmentation_Movie.py index 43822bf25..cdfe03c06 100644 --- a/examples/Fragmentation/Fragmentation_Movie.py +++ b/examples/Fragmentation/Fragmentation_Movie.py @@ -41,12 +41,13 @@ movie_titles = dict(zip(available_movie_styles, movie_title_list)) # These initial conditions were generated by trial and error +names = ["Target","Projectile"] pos_vectors = {"disruption_headon" : [np.array([1.0, -5.0e-05, 0.0]), np.array([1.0, 5.0e-05 ,0.0])], - "supercatastrophic_off_axis": [np.array([1.0, -5.0e-05, 0.0]), - np.array([1.0, 5.0e-05, 0.0])], - "hitandrun" : [np.array([1.0, -2.0e-05, 0.0]), - np.array([0.999999, 2.0e-05, 0.0])] + "supercatastrophic_off_axis": [np.array([1.0, -5.0e-05, 0.0]), + np.array([1.0, 5.0e-05, 0.0])], + "hitandrun" : [np.array([1.0, -4.2e-05, 0.0]), + np.array([1.0, 4.2e-05, 0.0])] } vel_vectors = {"disruption_headon" : [np.array([-2.562596e-04, 6.280005, 0.0]), @@ -54,7 +55,7 @@ "supercatastrophic_off_axis": [np.array([0.0, 6.28, 0.0]), np.array([0.5, -6.28, 0.0])], "hitandrun" : [np.array([0.0, 6.28, 0.0]), - np.array([-0.9, -6.28, 0.0])] + np.array([-1.5, -6.28, 0.00])] } rot_vectors = {"disruption_headon" : [np.array([0.0, 0.0, 0.0]), @@ -67,7 +68,7 @@ body_Gmass = {"disruption_headon" : [1e-7, 1e-10], "supercatastrophic_off_axis": [1e-7, 1e-8], - "hitandrun" : [1e-7, 1e-10] + "hitandrun" : [1e-7, 7e-10] } density = 3000 * swiftest.AU2M**3 / swiftest.MSun @@ -76,6 +77,8 @@ for k,v in body_Gmass.items(): body_radius[k] = [((Gmass/GU)/(4./3.*np.pi*density))**(1./3.) for Gmass in v] +body_radius["hitandrun"] = [7e-6, 3.25e-6] + # ---------------------------------------------------------------------------------------------------------------------- # Define the animation class that will generate the movies of the fragmentation outcomes # ---------------------------------------------------------------------------------------------------------------------- @@ -134,8 +137,8 @@ def setup_plot(self): # Calculate the distance along the y-axis between the colliding bodies at the start of the simulation. # This will be used to scale the axis limits on the movie. - rhy1 = self.ds['rh'].sel(name="Body1",space='y').isel(time=0).values[()] - rhy2 = self.ds['rh'].sel(name="Body2",space='y').isel(time=0).values[()] + rhy1 = self.ds['rh'].sel(name="Target",space='y').isel(time=0).values[()] + rhy2 = self.ds['rh'].sel(name="Projectile",space='y').isel(time=0).values[()] scale_frame = abs(rhy1) + abs(rhy2) ax = plt.Axes(fig, [0.1, 0.1, 0.8, 0.8]) @@ -188,18 +191,18 @@ def data_stream(self, frame=0): user_selection = int(input("? ")) if user_selection > 0 and user_selection < 4: - movie_styles = [available_movie_styles[user_selection-1]] + movie_styles = [available_movie_styles[user_selection-1]] else: - print("Generating all movie styles") - movie_styles = available_movie_styles.copy() + print("Generating all movie styles") + movie_styles = available_movie_styles.copy() for style in movie_styles: movie_filename = f"{style}.mp4" # Pull in the Swiftest output data from the parameter file and store it as a Xarray dataset. sim = swiftest.Simulation(simdir=style, rotation=True, init_cond_format = "XV", compute_conservation_values=True) sim.add_solar_system_body("Sun") - sim.add_body(Gmass=body_Gmass[style], radius=body_radius[style], rh=pos_vectors[style], vh=vel_vectors[style]) #, rot=rot_vectors[style]) - # + sim.add_body(name=names, Gmass=body_Gmass[style], radius=body_radius[style], rh=pos_vectors[style], vh=vel_vectors[style]) #, rot=rot_vectors[style]) + # Set fragmentation parameters minimum_fragment_gmass = 0.2 * body_Gmass[style][1] # Make the minimum fragment mass a fraction of the smallest body gmtiny = 0.99 * body_Gmass[style][1] # Make GMTINY just smaller than the smallest original body. This will prevent runaway collisional cascades