From 29ba6ed5eab018a306e14c9d67b737e45cd06879 Mon Sep 17 00:00:00 2001
From: Volker Springel <vspringel@mpa-garching.mpg.de>
Date: Tue, 3 Nov 2020 23:28:34 +0100
Subject: [PATCH] added utherm to entroy conversion in Subfind postprocessing
 with gas

---
 src/main/init.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/main/init.cc b/src/main/init.cc
index 3eb3466..addf4ea 100644
--- a/src/main/init.cc
+++ b/src/main/init.cc
@@ -405,6 +405,14 @@ void sim::init(int RestartSnapNum)
       Sp.PS = (subfind_data *)Mem.mymalloc_movable(&Sp.PS, "PS", Sp.MaxPart * sizeof(subfind_data));
       memset(Sp.PS, 0, Sp.MaxPart * sizeof(subfind_data));
 
+      for(int i = 0; i < Sp.NumGas; i++)
+        {
+          if(ThisTask == 0 && i == 0)
+            printf("INIT: Converting u -> entropy   All.cf_a3inv=%g\n", All.cf_a3inv);
+
+          Sp.SphP[i].Entropy = GAMMA_MINUS1 * Sp.SphP[i].Entropy / pow(Sp.SphP[i].Density * All.cf_a3inv, GAMMA_MINUS1);
+        }
+
       /* First, we save the original location of the particles, in order to be able to revert to this layout later on */
       for(int i = 0; i < Sp.NumPart; i++)
         {
-- 
GitLab