From 927725f9058df69b240f9cb11edb4454bcbbb7ea Mon Sep 17 00:00:00 2001
From: Filip Husko <filip.husko@durham.ac.uk>
Date: Thu, 28 Sep 2023 12:18:14 +0000
Subject: [PATCH] Fix jet initial velocities

---
 src/black_holes/SPIN_JET/black_holes_iact.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/black_holes/SPIN_JET/black_holes_iact.h b/src/black_holes/SPIN_JET/black_holes_iact.h
index 1bc1860d20..8fb0e0d681 100644
--- a/src/black_holes/SPIN_JET/black_holes_iact.h
+++ b/src/black_holes/SPIN_JET/black_holes_iact.h
@@ -1014,8 +1014,10 @@ runner_iact_nonsym_bh_gas_feedback(
       vel_kick_direction[1] = direction * bi->jet_direction[1];
       vel_kick_direction[2] = direction * bi->jet_direction[2];
 
-      /* Get the initial velocity */
-      const float v_init[3] = {xpj->v_full[0], xpj->v_full[1], xpj->v_full[2]};
+      /* Get the initial velocity in the frame of the black hole */
+      const float v_init[3] = {xpj->v_full[0] - bi->v[0],
+                               xpj->v_full[1] - bi->v[1],
+                               xpj->v_full[2] - bi->v[2]};
 
       /* We compute this final velocity by requiring that the final energy and
        * the inital one differ by the energy received by the particle, i.e.
-- 
GitLab