From e9cfe2367ab13ecaecd5a0e0ea018354dffc0836 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 26 Dec 2022 08:46:14 -0500 Subject: [PATCH] Added pure vs non pure hit and run examples --- examples/Fragmentation/Fragmentation_Movie.py | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/examples/Fragmentation/Fragmentation_Movie.py b/examples/Fragmentation/Fragmentation_Movie.py index 317ff7de7..88ced4615 100644 --- a/examples/Fragmentation/Fragmentation_Movie.py +++ b/examples/Fragmentation/Fragmentation_Movie.py @@ -36,8 +36,8 @@ # ---------------------------------------------------------------------------------------------------------------------- # Define the names and initial conditions of the various fragmentation simulation types # ---------------------------------------------------------------------------------------------------------------------- -available_movie_styles = ["disruption_headon", "disruption_off_axis", "supercatastrophic_headon", "supercatastrophic_off_axis","hitandrun"] -movie_title_list = ["Head-on Disruption", "Off-axis Disruption", "Head-on Supercatastrophic", "Off-axis Supercatastrophic", "Hit and Run"] +available_movie_styles = ["disruption_headon", "disruption_off_axis", "supercatastrophic_headon", "supercatastrophic_off_axis","hitandrun_disrupt", "hitandrun_pure"] +movie_title_list = ["Head-on Disruption", "Off-axis Disruption", "Head-on Supercatastrophic", "Off-axis Supercatastrophic", "Hit and Run w/ Runner Disruption", "Pure Hit and Run"] movie_titles = dict(zip(available_movie_styles, movie_title_list)) # These initial conditions were generated by trial and error @@ -50,8 +50,10 @@ 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, -4.2e-05, 0.0]), - np.array([1.0, 4.2e-05, 0.0])] + "hitandrun_disrupt" : [np.array([1.0, -4.2e-05, 0.0]), + np.array([1.0, 4.2e-05, 0.0])], + "hitandrun_pure" : [np.array([1.0, -4.2e-05, 0.0]), + np.array([1.0, 4.2e-05, 0.0])] } vel_vectors = {"disruption_headon" : [np.array([ 0.00, 6.280005, 0.0]), @@ -62,8 +64,10 @@ np.array([ 0.00, -6.28, 0.0])], "supercatastrophic_off_axis": [np.array([ 0.00, 6.28, 0.0]), np.array([ 0.50, -6.28, 0.0])], - "hitandrun" : [np.array([ 0.00, 6.28, 0.0]), - np.array([-1.45, -6.28, 0.0])] + "hitandrun_disrupt" : [np.array([ 0.00, 6.28, 0.0]), + np.array([-1.45, -6.28, 0.0])], + "hitandrun_pure" : [np.array([ 0.00, 6.28, 0.0]), + np.array([-1.50, -6.28, 0.0])] } rot_vectors = {"disruption_headon" : [np.array([0.0, 0.0, 0.0]), @@ -74,7 +78,9 @@ np.array([0.0, 0.0, 0.0])], "supercatastrophic_off_axis": [np.array([0.0, 0.0, -6.0e4]), np.array([0.0, 0.0, 1.0e5])], - "hitandrun" : [np.array([0.0, 0.0, 6.0e4]), + "hitandrun_disrupt" : [np.array([0.0, 0.0, 6.0e4]), + np.array([0.0, 0.0, 1.0e5])], + "hitandrun_pure" : [np.array([0.0, 0.0, 6.0e4]), np.array([0.0, 0.0, 1.0e5])] } @@ -82,7 +88,8 @@ "disruption_off_axis" : [1e-7, 1e-10], "supercatastrophic_headon": [1e-7, 1e-8], "supercatastrophic_off_axis": [1e-7, 1e-8], - "hitandrun" : [1e-7, 7e-10] + "hitandrun_disrupt" : [1e-7, 7e-10], + "hitandrun_pure" : [1e-7, 7e-10] } density = 3000 * swiftest.AU2M**3 / swiftest.MSun @@ -91,7 +98,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] +body_radius["hitandrun_disrupt"] = [7e-6, 3.25e-6] +body_radius["hitandrun_pure"] = [7e-6, 3.25e-6] # ---------------------------------------------------------------------------------------------------------------------- # Define the animation class that will generate the movies of the fragmentation outcomes @@ -202,17 +210,19 @@ def data_stream(self, frame=0): print("2. Off-axis disruption") print("3. Head-on supercatastrophic") print("4. Off-axis supercatastrophic") - print("5. Hit and run") - print("6. All of the above") + print("5. Hit and run with disruption of the runner") + print("6. Pure hit and run") + print("7. All of the above") user_selection = int(input("? ")) - if user_selection > 0 and user_selection < 6: + if user_selection > 0 and user_selection < 7: movie_styles = [available_movie_styles[user_selection-1]] else: print("Generating all movie styles") movie_styles = available_movie_styles.copy() for style in movie_styles: + print(f"Generating {movie_titles[style]}") 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)