Esempio n. 1
0
def add_comet_objects(pre_tack_giants_system, N_objects, comet_positions,
                      comet_velocities):
    for i in tqdm(range(N_objects)):
        comet = Particles(1)
        comet.name = "OORT_" + str(i)
        comet.mass = 0.0 | units.MSun  #Take massless test particles
        comet.radius = 0.0 | units.RSun
        comet.position = (comet_positions[i, 0], comet_positions[i, 1],
                          comet_positions[i, 2])
        comet.velocity = (comet_velocities[i, 0], comet_velocities[i, 1],
                          comet_velocities[i, 2])
        comet.density = 0.0 | (units.MSun / (units.RSun**3))

        pre_tack_giants_system.add_particle(comet)

    z_comp = np.arctan(
        100 / 8500.
    )  #Determining the z-component of the sun's trajectory around the galactic center

    for i in range(len(pre_tack_giants_system)
                   ):  #adding the sun's trajectory around the galactic center
        pre_tack_giants_system[i].position += (1, 0, 0) * (8.5 | units.kpc)
        pre_tack_giants_system[i].velocity += (0, np.sqrt(1 - z_comp**2),
                                               z_comp) * (220 | units.kms)
    return pre_tack_giants_system
Esempio n. 2
0
def create_system():
    system = new_solar_system()
    system = system[system.mass > 10**-5 | units.MSun] # Takes gas giants and Sun only
    system.move_to_center()
    
    sun = Particles(1)
    sun.name = "Sun"
    sun.mass = 1.0 | units.MSun
    sun.radius = 1.0 | units.RSun  
    sun.position = (0, 0, 0) | units.AU
    sun.velocity = (0, 0, 0) | units.kms
    sun.density = 3*sun.mass/(4*np.pi*sun.radius**3)
    
    names = ["Jupiter", "Saturn", "Uranus", "Neptune"]
    masses = [317.8, 90, 15, 17] | units.MEarth
    radii = [0.10049, 0.083703, 0.036455, 0.035392] | units.RSun
    semis = [5.4, 7.1, 10.5, 13] | units.AU #[3.5, 4.9, 6.4, 8.4]
    trues = [0, 90, 180, 270]| units.deg#np.random.uniform(0, 360, 4) | units.deg
    longs = np.random.uniform(0, 360, 4) | units.deg
    args = np.random.uniform(0, 360, 4) | units.deg
    
    for i in range(4):
        orbital_elements = get_orbital_elements_from_binary(system[0]+ system[i+1], G=constants.G)
        eccentricity, inclination = 0, orbital_elements[5]
        
        
        sun_and_plan = new_binary_from_orbital_elements(sun[0].mass, masses[i], 
                                          semis[i], 0, trues[i], inclination, longs[i], args[i], G=constants.G)
        
        planet = Particles(1)
        planet.name = system[i+1].name
        planet.mass = system[i+1].mass
        planet.radius = system[i+1].radius # This is purely non-zero for collisional purposes
        planet.position = (sun_and_plan[1].x-sun_and_plan[0].x, sun_and_plan[1].y-sun_and_plan[0].y, sun_and_plan[1].z-sun_and_plan[0].z)
        planet.velocity = (sun_and_plan[1].vx-sun_and_plan[0].vx, sun_and_plan[1].vy-sun_and_plan[0].vy, sun_and_plan[1].vz-sun_and_plan[0].vz)
        planet.density = 3*planet.mass/(4*np.pi*planet.radius**3)
        sun.add_particle(planet)
        
    return sun
Esempio n. 3
0
def create_pre_tack_giants_system():
    #Create a pre_tack_giants_system by first recreating the sun.
    pre_tack_giants_system = Particles(1)
    pre_tack_giants_system[0].name = "Sun"
    pre_tack_giants_system[0].mass = 1.0 | units.MSun
    pre_tack_giants_system[0].radius = 1.0 | units.RSun
    pre_tack_giants_system[0].position = (0, 0, 0) | units.AU
    pre_tack_giants_system[0].velocity = (0, 0, 0) | units.kms
    pre_tack_giants_system[0].density = 3 * pre_tack_giants_system[0].mass / (
        4 * np.pi * pre_tack_giants_system[0].radius**3)

    #The pre tack orbital elements for the planets as below
    names = ["Jupiter", "Saturn", "Uranus", "Neptune"]
    masses = np.array([317.8, 30, 5, 5]) | units.MEarth
    radii = np.array([0.10049, 0.083703, 0.036455, 0.035392]) | units.RSun
    a = np.array([3.5, 4.5, 6.013, 8.031]) | units.AU
    inclinations = np.random.uniform(-5, 5, 4) | units.deg
    true_anomalies = np.random.uniform(0, 360, 4) | units.deg
    longs_of_ascending_node = np.random.uniform(0, 360, 4) | units.deg
    args_of_periapsis = np.random.uniform(0, 360, 4) | units.deg

    #Create the four planets as binaries with the sun and add them to the pre_tack_giants_system
    for i in range(4):
        sun_and_planet = new_binary_from_orbital_elements(
            pre_tack_giants_system[0].mass,
            masses[i],
            a[i],
            0,
            true_anomalies[i],
            inclinations[i],
            longs_of_ascending_node[i],
            args_of_periapsis[i],
            G=constants.G)

        planet = Particles(1)
        planet.name = names[i]
        planet.mass = masses[i]
        planet.radius = radii[
            i]  # This is purely non-zero for collisional purposes
        planet.position = (sun_and_planet[1].x - (0 | units.AU),
                           sun_and_planet[1].y - (0 | units.AU),
                           sun_and_planet[1].z - (0 | units.AU))
        planet.velocity = (sun_and_planet[1].vx - (0 | units.kms),
                           sun_and_planet[1].vy - (0 | units.kms),
                           sun_and_planet[1].vz - (0 | units.kms))
        planet.density = 3 * planet.mass / (4 * np.pi * planet.radius**3)
        pre_tack_giants_system.add_particle(planet)

    return pre_tack_giants_system
Esempio n. 4
0
def add_comet_objects(pre_tack_giants_system, N_objects, comet_positions,
                      comet_velocities):
    for i in tqdm(range(N_objects)):
        comet = Particles(1)
        comet.name = "OORT_" + str(i)
        comet.mass = 0.0 | units.MSun  #Take massless test particles
        comet.radius = 0.0 | units.RSun
        comet.position = (comet_positions[i, 0], comet_positions[i, 1],
                          comet_positions[i, 2])
        comet.velocity = (comet_velocities[i, 0], comet_velocities[i, 1],
                          comet_velocities[i, 2])
        comet.density = 0.0 | (units.MSun / (units.RSun**3))

        pre_tack_giants_system.add_particle(comet)
    return pre_tack_giants_system