Exemple #1
0
def gravity_and_stellar_evolution(number_of_stars, size, end_time, sync_timestep=1|units.Myr, plot_timestep=10|units.Myr):

    stars, converter = create_stars(number_of_stars, size)

    gravity = Hermite(converter)
    stellar = SeBa()
    bridge = Bridge()

    gravity.particles.add_particles(stars)
    stellar.particles.add_particles(stars)

    bridge.add_system(gravity)
    bridge.add_system(stellar)
    bridge.channels.add_channel(stellar.particles.new_channel_to(gravity.particles, attributes=["mass", "radius"]))

    bridge.timestep = sync_timestep

    plot_channels = Channels()
    plot_channels.add_channel(stellar.particles.new_channel_to(stars))
    plot_channels.add_channel(gravity.particles.new_channel_to(stars))

    time = 0 | units.Myr
    while time <= end_time:

        bridge.evolve_model(time)

        plot_channels.copy()
        plot_results(stars, time)

        time += plot_timestep
Exemple #2
0
def gravity_and_stellar_evolution(number_of_stars,
                                  size,
                                  end_time,
                                  sync_timestep=1 | units.Myr,
                                  plot_timestep=10 | units.Myr):

    stars, converter = create_stars(number_of_stars, size)

    gravity = Hermite(converter)
    stellar = SeBa()
    bridge = Bridge()

    gravity.particles.add_particles(stars)
    stellar.particles.add_particles(stars)

    bridge.add_system(gravity)
    bridge.add_system(stellar)
    bridge.channels.add_channel(
        stellar.particles.new_channel_to(gravity.particles,
                                         attributes=["mass", "radius"]))

    bridge.timestep = sync_timestep

    plot_channels = Channels()
    plot_channels.add_channel(stellar.particles.new_channel_to(stars))
    plot_channels.add_channel(gravity.particles.new_channel_to(stars))

    time = 0 | units.Myr
    while time <= end_time:

        bridge.evolve_model(time)

        plot_channels.copy()
        plot_results(stars, time)

        time += plot_timestep
Exemple #3
0
    galactic_code.move_particles_into_ellipictal_orbit(MasterSet, rinit_from_galaxy_core)
    MS_to_grav_channel.copy()
    #print gravity.particles.x[0].in_(units.kpc)
    #print MasterSet.x[0].in_(units.kpc)

# Initializing the Bridge
    bridge_code = Bridge(verbose=False)
    bridge_code.add_system(multiples_code, (galactic_code,))
    #bridge_code.add_system(gravity, (galactic_code,))
    #bridge_code.add_system(multiples_code, ())
    bridge_code.add_system(sev_code, (multiples_code,))

# Stating the AMUSE Channel for Bridge to Have SeBa and Multiples Interact
    bridge_code.channels.add_channel(sev_code.particles.new_channel_to(multiples_code.particles, 
                                     attributes=["mass"]))
    bridge_code.timestep = delta_t

# Alerts the Terminal User that the Run has Started!
    print '\n [UPDATE] Run Started at %s!' %(tp.strftime("%Y/%m/%d-%H:%M:%S", tp.gmtime()))
    print '-------------'
    sys.stdout.flush()
    E0 = print_diagnostics(multiples_code)

# Creates the Log File and Redirects all Print Statements
    orig_stdout = sys.stdout
    log_dir = os.getcwd()+"/Logs"
    if not os.path.exists(log_dir):
        os.makedirs(log_dir)
    f = file(log_dir+"/%s_%s.log" %(cluster_name, tp.strftime("%y%m%d", tp.gmtime())), 'w')
    sys.stdout = f