def new_star_code_octgrav(self): result = Octgrav() result.parameters.epsilon_squared = self.star_epsilon**2 result.parameters.timestep = 0.125 * self.interaction_timestep result.particles.add_particles(self.new_particles_cluster()) result.commit_particles() return result
def new_star_code_octgrav(self): result = Octgrav(self.converter) result.parameters.epsilon_squared = self.star_epsilon ** 2 result.parameters.timestep = 0.125 * self.interaction_timestep result.particles.add_particles(self.new_particles_cluster()) result.commit_particles() return result
def new_gravity_field_from(codes, converter, epsilon_squared): gravity_field_code = Octgrav( converter, node_label="GPU", redirection="file", redirect_file="gravity_field_code{0}.log".format( new_gravity_field_from.counter)) gravity_field_code.parameters.epsilon_squared = epsilon_squared gravity_field_code.parameters.opening_angle = 0.5 gravity_field = CalculateFieldForCodesUsingReinitialize( gravity_field_code, codes, required_attributes=['mass', 'x', 'y', 'z', 'vx', 'vy', 'vz']) new_gravity_field_from.counter += 1 return gravity_field
def init_integrator(method): if method == 'octgrav': gravity = Octgrav() elif method == 'ph4': gravity = ph4() elif method == 'fi': gravity = Fi(convert_nbody) gravity.initialize_code() gravity.parameters.epsilon_squared = 0.00000001 | units.AU**2 gravity.parameters.timestep = .10 | units.day elif method == 'phigrape': gravity = PhiGRAPE(convert_nbody, mode=PhiGRAPEInterface.MODE_GPU) elif method == 'bhtree': gravity = BHTree(convert_nbody, number_of_workes=workers) elif method == 'hermite': gravity = Hermite(convert_nbody, number_of_workers=workers #debugger = "xterm", #redirection = "none" ) gravity.parameters.epsilon_squared = 0.00001 | units.AU**2 return gravity
def new_octgrav(): result = Octgrav(self.converter) result.parameters.epsilon_squared = self.gas_epsilon**2 return result
sat_one.velocity = units.ms(np.array((0.0, 27359 / 3.6, 0.0))) sat_two = stars[2] sat_two.mass = units.kg(1000) sat_two.radius = units.m(10) sat_two.position = units.km(np.array((6371 + 242, 100.0, 0.0))) sat_two.velocity = units.ms(np.array((0.0, 27359 / 3.6, 0.0))) convert_nbody = nbody_system.nbody_to_si(5.9736e24 | units.kg, 6371 | units.km) s = Viewer(stars, (640, 480), convert_nbody) #stars.scale_to_standard() if method == 'octgrav': gravity = Octgrav() elif method == 'phigrape': gravity = PhiGRAPE(convert_nbody) elif method == 'bhtree': gravity = BHTree(convert_nbody, number_of_workes=workers) elif method == 'hermite': gravity = Hermite(convert_nbody, number_of_workers=workers #debugger = "xterm", #redirection = "none" ) gravity.initialize_code() gravity.parameters.epsilon_squared = 0.001 | nbody_system.length**2 #stars.radius = 0.000001 | nbody_system.length gravity.particles.add_particles(stars)
XC = XRES / 2.0 YC = YRES / 2.0 ZC = ZRES / 2.0 if __name__ == "__main__": nstars = int(sys.argv[1]) workers = int(sys.argv[2]) method = sys.argv[3] print nstars seed = None stars = new_plummer_model( nstars) #, convert_nbody, random_state = seed).result if method == 'octgrav': gravity = Octgrav() elif method == 'phigrape': gravity = PhiGRAPE(PhiGRAPE.NBODY) elif method == 'bhtree': gravity = BHTree(number_of_workes=workers) elif method == 'hermite': gravity = Hermite(number_of_workers=workers #debugger = "xterm", #redirection = "none" ) gravity.initialize_code() gravity.parameters.epsilon_squared = 0.001 | nbody_system.length**2 stars.radius = 0.000001 | nbody_system.length gravity.particles.add_particles(stars) gravity.stopping_conditions.pair_detection.enable()