GR Accelerations#
General Relativity/PPN acceleration model.
These are pythonized/jaxified versions of acceleration models within REBOUNDx, Tamayo et al. (2020) (DOI: 10.1093/mnras/stz2870). The gr_full function is the equivalent of rebx_calculate_gr_full in REBOUNDx, which is itself based on Newhall et al. (1984) (bibcode: 1983A&A…125..150N) The original code is available at dtamayo/reboundx
Many thanks to the REBOUNDx developers for their work, and for making it open source! Accessed Fall 2024
- jorbit.accelerations.gr.ppn_gravity(inputs, max_iterations=10)[source]#
Compute the acceleration felt by each particle due to PPN gravity.
Equivalent of rebx_calculate_gr_full in reboundx. Uses a structured approach that separates perturber, massive, and tracer contributions to avoid unnecessary N² interactions. Tracer sources (GM=0) are excluded from all computations, reducing the source dimension from P+M+T to P+M.
Note: We use “stop_gradient” on perturbers that are passed as fixed inputs, so any gradients with respect to these perturber quantities will not be correct. To track gradients with respect to perturbers, they must be included as “massive” particles, not “fixed perturbers”.
- Parameters:
inputs (
SystemState) – The instantaneous state of the system.max_iterations (
int) – The maximum number of iterations for the GR corrections to converge.
- Returns:
The 3D acceleration felt by each particle, ordered by massive particles first followed by tracer particles.
- Return type:
Array
- jorbit.accelerations.gr.precompute_perturber_ppn(p_pos, p_vel, p_gms, c2=29979.063823897617)[source]#
Pre-compute perturber-perturber PPN quantities for a single substep.
Computes the P*P perturber-perturber geometry, Newtonian accelerations, gravitational potential sums (a2), and fully converged GR corrections. These can then be passed to static_ppn_gravity_tracer via acceleration_func_kwargs to avoid redundant P*P work in the hot loop.
- Parameters:
p_pos (
Array) – Perturber positions, shape (P, 3).p_vel (
Array) – Perturber velocities, shape (P, 3).p_gms (
Array) – Perturber GM values (not log), shape (P,).c2 (
float) – Speed of light squared.
- Returns:
- Gravitational potential sum per perturber, shape (P,).
Σ_{k≠j} GM_k / (c² r_jk) for each perturber j.
pp_a_newt: Newtonian acceleration on each perturber from others, shape (P, 3). pp_a_gr: Fully converged total GR correction on each perturber, shape (P, 3).
- Return type:
tuple[Array,Array,Array]
- jorbit.accelerations.gr.static_ppn_gravity(inputs, fixed_iterations=3)[source]#
Compute the acceleration felt by each particle due to PPN gravity.
Similar to ppn_gravity, but uses a fixed number of iterations for the GR corrections to converge and contains no logic branching.
- Parameters:
inputs (
SystemState) – The instantaneous state of the system.fixed_iterations (
int) – The fixed number of iterations for the GR corrections to converge. Default is 3.
- Returns:
The 3D acceleration felt by each particle, ordered by massive particles first followed by tracer particles.
- Return type:
Array
- jorbit.accelerations.gr.static_ppn_gravity_tracer(inputs)[source]#
Compute PPN gravity on tracers from perturbers only, avoiding N² scaling.
Optimized for the common case where we only need GR corrections from fixed perturbers onto tracer particles. Skips perturber-perturber interactions entirely, reducing the computation from O(N²) to O(P*T) where P is the number of perturbers and T is the number of tracers.
- Parameters:
inputs (
SystemState) – The instantaneous state of the system. Must have no massive particles (massive_positions.shape[0] == 0).- Returns:
The 3D acceleration felt by each tracer particle, shape (T, 3).
- Return type:
Array