def test5(self):
     print("Test group_bound_particles")
     colliders = self.new_colliders()
     colliders.position = [[0.0, 0.0, 0.0], [1.1, 0.0, 0.0]] | units.RSun
     colliders.velocity = [[0.0, 0.0, 0.0], [10000, 0.0, 0.0]] | units.km / units.s
     stellar = EVtwin()
     stellar.particles.add_particles(colliders)
     
     collision = StellarEncounterInHydrodynamics(7000, None, relax_sph_models=False, verbose=True, 
         star_to_sph_arguments=dict(base_grid_options=dict(type="sobol")))
     collision.dynamical_timescale = zero
     gas_particles = collision.convert_stars(colliders, stellar)
     stellar.stop()
     
     collision.hop = collision.new_hop(gas_particles)
     collision.start_kepler(7 | units.MSun, 10 | units.RSun)
     self.assertTrue(collision.encounter_is_over(gas_particles))
     collision.hop.stop()
     collision.kepler.stop()
     
     groups = collision.groups_after_encounter
     self.assertEqual(len(groups), 2)
     self.assertTrue(4500 < len(groups[0]) < 5000)
     self.assertTrue(1800 < len(groups[1]) < 2000)
     self.assertEqual(len(gas_particles - groups[0] - groups[1]), 346)
     self.assertAlmostEqual(groups[0].center_of_mass()[0], 0 | units.RSun, 1)
     self.assertAlmostEqual(groups[1].center_of_mass()[0], 1.1 | units.RSun, 0)
     self.assertIsOfOrder(groups[1].center_of_mass_velocity()[0], 10000 | units.km / units.s)
Exemple #2
0
 def test5(self):
     print "Test group_bound_particles"
     colliders = self.new_colliders()
     colliders.position = [[0.0, 0.0, 0.0], [1.1, 0.0, 0.0]] | units.RSun
     colliders.velocity = [[0.0, 0.0, 0.0], [10000, 0.0, 0.0]] | units.km / units.s
     stellar = EVtwin()
     stellar.particles.add_particles(colliders)
     
     collision = StellarEncounterInHydrodynamics(7000, None, relax_sph_models=False, verbose=True, 
         star_to_sph_arguments=dict(base_grid_options=dict(type="sobol")))
     collision.dynamical_timescale = zero
     gas_particles = collision.convert_stars(colliders, stellar)
     stellar.stop()
     
     collision.hop = collision.new_hop(gas_particles)
     collision.start_kepler(7 | units.MSun, 10 | units.RSun)
     self.assertTrue(collision.encounter_is_over(gas_particles))
     collision.hop.stop()
     collision.kepler.stop()
     
     groups = collision.groups_after_encounter
     self.assertEqual(len(groups), 2)
     self.assertTrue(4500 < len(groups[0]) < 5000)
     self.assertTrue(1800 < len(groups[1]) < 2000)
     self.assertEqual(len(gas_particles - groups[0] - groups[1]), 346)
     self.assertAlmostEqual(groups[0].center_of_mass()[0], 0 | units.RSun, 1)
     self.assertAlmostEqual(groups[1].center_of_mass()[0], 1.1 | units.RSun, 0)
     self.assertIsOfOrder(groups[1].center_of_mass_velocity()[0], 10000 | units.km / units.s)
 def test4(self):
     print "Test binary_will_collide"
     collision = StellarEncounterInHydrodynamics(None, None, verbose=True)
     collision.dynamical_timescale = zero
     collision.start_kepler(7 | units.MSun, 10 | units.RSun)
     # at periastron, close enough:
     colliders = self.new_colliders()
     colliders.radius = 1 | units.RSun
     self.assertTrue(
         collision.binary_will_collide(colliders[0], colliders[1]))
     # at periastron, distance too large:
     colliders.radius = 0.4 | units.RSun
     self.assertFalse(
         collision.binary_will_collide(colliders[0], colliders[1]))
     # at apastron, will collide at periastron:
     colliders.velocity = [[0.0, 0.0, 0.0], [0.0, 1000.0, 0.0]
                           ] | units.km / units.s
     self.assertTrue(
         collision.binary_will_collide(colliders[0], colliders[1]))
     # hyperbolic orbits, moving away from each other:
     colliders.position = [[0.0, 0.0, 0.0], [1.0, 100.0, 0.0]] | units.RSun
     self.assertFalse(
         collision.binary_will_collide(colliders[0], colliders[1]))
     # hyperbolic orbits, moving towards each other:
     colliders.velocity = [[0.0, 0.0, 0.0], [0.0, -1000.0, 0.0]
                           ] | units.km / units.s
     self.assertTrue(
         collision.binary_will_collide(colliders[0], colliders[1]))
     collision.kepler.stop()
Exemple #4
0
 def test4(self):
     print "Test binary_will_collide"
     collision = StellarEncounterInHydrodynamics(None, None, verbose=True)
     collision.dynamical_timescale = zero
     collision.start_kepler(7 | units.MSun, 10 | units.RSun)
     # at periastron, close enough:
     colliders = self.new_colliders()
     colliders.radius = 1 | units.RSun
     self.assertTrue(collision.binary_will_collide(colliders[0], colliders[1]))
     # at periastron, distance too large:
     colliders.radius = 0.4 | units.RSun
     self.assertFalse(collision.binary_will_collide(colliders[0], colliders[1]))
     # at apastron, will collide at periastron:
     colliders.velocity = [[0.0, 0.0, 0.0], [0.0, 1000.0, 0.0]] | units.km / units.s
     self.assertTrue(collision.binary_will_collide(colliders[0], colliders[1]))
     # hyperbolic orbits, moving away from each other:
     colliders.position = [[0.0, 0.0, 0.0], [1.0, 100.0, 0.0]] | units.RSun
     self.assertFalse(collision.binary_will_collide(colliders[0], colliders[1]))
     # hyperbolic orbits, moving towards each other:
     colliders.velocity = [[0.0, 0.0, 0.0], [0.0, -1000.0, 0.0]] | units.km / units.s
     self.assertTrue(collision.binary_will_collide(colliders[0], colliders[1]))
     collision.kepler.stop()