def simulation(par): saturn_a, saturn_e = par rebound.reset() rebound.integrator = "whfast-nocor" rebound.min_dt = 5. rebound.dt = 1. # These parameters are only approximately those of Jupiter and Saturn. sun = rebound.Particle(m=1.) rebound.add(sun) jupiter = rebound.add(primary=sun, m=0.000954, a=5.204, anom=0.600, omega=0.257, e=0.048) saturn = rebound.add(primary=sun, m=0.000285, a=saturn_a, anom=0.871, omega=1.616, e=saturn_e) rebound.move_to_com() rebound.init_megno(1e-16) rebound.integrate(1e3 * 2. * np.pi) return [ rebound.calculate_megno(), 1. / (rebound.calculate_lyapunov() * 2. * np.pi) ] # returns MEGNO and Lypunov timescale in years
def simulation(par): saturn_a, saturn_e = par rebound.reset() rebound.integrator = "whfast-nocor" rebound.dt = 5. # These parameters are only approximately those of Jupiter and Saturn. rebound.add(m=1.) rebound.add(m=0.000954, a=5.204, anom=0.600, omega=0.257, e=0.048) rebound.add(m=0.000285, a=saturn_a, anom=0.871, omega=1.616, e=saturn_e) rebound.move_to_com() rebound.init_megno(1e-16) rebound.integrate(5e2*2.*np.pi) # integrator for 500 years return [rebound.calculate_megno(),1./(rebound.calculat_lyapunov()*2.*np.pi)] # returns MEGNO and Lypunov timescale in years
def simulation(integrator): print("Running "+integrator) with open(integrator+".txt","w") as f: rebound.reset() rebound.set_integrator(integrator) rebound.set_dt(0.2) rebound.add_particle(m=1.) rebound.add_particle(m=0.01, a=1,e=0.1) rebound.add_particle(m=0.01, a=2.) rebound.move_to_center_of_momentum() rebound.init_megno(1e-10) particles = rebound.get_particles() times = np.logspace(2,5,num=1000) for t in times: rebound.integrate(t,0) print("%e %e %e %e %e %e %e %e\n" %(rebound.get_t(), rebound.get_megno(), particles[0].x, particles[1].x, particles[2].x, particles[3].x, particles[4].x, particles[5].x),file=f)
def simulation(integrator): print("Running "+integrator) with open(integrator+".txt","w") as f: rebound.reset() rebound.integrator = integrator rebound.dt = 0.2 rebound.add(m=1.) rebound.add(m=0.01, a=1,e=0.1) rebound.add(m=0.01, a=2.) rebound.move_to_com() rebound.init_megno(1e-10) particles = rebound.particles times = np.logspace(2,5,num=1000) for t in times: rebound.integrate(t,0) print("%e %e %e %e %e %e %e %e\n" %(rebound.t, rebound.calculate_megno(), particles[0].x, particles[1].x, particles[2].x, particles[3].x, particles[4].x, particles[5].x),file=f)
def simulation(par): saturn_a, saturn_e = par rebound.reset() rebound.set_integrator("whfast-nocor") rebound.set_min_dt(5.) rebound.set_dt(1.) # These parameters are only approximately those of Jupiter and Saturn. sun = rebound.Particle(m=1.) rebound.add_particle(sun) jupiter = rebound.add_particle(primary=sun,m=0.000954, a=5.204, anom=0.600, omega=0.257, e=0.048) saturn = rebound.add_particle(primary=sun,m=0.000285, a=saturn_a, anom=0.871, omega=1.616, e=saturn_e) rebound.move_to_center_of_momentum() rebound.init_megno(1e-16) rebound.integrate(1e3*2.*np.pi) return [rebound.get_megno(),1./(rebound.get_lyapunov()*2.*np.pi)] # returns MEGNO and Lypunov timescale in years
def simulation(par): saturn_a, saturn_e = par rebound.reset() rebound.integrator = "whfast-nocor" rebound.dt = 5. # These parameters are only approximately those of Jupiter and Saturn. rebound.add(m=1.) rebound.add(m=0.000954, a=5.204, anom=0.600, omega=0.257, e=0.048) rebound.add(m=0.000285, a=saturn_a, anom=0.871, omega=1.616, e=saturn_e) rebound.move_to_com() rebound.init_megno(1e-16) rebound.integrate(5e2 * 2. * np.pi) # integrator for 500 years return [ rebound.calculate_megno(), 1. / (rebound.calculat_lyapunov() * 2. * np.pi) ] # returns MEGNO and Lypunov timescale in years
def simulation(integrator): print("Running " + integrator) with open(integrator + ".txt", "w") as f: rebound.reset() rebound.integrator = integrator rebound.dt = 0.2 rebound.add(m=1.) rebound.add(m=0.01, a=1, e=0.1) rebound.add(m=0.01, a=2.) rebound.move_to_com() rebound.init_megno(1e-10) particles = rebound.particles times = np.logspace(2, 5, num=1000) for t in times: rebound.integrate(t, 0) print("%e %e %e %e %e %e %e %e\n" % (rebound.t, rebound.calculate_megno(), particles[0].x, particles[1].x, particles[2].x, particles[3].x, particles[4].x, particles[5].x), file=f)