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

Commit

Permalink
Added the spin barrier to Fraggle. Fragments are now not allowed to s…
Browse files Browse the repository at this point in the history
…pin faster than a maximum limit. Mergers that would exceed the spin barrier are converted to hit and run
  • Loading branch information
daminton committed Jan 20, 2023
1 parent fcf4d60 commit 4f374ed
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 157 deletions.
21 changes: 15 additions & 6 deletions examples/Fragmentation/Fragmentation_Movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_disrupt", "hitandrun_pure", "merge"]
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", "Merge"]
available_movie_styles = ["disruption_headon", "disruption_off_axis", "supercatastrophic_headon", "supercatastrophic_off_axis","hitandrun_disrupt", "hitandrun_pure", "merge", "merge_spinner"]
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", "Merge", "Merge crossing the spin barrier"]
movie_titles = dict(zip(available_movie_styles, movie_title_list))
num_movie_frames = 1000

Expand All @@ -56,6 +56,8 @@
"hitandrun_pure" : [np.array([1.0, -4.2e-05, 0.0]),
np.array([1.0, 4.2e-05, 0.0])],
"merge" : [np.array([1.0, -5.0e-05, 0.0]),
np.array([1.0, 5.0e-05 ,0.0])],
"merge_spinner" : [np.array([1.0, -5.0e-05, 0.0]),
np.array([1.0, 5.0e-05 ,0.0])]
}

Expand All @@ -72,6 +74,8 @@
"hitandrun_pure" : [np.array([ 0.00, 6.28, 0.0]),
np.array([-1.52, -6.28, 0.0])],
"merge" : [np.array([ 0.04, 6.28, 0.0]),
np.array([ 0.05, 6.18, 0.0])],
"merge_spinner" : [np.array([ 0.04, 6.28, 0.0]),
np.array([ 0.05, 6.18, 0.0])]
}

Expand All @@ -88,7 +92,9 @@
"hitandrun_pure" : [np.array([0.0, 0.0, 6.0e3]),
np.array([0.0, 0.0, 1.0e4])],
"merge" : [np.array([0.0, 0.0, 0.0]),
np.array([0.0, 0.0, 0.0])]
np.array([0.0, 0.0, 0.0])],
"merge_spinner" : [np.array([0.0, 0.0, -1.2e6]),
np.array([0.0, 0.0, 0.0])],
}

body_Gmass = {"disruption_headon" : [1e-7, 1e-9],
Expand All @@ -97,7 +103,8 @@
"supercatastrophic_off_axis": [1e-7, 1e-8],
"hitandrun_disrupt" : [1e-7, 7e-10],
"hitandrun_pure" : [1e-7, 7e-10],
"merge" : [1e-7, 1e-8]
"merge" : [1e-7, 1e-8],
"merge_spinner" : [1e-7, 1e-8]
}

tstop = {"disruption_headon" : 2.0e-3,
Expand All @@ -107,6 +114,7 @@
"hitandrun_disrupt" : 2.0e-4,
"hitandrun_pure" : 2.0e-4,
"merge" : 5.0e-3,
"merge_spinner" : 5.0e-3,
}

density = 3000 * swiftest.AU2M**3 / swiftest.MSun
Expand Down Expand Up @@ -312,10 +320,11 @@ def vec_props(self, c):
print("5. Hit and run with disruption of the runner")
print("6. Pure hit and run")
print("7. Merge")
print("8. All of the above")
print("8. Merge crossing the spin barrier")
print("9. All of the above")
user_selection = int(input("? "))

if user_selection > 0 and user_selection < 8:
if user_selection > 0 and user_selection < 9:
movie_styles = [available_movie_styles[user_selection-1]]
else:
print("Generating all movie styles")
Expand Down
18 changes: 10 additions & 8 deletions src/collision/collision_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module collision
character(len=NAMELEN),parameter :: REGIME_NAME_GRAZE_AND_MERGE = "Graze and Merge"
character(len=NAMELEN),parameter :: REGIME_NAME_HIT_AND_RUN = "Hit and Run"
character(len=NAMELEN),dimension(5), parameter :: REGIME_NAMES = [REGIME_NAME_MERGE, REGIME_NAME_DISRUPTION, REGIME_NAME_SUPERCATASTROPHIC, REGIME_NAME_GRAZE_AND_MERGE, REGIME_NAME_HIT_AND_RUN]
real(DP), parameter :: MAX_ROT_SI = 7.108e-4 !! Spin limit in rad/s of cohesionless body from Holsapple (2007)

!> Swiftest class for tracking pl-pl close encounters in a step when collisions are possible
type, extends(encounter_list) :: collision_list_plpl
Expand Down Expand Up @@ -88,7 +89,6 @@ module collision

contains
procedure :: consolidate => collision_resolve_consolidate_impactors !! Consolidates a multi-body collision into an equivalent 2-body collision
procedure :: get_regime => collision_regime_impactors !! Determine which fragmentation regime the set of impactors will be
procedure :: dealloc => collision_util_dealloc_impactors !! Resets the collider object variables to 0 and deallocates the index and mass distributions
procedure :: set_coordinate_system => collision_util_set_coordinate_impactors !! Sets the coordinate system of the impactors
final :: collision_final_impactors !! Finalizer will deallocate all allocatables
Expand Down Expand Up @@ -152,8 +152,9 @@ module collision
integer(I4B) :: collision_id !! ID number of this collision event
integer(I4B) :: maxid_collision = 0 !! The current maximum collision id number
real(DP) :: min_mfrag !! Minimum fragment mass
real(DP) :: max_rot !! Maximum rotation rate (in system or natural units, depending on )

! Scale factors used to scale dimensioned quantities to a more "natural" system where important quantities (like kinetic energy, momentum) are of order ~1
! Scale factors used to scale dimensioned quantities to a more "natural" system where escape velocity is 1 and body masses are of order 1
real(DP) :: dscale = 1.0_DP !! Distance dimension scale factor
real(DP) :: mscale = 1.0_DP !! Mass scale factor
real(DP) :: tscale = 1.0_DP !! Time scale factor
Expand All @@ -178,6 +179,7 @@ module collision
procedure :: add_fragments => collision_util_add_fragments_to_collider !! Add fragments to nbody_system
procedure :: get_energy_and_momentum => collision_util_get_energy_and_momentum !! Calculates total nbody_system energy in either the pre-collision outcome state (lbefore = .true.) or the post-collision outcome state (lbefore = .false.)
procedure :: dealloc => collision_util_dealloc_basic !! Deallocates all allocatables
procedure :: get_regime => collision_regime_collider !! Determine which fragmentation regime the set of impactors will be
procedure :: setup => collision_util_setup_collider !! Initializer for the encounter collision system and the before/after snapshots
procedure :: setup_impactors => collision_util_setup_impactors_collider !! Initializer for the impactors for the encounter collision system. Deallocates old impactors before creating new ones
procedure :: setup_fragments => collision_util_setup_fragments_collider !! Initializer for the fragments of the collision system.
Expand Down Expand Up @@ -303,16 +305,16 @@ module subroutine collision_io_netcdf_write_frame_snapshot(self, history, param)
class(base_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine collision_io_netcdf_write_frame_snapshot

module subroutine collision_regime_impactors(self, nbody_system, param)
module subroutine collision_regime_collider(self, nbody_system, param)
implicit none
class(collision_impactors), intent(inout) :: self !! Collision system impactors object
class(base_nbody_system), intent(in) :: nbody_system !! Swiftest nbody system object
class(base_parameters), intent(in) :: param !! Current Swiftest run configuration parameters
end subroutine collision_regime_impactors
class(collision_basic), intent(inout) :: self !! Collision system object
class(base_nbody_system), intent(in) :: nbody_system !! Swiftest nbody system object
class(base_parameters), intent(in) :: param !! Current Swiftest run configuration parameters
end subroutine collision_regime_collider

module subroutine collision_check_plpl(self, nbody_system, param, t, dt, irec, lany_collision)
implicit none
class(collision_list_plpl), intent(inout) :: self !! encounter list object
class(collision_list_plpl), intent(inout) :: self !! encounter list object
class(base_nbody_system), intent(inout) :: nbody_system !! Swiftest nbody system object
class(base_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! current time
Expand Down
Loading

0 comments on commit 4f374ed

Please sign in to comment.