diff --git a/src/runner.c b/src/runner.c index 425f98279da8270fbbcc03060c0fae446b116175..1087b5a39750ce8b4ca191d88cab2da41e2efa41 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 ceb440250ba22f49933527eb3da04c7414285be9..8b32332865d97845901df60e642bed458ab744f6 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 04534c243213a031513be58f6435625fdf9ecb4a..cee96326e458d0581af6e62e452ac433dcf407bd 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 c48fee12883a853db053f34246214f129780979c..41247e160a3eddbc9184c59b67cfa2a1d7259a05 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 2e94b67a48cc126cda2cd308dc484ad4b56a077d..4acfef360cedf8993702d27a748a364288052410 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 029fefec51adc4283378273bcb57232de33c4d22..64fde1a779966cc072a750fab89c74c5329bc03b 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 03b5d89866777eb668b3ff1411d538072703c956..3bf02f244b00e1fbb0420e13310b64713d3f60e0 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;