From 7263d03fad15e4b7421a9e31ac48d9edba7db619 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Sun, 3 Feb 2019 05:00:30 +0100
Subject: [PATCH] Remove the debugging information from the snapshots and
 stdout.

---
 src/runner.c                                  |  6 +++---
 src/star_formation/EAGLE/star_formation.h     | 19 +++++++------------
 src/star_formation/EAGLE/star_formation_io.h  |  5 +----
 .../EAGLE/star_formation_struct.h             |  3 ---
 src/stars/EAGLE/stars.h                       |  3 +--
 src/stars/EAGLE/stars_io.h                    | 10 ++++------
 src/stars/EAGLE/stars_part.h                  |  3 ---
 7 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/src/runner.c b/src/runner.c
index 425f98279d..1087b5a397 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -522,9 +522,9 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
           dt_star = get_timestep(p->time_bin, time_base);
         }
 
-        if (star_formation_convert_to_star(e, starform, p, xp, constants, cosmo,
-                                           hydro_props, us, cooling, dt_star,
-                                           with_cosmology)) {
+        if (star_formation_should_convert_to_star(
+                e, starform, p, xp, constants, cosmo, hydro_props, us, cooling,
+                dt_star, with_cosmology)) {
           /* Convert your particle to a star */
           struct spart *sp = cell_convert_part_to_spart(e, c, p, xp);
 
diff --git a/src/star_formation/EAGLE/star_formation.h b/src/star_formation/EAGLE/star_formation.h
index ceb440250b..8b32332865 100644
--- a/src/star_formation/EAGLE/star_formation.h
+++ b/src/star_formation/EAGLE/star_formation.h
@@ -212,7 +212,7 @@ INLINE static float EOS_temperature(const float n_H,
  * @param cooling The cooling data struct.
  *
  */
-INLINE static int star_formation_potential_to_become_star(
+INLINE static int star_formation_is_star_forming(
     const struct star_formation* starform, const struct part* restrict p,
     const struct xpart* restrict xp, const struct phys_const* const phys_const,
     const struct cosmology* cosmo,
@@ -277,7 +277,7 @@ INLINE static int star_formation_potential_to_become_star(
  * @param dt_star The time-step of this particle.
  * @param with_cosmology Are we running with cosmology on?
  */
-INLINE static int star_formation_convert_to_star(
+INLINE static int star_formation_should_convert_to_star(
     const struct engine* e, const struct star_formation* starform,
     const struct part* restrict p, struct xpart* restrict xp,
     const struct phys_const* const phys_const, const struct cosmology* cosmo,
@@ -287,10 +287,12 @@ INLINE static int star_formation_convert_to_star(
     const int with_cosmology) {
 
   /* Abort early if time-step size is 0 */
-  if (dt_star == 0.f) return 0;
+  if (dt_star == 0.f) {
+    return 0;
+  }
 
-  if (star_formation_potential_to_become_star(
-          starform, p, xp, phys_const, cosmo, hydro_props, us, cooling)) {
+  if (star_formation_is_star_forming(starform, p, xp, phys_const, cosmo,
+                                     hydro_props, us, cooling)) {
 
     /* Hydrogen number density of this particle */
     const double physical_density = hydro_get_physical_density(p, cosmo);
@@ -322,7 +324,6 @@ INLINE static int star_formation_convert_to_star(
 
     /* Store the SFR */
     xp->sf_data.SFR = SFRpergasmass * p->mass;
-    xp->sf_data.sSFR = SFRpergasmass;
 
     /* Calculate the propability of forming a star */
     const double prop = SFRpergasmass * dt_star;
@@ -339,10 +340,8 @@ INLINE static int star_formation_convert_to_star(
   if (xp->sf_data.SFR > 0.f) {
     if (with_cosmology) {
       xp->sf_data.SFR = -cosmo->a;
-      xp->sf_data.sSFR = 0.f;
     } else {
       xp->sf_data.SFR = -e->time;
-      xp->sf_data.sSFR = 0.f;
     }
   }
 
@@ -389,10 +388,6 @@ INLINE static void star_formation_copy_properties(
 
   /* Store the birth density in the star particle */
   sp->birth_density = hydro_get_physical_density(p, cosmo);
-
-  sp->new_star_flag = 1;
-
-  message("A star has been formed!");
 }
 
 /**
diff --git a/src/star_formation/EAGLE/star_formation_io.h b/src/star_formation/EAGLE/star_formation_io.h
index 04534c2432..cee96326e4 100644
--- a/src/star_formation/EAGLE/star_formation_io.h
+++ b/src/star_formation/EAGLE/star_formation_io.h
@@ -41,10 +41,7 @@ __attribute__((always_inline)) INLINE static int star_formation_write_particles(
   list[0] =
       io_make_output_field("SFR", FLOAT, 1, UNIT_CONV_SFR, xparts, sf_data.SFR);
 
-  list[1] = io_make_output_field("sSFR", FLOAT, 1, UNIT_CONV_SSFR, xparts,
-                                 sf_data.sSFR);
-
-  return 2;
+  return 1;
 }
 
 #endif /* SWIFT_STAR_FORMATION_EAGLE_IO_H */
diff --git a/src/star_formation/EAGLE/star_formation_struct.h b/src/star_formation/EAGLE/star_formation_struct.h
index c48fee1288..41247e160a 100644
--- a/src/star_formation/EAGLE/star_formation_struct.h
+++ b/src/star_formation/EAGLE/star_formation_struct.h
@@ -27,9 +27,6 @@ struct star_formation_xpart_data {
 
   /*! Star formation rate */
   float SFR;
-
-  /*! Specific star formation rate */
-  float sSFR;
 };
 
 #endif /* SWIFT_EAGLE_STAR_FORMATION_STRUCT_H */
diff --git a/src/stars/EAGLE/stars.h b/src/stars/EAGLE/stars.h
index 2e94b67a48..4acfef360c 100644
--- a/src/stars/EAGLE/stars.h
+++ b/src/stars/EAGLE/stars.h
@@ -45,8 +45,7 @@ __attribute__((always_inline)) INLINE static void stars_first_init_spart(
     struct spart* sp) {
 
   sp->time_bin = 0;
-  sp->new_star_flag = 0;
-  sp->birth_density = 0.f;
+  sp->birth_density = -1.f;
 }
 
 /**
diff --git a/src/stars/EAGLE/stars_io.h b/src/stars/EAGLE/stars_io.h
index 029fefec51..64fde1a779 100644
--- a/src/stars/EAGLE/stars_io.h
+++ b/src/stars/EAGLE/stars_io.h
@@ -62,7 +62,7 @@ INLINE static void stars_write_particles(const struct spart *sparts,
                                          int *num_fields) {
 
   /* Say how much we want to write */
-  *num_fields = 9;
+  *num_fields = 8;
 
   /* List what we want to write */
   list[0] = io_make_output_field("Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH,
@@ -75,13 +75,11 @@ INLINE static void stars_write_particles(const struct spart *sparts,
                                  sparts, id);
   list[4] = io_make_output_field("SmoothingLength", FLOAT, 1, UNIT_CONV_LENGTH,
                                  sparts, h);
-  list[5] = io_make_output_field("NewStarFlag", INT, 1, UNIT_CONV_NO_UNITS,
-                                 sparts, new_star_flag);
-  list[6] = io_make_output_field("BirthDensity", FLOAT, 1, UNIT_CONV_DENSITY,
+  list[5] = io_make_output_field("BirthDensity", FLOAT, 1, UNIT_CONV_DENSITY,
                                  sparts, birth_density);
-  list[7] = io_make_output_field("Initial_Masses", FLOAT, 1, UNIT_CONV_MASS,
+  list[6] = io_make_output_field("Initial_Masses", FLOAT, 1, UNIT_CONV_MASS,
                                  sparts, mass_init);
-  list[8] = io_make_output_field("Birth_time", FLOAT, 1, UNIT_CONV_TIME, sparts,
+  list[7] = io_make_output_field("Birth_time", FLOAT, 1, UNIT_CONV_TIME, sparts,
                                  birth_time);
 }
 
diff --git a/src/stars/EAGLE/stars_part.h b/src/stars/EAGLE/stars_part.h
index 03b5d89866..3bf02f244b 100644
--- a/src/stars/EAGLE/stars_part.h
+++ b/src/stars/EAGLE/stars_part.h
@@ -70,9 +70,6 @@ struct spart {
   /*! Birth density */
   float birth_density;
 
-  /*! New star flag */
-  int new_star_flag;
-
   /*! Tracer structure */
   struct tracers_xpart_data tracers_data;
 
-- 
GitLab