Exemplo n.º 1
0
def compute_orbits_static(halo1,
                          halo2,
                          d0   = 140.,     #kpc
                          tmax   = 1E9,    #yr
                          Nsteps = 10,     #number of time steps
                          dG   = 0.3,      #(unitless)
                          #                #halo toward larger one
                          theta = pi/4,    #angle of disk to infall (radians)
                          rmin  = 0.0,
                          rdisk = 4.,      #radius of disk (kpc)
                          Nstars = 10,     #number of stars
                          **kwargs):
    halo1.M *= -dG #make halo repel with the correct force

    fprime = fprime_halos((halo1,(0,0,-d0)),(halo2,(0,0,0)))

    #pos and vel are shape (3,Nstars)
    pos,vel = get_initial_params(halo2.vc,
                                 Nstars = Nstars,
                                 theta = theta,
                                 rdisk = rdisk,
                                 rmin = rmin,
                                 **kwargs)

    t = numpy.linspace(0,tmax,Nsteps+1)

    return integrate_orbits(fprime, pos, vel, t)
Exemplo n.º 2
0
def compute_orbits(halo1,
                   halo2,
                   d0   = 140.,     #kpc
                   v0   = 0.,       #km/s : initial velocity of 
                   tmax   = 1E9,    #yr
                   Nsteps = 10,     #number of time steps
                   dG   = 0.3,      #(unitless)
                   #                #halo toward larger one
                   theta = pi/4,    #angle of disk to infall (radians)
                   rmin  = 0.0,
                   rdisk = 4.,      #radius of disk (kpc)
                   Nstars = 10,     #number of stars
                   **kwargs):
    fprime = fprime_halo_pos(halo1,halo2,dG)

    #pos and vel are shape (3,Nstars)
    pos,vel = get_initial_params(halo2.vc,
                                 Nstars = Nstars,
                                 theta = theta,
                                 rdisk = rdisk,
                                 rmin = rmin,
                                 **kwargs)

    t = numpy.linspace(0,tmax,Nsteps+1)

    pos_all = numpy.zeros((6,Nstars))
    vel_all = numpy.zeros((6,Nstars))

    #switched pos and vel: fix this later
    pos_all[:3] = pos
    pos_all[3:] = vel
    vel_all[2] = d0
    vel_all[5] = -v0

    return integrate_orbits(fprime, pos_all, vel_all, t)