Skip to content

EXP orbit integration yields a large deviation from Gadget simulation #159

Open

Description

@M1ssing-N0

When attempting to predict the orbit of a particle in several EXP potentials representing galaxy components in a Gadget n-body simulation, the particle displays a completely different behavior from the simulation. The particle should remain in a stable orbit around the galaxy center for the duration of the simulation. However after 3 Gyr, the particle escapes from the host galaxy.

I attached my code for plotting the orbit below.

EXP_orbit.zip

Activity

  1. The9Cat commented on Aug 28, 2025

    @The9Cat
    Member

    TL;DR

    The Gadget orbit itself has been 'kicked out' of the galaxy so it seems that pyEXP playback is actually doing a pretty good job here. See more details below...

    Nota Bene

    For anyone else looking at this: I needed to comment out the import of pygadgetreader, needed by load_utils.py but not used in the example notebook.

    A more detailed look at the orbit

    The following two plots show the x, y vs time for the replay and the simulation. I did not have access to the exact times for the orbit grid, so I simply used the array index as a proxy for time.

    Image Image

    The x-y values look fairly similar at early times in this plot. Something clearly happens at later time. Now let's look at the same plots for the z coordinate.

    Image Image

    Again, the two are fairly close at early time but at t>=0.003, the simulation orbit leaves the disk plane, as does the pyEXP orbit. This is the same point where the large deviation begins to be evident in the x-y plane plots.

    Some overall conclusions and comments

    1. The orbits in an n-body system are generally exponentially divergent. We rely confining integrals of motion to get nice rosette orbits, etc., but given that the information about the gravitational field is discretized, the simulation and the playback will exponentially diverge no matter what.
    2. Even for nicely bound disk orbits one will find that they will diverge from the original simulation orbits in some finite number of orbital times. It's part of the physics. One can delay the divergence with denser time sampling of the phase space, but can't eliminate it.
    3. In this particular orbit, it's clear that the Gadget simulation itself has 'kicked out' the orbit. This dynamics is especially exponentially sensitive (i.e. the exact trajectory depends on a sudden change which depends sensitively on time), so a larger deviation between the playback and the simulation should be expected here. One way to think about this is: whatever feature causes the Gadget orbit to be 'kicked' makes a saddle-point in the gravitational field. And saddle points promote strong exponential divergence.
  2. self-assigned this
    on Aug 28, 2025
  3. michael-petersen commented on Nov 25, 2025

    @michael-petersen
    Member

    I'm tempted to close this, as it looks like we understand the issue. Maybe one last chance @M1ssing-N0 to weigh in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions