diff --git a/examples/symba_energy_momentum/collision_movie.py b/examples/symba_energy_momentum/collision_movie.py index 1a17034c5..e40048c91 100755 --- a/examples/symba_energy_momentum/collision_movie.py +++ b/examples/symba_energy_momentum/collision_movie.py @@ -14,8 +14,8 @@ ncutoff = 1e20 radscale = 2000 -cases = ['supercat_head', 'supercat_off', 'disruption_head', 'disruption_off'] -#cases = ['supercat_head'] +#cases = ['supercat_head', 'supercat_off', 'disruption_head', 'disruption_off'] +cases = ['disruption_off'] def scale_sim(ds, Rcb): dst0 = ds.isel(time=0) @@ -100,8 +100,8 @@ def __init__(self, ds, param): # Then setup FuncAnimation. self.ani = animation.FuncAnimation(fig, self.update, interval=1, frames=nframes, init_func=self.setup_plot, blit=False) - self.ani.save(animfile, fps=60, dpi=300, extra_args=['-vcodec', 'mpeg4']) - #self.ani.save(animfile, fps=60, dpi=300, extra_args=['-vcodec', 'libx264']) + #self.ani.save(animfile, fps=60, dpi=300, extra_args=['-vcodec', 'mpeg4']) + self.ani.save(animfile, fps=60, dpi=300, extra_args=['-vcodec', 'libx264']) print(f"Finished writing {animfile}") def plot_pl_circles(self, pl, radmarker): @@ -264,7 +264,7 @@ def data_stream(self, frame=0): origin = d['origin_type'].values t = self.ds.coords['time'].values[frame] - self.mask = np.logical_not(radius > self.Rcb) + self.mask = np.logical_not(radius == 0.0) x = np.nan_to_num(x, copy=False) y = np.nan_to_num(y, copy=False) diff --git a/python/swiftest/swiftest/io.py b/python/swiftest/swiftest/io.py index cae553b13..da1c49f17 100644 --- a/python/swiftest/swiftest/io.py +++ b/python/swiftest/swiftest/io.py @@ -1503,4 +1503,53 @@ def swiftest2swifter_param(swiftest_param, J2=0.0, J4=0.0): swifter_param['OUT_STAT'] = "UNKNOWN" swifter_param['! VERSION'] = "Swifter parameter file converted from Swiftest" - return swifter_param \ No newline at end of file + return swifter_param + + +def swifter2swift_param(swifter_param, J2=0.0, J4=0.0): + swift_param = { + '! VERSION': f"Swift parameter input file converted from Swifter", + 'T0': 0.0, + 'TSTOP': 0.0, + 'DT': 0.0, + 'DTOUT': 0.0, + 'DTDUMP': 0.0, + 'L1': "F", + 'L1': "F", + 'L2': "F", + 'L3': "F", + 'L4': "F", + 'L5': "T", + 'L6': "F", + 'RMIN': -1, + 'RMAX': -1, + 'RMAXU': -1, + 'QMIN': -1, + 'LCLOSE': "F", + 'BINARY_OUTPUTFILE': "bin.dat", + 'STATUS_FLAG_FOR_OPEN_STATEMENTS': "NEW", + } + + swift_param['T0'] = swifter_param['T0'] + swift_param['TSTOP'] = swifter_param['TSTOP'] + swift_param['DT'] = swifter_param['DT'] + # Convert the parameter file values + swift_param['DTOUT'] = swifter_param['ISTEP_OUT'] * swifter_param['DT'] + swift_param['DTDUMP'] = swifter_param['ISTEP_DUMP'] * swifter_param['DT'] + swift_param['BINARY_OUTPUTFILE'] = swifter_param['BIN_OUT'] + swift_param['STATUS_FLAG_FOR_OPEN_STATEMENTS'] = swifter_param['OUT_STAT'] + + if swifter_param['CHK_CLOSE'] == "YES": + swift_param['LCLOSE'] = "T" + else: + swift_param['LCLOSE'] = "F" + + swift_param['RMIN'] = swifter_param['CHK_RMIN'] + swift_param['RMAX'] = swifter_param['CHK_RMAX'] + swift_param['QMIN'] = swifter_param['CHK_QMIN'] + + if swift_param['RMIN'] > 0 or swift_param['RMAX'] > 0 or swift_param['QMIN'] > 0: + swift_param['L2'] = 'T' + + + return swift_param \ No newline at end of file