From 63a20eebe3da31ad08ce25e0acd568ad3433c396 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 7 Feb 2023 09:31:22 -0500 Subject: [PATCH 1/2] Improved the handling of reading a run where the initial condition and param file exists, but not the data file. --- python/swiftest/swiftest/simulation_class.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/swiftest/swiftest/simulation_class.py b/python/swiftest/swiftest/simulation_class.py index 6e80909c4..3eaa65ee4 100644 --- a/python/swiftest/swiftest/simulation_class.py +++ b/python/swiftest/swiftest/simulation_class.py @@ -342,7 +342,7 @@ def __init__(self,read_param: bool = False, read_data: bool = False, simdir: os. # If the file doesn't exist, flag it for now so we know to create it param_file_found = False if read_param or read_data: - if self.read_param(read_init_cond = read_data): + if self.read_param(read_init_cond = True): # We will add the parameter file to the kwarg list. This will keep the set_parameter method from # overriding everything with defaults when there are no arguments passed to Simulation() kwargs['param_file'] = self.param_file @@ -394,9 +394,9 @@ def _type_scrub(output_data): iloop = int((self.param['TSTART'] - self.param['T0']) / self.param['DT']) twidth = int(np.ceil(np.log10(self.param['TSTOP']/(self.param['DT'] * self.param['ISTEP_OUT'])))) pre_message = f"Time: {self.param['TSTART']:.{twidth}e} / {self.param['TSTOP']:.{twidth}e} {self.TU_name} " - post_message = f"npl: {self.data['npl'].values[0]} ntp: {self.data['ntp'].values[0]}" - if "nplm" in self.data: - post_message += f" nplm: {self.data['nplm'].values[0]}" + post_message = f"npl: {self.init_cond['npl'].values[0]} ntp: {self.init_cond['ntp'].values[0]}" + if "nplm" in self.init_cond: + post_message += f" nplm: {self.init_cond['nplm'].values[0]}" if self.param['ENERGY']: post_message += f" dL/L0: {0.0:.5e} dE/|E0|: {0.0:+.5e}" post_message += f" Wall time / step: {0.0:.5e} s" From 91df16f2b135bffa9c607bc133a65c8c99cf9c60 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 7 Feb 2023 11:24:56 -0500 Subject: [PATCH 2/2] Fixed bugs in the velocity guess values --- src/fraggle/fraggle_generate.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fraggle/fraggle_generate.f90 b/src/fraggle/fraggle_generate.f90 index 9d3dac19c..c91676621 100644 --- a/src/fraggle/fraggle_generate.f90 +++ b/src/fraggle/fraggle_generate.f90 @@ -60,7 +60,6 @@ module subroutine fraggle_generate(self, nbody_system, param, t) call self%disrupt(nbody_system, param, t, lfailure) if (lfailure) then call swiftest_io_log_one_message(COLLISION_LOG_OUT, "Fraggle failed to find an energy-losing solution. Simplifying the collisional model.") - impactors%mass_dist(1) = impactors%mass(1) impactors%mass_dist(2) = max(0.5_DP * impactors%mass(2), self%min_mfrag) impactors%mass_dist(3) = impactors%mass(2) - impactors%mass_dist(2) @@ -496,7 +495,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu real(DP), dimension(collider%fragments%nbody) :: vscale real(DP), parameter :: L_ROT_VEL_RATIO = 0.2_DP ! Ratio of angular momentum to put into rotation relative to velocity shear of fragments ! For the initial "guess" of fragment velocities, this is the minimum and maximum velocity relative to escape velocity that the fragments will have - real(DP) :: vmin_guess = 1.01_DP + real(DP) :: vmin_guess real(DP) :: vmax_guess real(DP) :: delta_v, GC integer(I4B), parameter :: MAXINNER = 100 @@ -539,6 +538,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu vimp = .mag. (impactors%vc(:,2) - impactors%vc(:,1)) vmax_guess = 1.1_DP * vimp + vmin_guess = 1.001_DP * vesc E_residual_best = huge(1.0_DP) lfailure = .false. @@ -682,7 +682,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu collider_local%fail_scale = collider_local%fail_scale * 1.001_DP ! Bring the minimum and maximum velocities closer together - delta_v = 0.125_DP * (vmax_guess - vmin_guess) + delta_v = (vmax_guess - vmin_guess) / 16.0_DP vmin_guess = vmin_guess + delta_v vmax_guess = vmax_guess - delta_v end do outer