From 8931ca118419bf6006dbc7b08b9a42b13a00cd0a Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 29 Jan 2019 13:14:47 +1100
Subject: [PATCH] Updated the ANARCHY-PU scheme with the new required functions
 for entropy floor and star formation.

---
 src/hydro/AnarchyPU/hydro.h      | 17 +++++++++++++++++
 src/hydro/AnarchyPU/hydro_part.h |  8 ++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/hydro/AnarchyPU/hydro.h b/src/hydro/AnarchyPU/hydro.h
index 27501944c8..9bb53f290a 100644
--- a/src/hydro/AnarchyPU/hydro.h
+++ b/src/hydro/AnarchyPU/hydro.h
@@ -362,6 +362,23 @@ hydro_set_physical_internal_energy_dt(struct part *restrict p,
   p->u_dt = du_dt / cosmo->a_factor_internal_energy;
 }
 
+/**
+ * @brief Sets the physical entropy of a particle
+ *
+ * @param p The particle of interest.
+ * @param xp The extended particle data.
+ * @param cosmo Cosmology data structure
+ * @param entropy The physical entropy
+ */
+__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
+    struct part *p, struct xpart *xp, const struct cosmology *cosmo,
+    const float entropy) {
+
+  /* Note there is no conversion from physical to comoving entropy */
+  const float comoving_entropy = entropy;
+  xp->u_full = gas_internal_energy_from_entropy(p->rho, comoving_entropy);
+}
+
 /**
  * @brief Computes the hydro time-step of a given particle
  *
diff --git a/src/hydro/AnarchyPU/hydro_part.h b/src/hydro/AnarchyPU/hydro_part.h
index e25ca44263..9ddd54b67b 100644
--- a/src/hydro/AnarchyPU/hydro_part.h
+++ b/src/hydro/AnarchyPU/hydro_part.h
@@ -33,6 +33,8 @@
 
 #include "chemistry_struct.h"
 #include "cooling_struct.h"
+#include "sftracers_struct.h"
+#include "tracers_struct.h"
 
 /**
  * @brief Particle fields not needed during the SPH loops over neighbours.
@@ -61,6 +63,12 @@ struct xpart {
   /*! Additional data used to record cooling information */
   struct cooling_xpart_data cooling_data;
 
+  /* Additional data used by the tracers */
+  struct tracers_xpart_data tracers_data;
+
+  /* Additional data used by the tracers */
+  struct sftracers_xpart_data sftracers_data;
+
 } SWIFT_STRUCT_ALIGN;
 
 /**
-- 
GitLab