diff --git a/src/fraggle/fraggle_generate.f90 b/src/fraggle/fraggle_generate.f90 index a534b988f..aa14c8bd2 100644 --- a/src/fraggle/fraggle_generate.f90 +++ b/src/fraggle/fraggle_generate.f90 @@ -98,6 +98,7 @@ module subroutine fraggle_generate_disrupt(self, nbody_system, param, t, lfailur logical :: lk_plpl, lfailure_local logical, dimension(size(IEEE_ALL)) :: fpe_halting_modes, fpe_quiet_modes character(len=STRMAX) :: message + real(DP), parameter :: fail_scale_initial = 1.001_DP ! The minimization and linear solvers can sometimes lead to floating point exceptions. Rather than halting the code entirely if this occurs, we ! can simply fail the attempt and try again. So we need to turn off any floating point exception halting modes temporarily @@ -137,6 +138,7 @@ module subroutine fraggle_generate_disrupt(self, nbody_system, param, t, lfailur call self%get_energy_and_momentum(nbody_system, param, lbefore=.true.) call self%set_budgets() do try = 1, MAXTRY + self%fail_scale = (fail_scale_initial)**try write(message,*) try call fraggle_generate_pos_vec(self) call fraggle_generate_rot_vec(self) @@ -254,8 +256,6 @@ module subroutine fraggle_generate_pos_vec(collider) logical :: lcat, lhitandrun integer(I4B), parameter :: MAXLOOP = 10000 real(DP) :: rdistance - real(DP), parameter :: fail_scale = 1.001_DP ! Scale factor to apply to cloud radius and distance if cloud generation fails - associate(fragments => collider%fragments, impactors => collider%impactors, nfrag => collider%fragments%nbody) lcat = (impactors%regime == COLLRESOLVE_REGIME_SUPERCATASTROPHIC) @@ -301,8 +301,8 @@ module subroutine fraggle_generate_pos_vec(collider) loverlap(i) = loverlap(i) .or. (dis <= (fragments%radius(i) + fragments%radius(j))) end do end do - rdistance = rdistance * fail_scale - fragment_cloud_radius(:) = fragment_cloud_radius(:) * fail_scale + rdistance = rdistance * collider%fail_scale + fragment_cloud_radius(:) = fragment_cloud_radius(:) * collider%fail_scale end do call collision_util_shift_vector_to_origin(fragments%mass, fragments%rc) diff --git a/src/fraggle/fraggle_module.f90 b/src/fraggle/fraggle_module.f90 index 9022a0a0c..b50aa3ac3 100644 --- a/src/fraggle/fraggle_module.f90 +++ b/src/fraggle/fraggle_module.f90 @@ -19,8 +19,8 @@ module fraggle type, extends(collision_fragments) :: fraggle_fragments contains - procedure :: reset => fraggle_util_reset_fragments !! Resets all position and velocity-dependent fragment quantities in order to do a fresh calculation (does not reset mass, radius, or other values that get set prior to the call to fraggle_generate) - final :: fraggle_final_fragments !! Finalizer will deallocate all allocatables + procedure :: reset => fraggle_util_reset_fragments !! Resets all position and velocity-dependent fragment quantities in order to do a fresh calculation (does not reset mass, radius, or other values that get set prior to the call to fraggle_generate) + final :: fraggle_final_fragments !! Finalizer will deallocate all allocatables end type fraggle_fragments @@ -31,7 +31,8 @@ module fraggle real(DP) :: tscale = 1.0_DP !! Time scale factor real(DP) :: vscale = 1.0_DP !! Velocity scale factor (a convenience unit that is derived from dscale and tscale) real(DP) :: Escale = 1.0_DP !! Energy scale factor (a convenience unit that is derived from dscale, tscale, and mscale) - real(DP) :: Lscale = 1.0_DP !! Angular momentum scale factor (a convenience unit that is derived from dscale, tscale, and mscale) + real(DP) :: Lscale = 1.0_DP !! Angular momentum scale factor (a convenience unit that is derived from dscale, tscale, and mscale) + real(DP) :: fail_scale !! Scale factor to apply to distance values in the position model when overlaps occur. contains procedure :: disrupt => fraggle_generate_disrupt !! Generates a system of fragments in barycentric coordinates that conserves energy and momentum. procedure :: generate => fraggle_generate !! A simple disruption models that does not constrain energy loss in collisions