odisseo.potentials module#
- odisseo.potentials.MyamotoNagai(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a MyamotoNagai disk profile.
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy of the MyamotoNagai profile. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to MyamotoNagai external potential. - Potential (jnp.ndarray): Potential energy of all particles due to MyamotoNagai external potential. Returned only if return_potential is True.
- odisseo.potentials.NFW(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a NFW profile.
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy of the NFW profile. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to NFW external potential. - Potential (jnp.ndarray): Potential energy of all particles due to NFW external potential. Returned only if return_potential is True.
- odisseo.potentials.PowerSphericalPotentialwCutoff(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a power spherical potential with cutoff. taken from galax: GalacticDynamics/galax
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy of the power spherical potential. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to power spherical external potential. - Potential (jnp.ndarray): Potential energy of all particles due to power spherical external potential. Returned only if return_potential is True.
- odisseo.potentials.Thick_MN3DiskPotential(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration and potential of all particles due to a thin disk approximated by 3 Miyamoto-Nagai potentials. Inspired by: https://gala.adrian.pw/en/latest/_modules/gala/potential/potential/builtin/core.html#MN3ExponentialDiskPotential. Original paper: Smith et al. (2015) <https://ui.adsabs.harvard.edu/abs/2015MNRAS.448.2934S/abstract>
- Parameters:
state (jnp.ndarray) – (N_particles, 2, 3) positions and velocities.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool) – If True, also returns the potential.
- Returns:
jnp.ndarray – Acceleration (N_particles, 3) jnp.ndarray: Potential (N_particles,) if return_potential is True
- odisseo.potentials.Thin_MN3DiskPotential(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration and potential of all particles due to a thin disk approximated by 3 Miyamoto-Nagai potentials. Inspired by: https://gala.adrian.pw/en/latest/_modules/gala/potential/potential/builtin/core.html#MN3ExponentialDiskPotential. Original paper: Smith et al. (2015) <https://ui.adsabs.harvard.edu/abs/2015MNRAS.448.2934S/abstract>
- Parameters:
state (jnp.ndarray) – (N_particles, 2, 3) positions and velocities.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool) – If True, also returns the potential.
- Returns:
jnp.ndarray – Acceleration (N_particles, 3) jnp.ndarray: Potential (N_particles,) if return_potential is True
- odisseo.potentials.TriaxialNFW(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a Triaxial NFW profile. This code is heavily inspired by the implementation in galax: GalacticDynamics/galax
- The density is given by:
rho(xi) = rho_0 / (xi/r_s) / (1 + xi/r_s)^2
- where:
xi^2 = x^2 + y^2/q1^2 + z^2/q2^2
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to Triaxial NFW external potential. - Potential (jnp.ndarray): Potential energy of all particles. Returned only if return_potential is True.
- odisseo.potentials.TwoPowerTriaxialPotential(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
- General triaxial two-power-law potential:
rho(x,y,z) = amp/(4*pi*a^3) * 1/(m/a)^alpha * 1/(1+m/a)^(beta-alpha) m^2 = x^2 + y^2/b^2 + z^2/c^2
- Parameters:
state – (N_particles, 2, 3) positions and velocities.
config – Configuration parameters.
params – Simulation parameters.
return_potential – If True, also returns the potential.
- Returns:
acc – (N_particles, 3) acceleration pot: (N_particles,) potential (if return_potential)
- odisseo.potentials.call_MyamotoNagai(state: Array, M: float | Array, a: float | Array, b: float | Array, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a MyamotoNagai disk profile. It is used as base function for MN3 approximation of douoble exponential disk. This function exposes directly the a, b and M parameters intstead of calling the params of the simulation
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy of the MyamotoNagai profile. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to MyamotoNagai external potential. - Potential (jnp.ndarray): Potential energy of all particles due to MyamotoNagai external potential. Returned only if return_potential is True.
- odisseo.potentials.combined_external_acceleration_vmpa_switch(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute the total acceleration of all particles due to all external potentials. Vectorized way
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles,2,3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool) – If True, also returns the total potential energy of all external potentials.
- Returns:
jnp.ndarray – Total acceleration of all particles due to all external potentials if return_potential is False. Tuple: Total acceleration and total potential energy of all particles due to all external potentials if return_potential is True.
- odisseo.potentials.logarithmic_potential(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a logarithmic potential.
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy of the logarithmic potential. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to logarithmic external potential. - Potential (jnp.ndarray): Potential energy of all particles due to logarithmic external potential. Returned only if return_potential is True.
- odisseo.potentials.point_mass(state: Array, config: SimulationConfig, params: SimulationParams, return_potential=False)[source]#
Compute acceleration of all particles due to a point mass potential.
- Parameters:
state (jnp.ndarray) – Array of shape (N_particles, 2, 3) representing the positions and velocities of the particles.
config (NamedTuple) – Configuration parameters.
params (NamedTuple) – Simulation parameters.
return_potential (bool, optional) – If True, also returns the potential energy of the point mass potential. Defaults to False.
- Returns:
Tuple[jnp.ndarray, jnp.ndarray] – - Acceleration (jnp.ndarray): Acceleration of all particles due to point mass external potential. - Potential (jnp.ndarray): Potential energy of all particles due to point mass external potential. Returned only if return_potential is True.