How to use the rebound.reset function in rebound

To help you get started, we’ve selected a few rebound examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hannorein / rebound / python_examples / longtermtest_mercury / problem.py View on Github external
def simulation(par):
    integrator, run, trial = par
    rebound.reset()
    k = 0.01720209895    
    G = k*k
    rebound.set_G(G)     
    rebound.set_dt(dt)
    rebound.set_integrator(integrator)
    rebound.set_force_is_velocitydependent(0)

    rebound.add_particle(m=1.00000597682, x=-4.06428567034226e-3, y=-6.08813756435987e-3, z=-1.66162304225834e-6, vx=+6.69048890636161e-6, vy=-6.33922479583593e-6, vz=-3.13202145590767e-9)   # Sun
    rebound.add_particle(m=1./1047.355,   x=+3.40546614227466e+0, y=+3.62978190075864e+0, z=+3.42386261766577e-2, vx=-5.59797969310664e-3, vy=+5.51815399480116e-3, vz=-2.66711392865591e-6)   # Jupiter
    rebound.add_particle(m=1./3501.6,     x=+6.60801554403466e+0, y=+6.38084674585064e+0, z=-1.36145963724542e-1, vx=-4.17354020307064e-3, vy=+3.99723751748116e-3, vz=+1.67206320571441e-5)   # Saturn
    rebound.add_particle(m=1./22869.,     x=+1.11636331405597e+1, y=+1.60373479057256e+1, z=+3.61783279369958e-1, vx=-3.25884806151064e-3, vy=+2.06438412905916e-3, vz=-2.17699042180559e-5)   # Uranus
    rebound.add_particle(m=1./19314.,     x=-3.01777243405203e+1, y=+1.91155314998064e+0, z=-1.53887595621042e-1, vx=-2.17471785045538e-4, vy=-3.11361111025884e-3, vz=+3.58344705491441e-5)   # Neptune
#    rebound.add_particle(m=0,             x=-2.13858977531573e+1, y=+3.20719104739886e+1, z=+2.49245689556096e+0, vx=-1.76936577252484e-3, vy=-2.06720938381724e-3, vz=+6.58091931493844e-4)   # Pluto
    N = rebound.get_N()
    particles = rebound.get_particles()
    np.random.seed(run)
github hannorein / rebound / python_examples / longtermtest_dt / problem.py View on Github external
def simulation(par):
    integrator, run, trial = par
    rebound.reset()
    k = 0.01720209895    
    Gfac = 1./k
    rebound.set_dt(dt*pow(2.,trial))
    rebound.set_integrator(integrator)
    rebound.set_force_is_velocitydependent(0)

    massfac = 1.
    rebound.add_particle(m=1.00000597682, x=-4.06428567034226e-3, y=-6.08813756435987e-3, z=-1.66162304225834e-6,      vx=+6.69048890636161e-6*Gfac, vy=-6.33922479583593e-6*Gfac, vz=-3.13202145590767e-9*Gfac)   # Sun
    rebound.add_particle(m=massfac/1407.355,   x=+3.40546614227466e+0, y=+3.62978190075864e+0, z=+3.42386261766577e-2, vx=-5.59797969310664e-3*Gfac, vy=+5.51815399480116e-3*Gfac, vz=-2.66711392865591e-6*Gfac)   # Jupiter
    rebound.add_particle(m=massfac/3501.6,     x=+6.60801554403466e+0, y=+6.38084674585064e+0, z=-1.36145963724542e-1, vx=-4.17354020307064e-3*Gfac, vy=+3.99723751748116e-3*Gfac, vz=+1.67206320571441e-5*Gfac)   # Saturn
    rebound.add_particle(m=massfac/22869.,     x=+1.11636331405597e+1, y=+1.60373479057256e+1, z=+3.61783279369958e-1, vx=-3.25884806151064e-3*Gfac, vy=+2.06438412905916e-3*Gfac, vz=-2.17699042180559e-5*Gfac)   # Uranus
    rebound.add_particle(m=massfac/19314.,     x=-3.01777243405203e+1, y=+1.91155314998064e+0, z=-1.53887595621042e-1, vx=-2.17471785045538e-4*Gfac, vy=-3.11361111025884e-3*Gfac, vz=+3.58344705491441e-5*Gfac)   # Neptune
    N = rebound.get_N()
    particles = rebound.get_particles()
    np.random.seed(run)
    for i in xrange(N):
github hannorein / rebound / python_examples / biastest / problem.py View on Github external
def simulation(par):
    integrator, mass = par
    rebound.reset()
    mass = pow(10.,mass)
    k = 0.01720209895    
    G = k*k
    rebound.G = G     
    rebound.dt = 0.
    rebound.integrator = integrator

    rebound.add(m=1.00000597682, x=-4.06428567034226e-3, y=-6.08813756435987e-3, z=-1.66162304225834e-6, vx=+6.69048890636161e-6, vy=-6.33922479583593e-6, vz=-3.13202145590767e-9)   # Sun
    rebound.add(m=mass,   x=+3.40546614227466e+0, y=+3.62978190075864e+0, z=+3.42386261766577e-2, vx=-5.59797969310664e-3, vy=+5.51815399480116e-3, vz=-2.66711392865591e-6)   # Jupiter
    rebound.add(m=mass,     x=+6.60801554403466e+0, y=+6.38084674585064e+0, z=-1.36145963724542e-1, vx=-4.17354020307064e-3, vy=+3.99723751748116e-3, vz=+1.67206320571441e-5)   # Saturn
    rebound.add(m=mass,     x=+1.11636331405597e+1, y=+1.60373479057256e+1, z=+3.61783279369958e-1, vx=-3.25884806151064e-3, vy=+2.06438412905916e-3, vz=-2.17699042180559e-5)   # Uranus
    rebound.add(m=mass,     x=-3.01777243405203e+1, y=+1.91155314998064e+0, z=-1.53887595621042e-1, vx=-2.17471785045538e-4, vy=-3.11361111025884e-3, vz=+3.58344705491441e-5)   # Neptune
    N = rebound.N

    def move_to_heliocentric():
        particles = rebound.particles
github hannorein / rebound / python_examples / keplerbias / problem.py View on Github external
def simulation(par):
    integrator = par
    rebound.reset()
    k = 0.01720209895    
    G = k*k
    rebound.set_G(G)     
    rebound.set_dt(dt)
    rebound.set_integrator(integrator)

    rebound.add_particle(m=1.00000597682, x=-4.06428567034226e-3, y=-6.08813756435987e-3, z=-1.66162304225834e-6, vx=+6.69048890636161e-6, vy=-6.33922479583593e-6, vz=-3.13202145590767e-9)   # Sun
    rebound.add_particle(m=1./1047.355,   x=+3.40546614227466e+0, y=+3.62978190075864e+0, z=+3.42386261766577e-2, vx=-5.59797969310664e-3, vy=+5.51815399480116e-3, vz=-2.66711392865591e-6)   # Jupiter
#    rebound.add_particle(m=1./3501.6,     x=+6.60801554403466e+0, y=+6.38084674585064e+0, z=-1.36145963724542e-1, vx=-4.17354020307064e-3, vy=+3.99723751748116e-3, vz=+1.67206320571441e-5)   # Saturn
#    rebound.add_particle(m=1./22869.,     x=+1.11636331405597e+1, y=+1.60373479057256e+1, z=+3.61783279369958e-1, vx=-3.25884806151064e-3, vy=+2.06438412905916e-3, vz=-2.17699042180559e-5)   # Uranus
#    rebound.add_particle(m=1./19314.,     x=-3.01777243405203e+1, y=+1.91155314998064e+0, z=-1.53887595621042e-1, vx=-2.17471785045538e-4, vy=-3.11361111025884e-3, vz=+3.58344705491441e-5)   # Neptune
#    rebound.add_particle(m=0,             x=-2.13858977531573e+1, y=+3.20719104739886e+1, z=+2.49245689556096e+0, vx=-1.76936577252484e-3, vy=-2.06720938381724e-3, vz=+6.58091931493844e-4)   # Pluto
    N = rebound.get_N()

    def move_to_heliocentric():
        particles = rebound.get_particles()
github hannorein / rebound / python_examples / speedcomparison / problem.py View on Github external
def simulation(par):
    import rebound
    integrator, dt, run = par
    rebound.reset()
    k = 0.01720209895    
    G = k*k
    rebound.G = G     
    rebound.dt = dt
    if integrator == "whfast-nocor":
        integrator = "whfast"
    else:
        rebound.integrator_whfast_corrector = 11
    rebound.integrator = integrator
    rebound.force_is_velocitydependent = 0

    rebound.add(m=1.00000597682, x=-4.06428567034226e-3, y=-6.08813756435987e-3, z=-1.66162304225834e-6, vx=+6.69048890636161e-6, vy=-6.33922479583593e-6, vz=-3.13202145590767e-9)   # Sun
    rebound.add(m=1./1407.355,   x=+3.40546614227466e+0, y=+3.62978190075864e+0, z=+3.42386261766577e-2, vx=-5.59797969310664e-3, vy=+5.51815399480116e-3, vz=-2.66711392865591e-6)   # Jupiter
    rebound.add(m=1./3501.6,     x=+6.60801554403466e+0, y=+6.38084674585064e+0, z=-1.36145963724542e-1, vx=-4.17354020307064e-3, vy=+3.99723751748116e-3, vz=+1.67206320571441e-5)   # Saturn
    rebound.add(m=1./22869.,     x=+1.11636331405597e+1, y=+1.60373479057256e+1, z=+3.61783279369958e-1, vx=-3.25884806151064e-3, vy=+2.06438412905916e-3, vz=-2.17699042180559e-5)   # Uranus
    rebound.add(m=1./19314.,     x=-3.01777243405203e+1, y=+1.91155314998064e+0, z=-1.53887595621042e-1, vx=-2.17471785045538e-4, vy=-3.11361111025884e-3, vz=+3.58344705491441e-5)   # Neptune
github hannorein / rebound / python_examples / stark / problem.py View on Github external
def simulation(par):
    S, dt,e0 = par

    rebound.reset()
    rebound.integrator = "whfast"
    rebound.dt = dt

    rebound.add(m=1.)
    rebound.add(m=0.,a=1.,e=e0)

    #rebound.move_to_com()
    #rebound.init_megno(1.e-16)


    particles = rebound.particles
    def starkforce(): # need to put inside simulation(par) to have access to S and particles
        particles[1].ax += -S

    rebound.additional_forces = starkforce
github hannorein / rebound / python_examples / 2body / problem.py View on Github external
def simulation(par):
    anom, dt, e, integrator = par

    e = 1.-pow(10.,e)
    dt = pow(10.,dt)*torb

    rebound.reset()
    rebound.integrator = integrator
    rebound.force_is_velocitydependent = 0
    rebound.dt = dt

    rebound.add(m=1.)
    rebound.add(m=0., x=(1.-e), vy=np.sqrt((1.+e)/(1.-e)))
    particles = rebound.particles
    
    Ei = -1./np.sqrt(particles[1].x*particles[1].x+particles[1].y*particles[1].y+particles[1].z*particles[1].z) + 0.5 * (particles[1].vx*particles[1].vx+particles[1].vy*particles[1].vy+particles[1].vz*particles[1].vz)

    rebound.integrate(tmax,exactFinishTime=0,keepSynchronized=1)
    
    Ef = -1./np.sqrt(particles[1].x*particles[1].x+particles[1].y*particles[1].y+particles[1].z*particles[1].z) + 0.5 * (particles[1].vx*particles[1].vx+particles[1].vy*particles[1].vy+particles[1].vz*particles[1].vz)

    return [float(rebound.iter)/rebound.t*dt, np.fabs((Ef-Ei)/Ei)+1e-16, rebound.timing/rebound.t*dt*1e6/2., (Ef-Ei)/Ei]