DirectNBody#

class gala.dynamics.nbody.DirectNBody(w0, particle_potentials, external_potential=None, frame=None, units=None, save_all=True)[source]#

Bases: object

Perform orbit integration using direct N-body forces between particles, optionally in an external background potential.

TODO: could add another option, like in other contexts, for “extra_force” to support, e.g., dynamical friction

Parameters:
w0PhaseSpacePosition

The particle initial conditions.

partcle_potentialslist

List of potential objects to add mass or mass distributions to the particles. Use None to treat particles as test particles.

external_potentialPotentialBase subclass instance (optional)

The background or external potential to integrate the particle orbits in.

frameFrameBase subclass (optional)

The reference frame to perform integratiosn in.

unitsUnitSystem (optional)

Set of non-reducable units that specify (at minimum) the length, mass, time, and angle units.

save_allbool (optional)

Save the full orbits of each particle. If False, only returns the final phase-space positions of each particle.

Attributes Summary

w0

Methods Summary

acceleration([t])

Compute the acceleration at the location of each N body, including the external potential.

integrate_orbit([Integrator, Integrator_kwargs])

Integrate the initial conditions in the combined external potential plus N-body forces.

Attributes Documentation

w0#

Methods Documentation

acceleration(t=0.0)[source]#

Compute the acceleration at the location of each N body, including the external potential.

integrate_orbit(Integrator=None, Integrator_kwargs=None, **time_spec)[source]#

Integrate the initial conditions in the combined external potential plus N-body forces.

This integration uses the DOPRI853Integrator.

Parameters:
IntegratorIntegrator, str (optional)

Integrator class to use, or a string name like ‘leapfrog’, ‘dopri853’, ‘ruth4’.

Integrator_kwargsdict (optional)

Any extra keyword arguments to pass to the integrator class when initializing. For example, you can pass in the atol and rtol keyword arguments to set the absolute and relative tolerances for the DOPRI853 integrator.

**time_spec

Specification of how long to integrate. See documentation for parse_time_specification.

Returns:
orbitOrbit

The orbits of the particles.