diff --git a/configure.ac b/configure.ac index eff47c85f76c19176619476fc3f01783156a6765..48c66cf3beb9d5632b307938aa44bde1cd6958c2 100644 --- a/configure.ac +++ b/configure.ac @@ -1458,7 +1458,7 @@ with_subgrid_pressure_floor=none with_subgrid_stars=none with_subgrid_star_formation=none with_subgrid_feedback=none -with_subgrid_task_order=none +with_subgrid_task_order=default case "$with_subgrid" in yes) @@ -1475,7 +1475,7 @@ case "$with_subgrid" in with_subgrid_feedback=GEAR with_subgrid_black_holes=none # GEAR's order is not used anymore - with_subgrid_task_order=none + with_subgrid_task_order=default enable_fof=no ;; EAGLE) @@ -2009,7 +2009,7 @@ EAGLE) AC_DEFINE([TASK_ORDER_EAGLE], [1], [EAGLE task order]) ;; default) -AC_DEFINE([TASK_ORDER_NONE], [1], [Default (i.e. EAGLE/OWLS) task order]) +AC_DEFINE([TASK_ORDER_DEFAULT], [1], [Default (i.e. EAGLE/OWLS) task order]) ;; GEAR) AC_DEFINE([TASK_ORDER_GEAR], [1], [GEAR task order]) diff --git a/examples/main.c b/examples/main.c index e57a062f2cb450bdb4599f412a194b0f358ae68b..770bdd790d91065407de762e4afd4c3cb429ebab 100644 --- a/examples/main.c +++ b/examples/main.c @@ -171,6 +171,7 @@ int main(int argc, char *argv[]) { int with_structure_finding = 0; int with_logger = 0; int with_eagle = 0; + int with_gear = 0; int verbose = 0; int nr_threads = 1; int with_verbose_timers = 0; @@ -239,6 +240,13 @@ int main(int argc, char *argv[]) { "--star-formation --cooling --feedback --black-holes --fof.", NULL, 0, 0), + OPT_BOOLEAN( + 0, "gear", &with_gear, + "Run with all the options needed for the GEAR model. This is " + "equivalent to --hydro --limiter --sync --self-gravity --stars " + "--star-formation --cooling --feedback.", + NULL, 0, 0), + OPT_GROUP(" Control options:\n"), OPT_BOOLEAN('a', "pin", &with_aff, "Pin runners using processor affinity.", NULL, 0, 0), @@ -310,6 +318,18 @@ int main(int argc, char *argv[]) { with_fof = 1; } + /* Deal with GEAR */ + if (with_gear) { + with_hydro = 1; + with_timestep_limiter = 1; + with_timestep_sync = 1; + with_self_gravity = 1; + with_stars = 1; + with_star_formation = 1; + with_cooling = 1; + with_feedback = 1; + } + /* Write output parameter file */ if (myrank == 0 && output_parameters_filename != NULL) { io_write_output_field_parameter(output_parameters_filename); diff --git a/src/Makefile.am b/src/Makefile.am index 7678220bbf0a05fab3af60248245493c3be9886b..ad4851b02d65b8f523106ec2e909fd6f8436ff68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -261,7 +261,7 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h pressure_floor/GEAR/pressure_floor.h pressure_floor/none/pressure_floor.h \ pressure_floor/GEAR/pressure_floor_iact.h pressure_floor/none/pressure_floor_iact.h \ pressure_floor/GEAR/pressure_floor_struct.h pressure_floor/none/pressure_floor_struct.h \ - task_order/GEAR/task_order.h task_order/EAGLE/task_order.h task_order/none/task_order.h + task_order/GEAR/task_order.h task_order/EAGLE/task_order.h task_order/default/task_order.h # Sources and special flags for the gravity library diff --git a/src/runner_others.c b/src/runner_others.c index 0ae254b2c08a5f2208bc365fdfdb79605215f123..a130caf2224bc078682d51b8de27427392c5440c 100644 --- a/src/runner_others.c +++ b/src/runner_others.c @@ -356,6 +356,13 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { logger_mask_data[logger_consts].mask, /* special flags */ 0); #endif + } else { + + /* Do something about the fact no star could be formed. + Note that in such cases a tree rebuild to create more free + slots has already been triggered by the function + cell_convert_part_to_spart() */ + star_formation_no_spart_available(e, p, xp); } } diff --git a/src/star_formation/EAGLE/star_formation.h b/src/star_formation/EAGLE/star_formation.h index ce680d4ec1f6287300bae00e2cc1f53d0dfabc60..77b3acf3b0eeaec0a4dd96b3fa84cead0167b145 100644 --- a/src/star_formation/EAGLE/star_formation.h +++ b/src/star_formation/EAGLE/star_formation.h @@ -739,4 +739,17 @@ __attribute__((always_inline)) INLINE static void star_formation_split_part( if (xp->sf_data.SFR > 0.) xp->sf_data.SFR /= n; } +/** + * @brief Deal with the case where no spart are available for star formation. + * + * @param e The #engine. + * @param p The #part. + * @param xp The #xpart. + */ +__attribute__((always_inline)) INLINE static void +star_formation_no_spart_available(const struct engine* e, const struct part* p, + const struct xpart* xp) { + /* Nothing to do, we just skip it and deal with it next step */ +} + #endif /* SWIFT_EAGLE_STAR_FORMATION_H */ diff --git a/src/star_formation/GEAR/star_formation.h b/src/star_formation/GEAR/star_formation.h index 8eb60bf38fc6a6a9e0683de07833621211894054..f2afc77f9d2f72db235a646f335e032069c254cd 100644 --- a/src/star_formation/GEAR/star_formation.h +++ b/src/star_formation/GEAR/star_formation.h @@ -309,4 +309,20 @@ __attribute__((always_inline)) INLINE static void star_formation_split_part( error("Loic: to be implemented"); } +/** + * @brief Deal with the case where no spart are available for star formation. + * + * @param e The #engine. + * @param p The #part. + * @param xp The #xpart. + */ +__attribute__((always_inline)) INLINE static void +star_formation_no_spart_available(const struct engine* e, const struct part* p, + const struct xpart* xp) { + error( + "Failed to get a new particle. Please increase " + "Scheduler:cell_extra_sparts " + "or Scheduler:cell_extra_gparts"); +} + #endif /* SWIFT_GEAR_STAR_FORMATION_H */ diff --git a/src/star_formation/none/star_formation.h b/src/star_formation/none/star_formation.h index 6155d415645dd9829aa2faaec2cadb3cad7bdee3..589cd0f108ca53eb2ef5730a3a76e0536511cfef 100644 --- a/src/star_formation/none/star_formation.h +++ b/src/star_formation/none/star_formation.h @@ -238,4 +238,16 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, __attribute__((always_inline)) INLINE static void star_formation_split_part( struct part* p, struct xpart* xp, const double n) {} +/** + * @brief Deal with the case where no spart are available for star formation. + * + * @param e The #engine. + * @param p The #part. + * @param xp The #xpart. + */ +__attribute__((always_inline)) INLINE static void +star_formation_no_spart_available(const struct engine* e, const struct part* p, + const struct xpart* xp) { + /* Nothing to do, we just skip it and deal with it next step */ +} #endif /* SWIFT_NONE_STAR_FORMATION_H */ diff --git a/src/task_order.h b/src/task_order.h index 7924bc2ee3b33b8195a43926b197a2c5f0ba3d9e..d5d0165732d6ed2f9442b0160048a0383271edfc 100644 --- a/src/task_order.h +++ b/src/task_order.h @@ -24,8 +24,8 @@ /* Local includes */ #include "scheduler.h" -#ifdef TASK_ORDER_NONE -#include "task_order/none/task_order.h" +#ifdef TASK_ORDER_DEFAULT +#include "task_order/default/task_order.h" #elif TASK_ORDER_GEAR #include "task_order/GEAR/task_order.h" #elif TASK_ORDER_EAGLE diff --git a/src/task_order/none/task_order.h b/src/task_order/default/task_order.h similarity index 94% rename from src/task_order/none/task_order.h rename to src/task_order/default/task_order.h index 826999f9dcccf222c67612c50ac3b3c81469b026..511ea5a13abf48fdc3f03227ee7aad8a945f19c5 100644 --- a/src/task_order/none/task_order.h +++ b/src/task_order/default/task_order.h @@ -16,11 +16,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ -#ifndef SWIFT_TASK_ORDER_NONE_H -#define SWIFT_TASK_ORDER_NONE_H +#ifndef SWIFT_TASK_ORDER_DEFAULT_H +#define SWIFT_TASK_ORDER_DEFAULT_H /** - * @file task_order/none/task_order.h + * @file task_order/default/task_order.h * @brief Defines the order of the subgrid tasks when no subgrid model has * been specified. Defaults to the EAGLE model. */ @@ -74,4 +74,4 @@ INLINE static void task_order_addunlock_cooling(struct scheduler *s, scheduler_addunlock(s, c->hydro.cooling, c->super->kick2); } -#endif /* SWIFT_TASK_ORDER_NONE_H */ +#endif /* SWIFT_TASK_ORDER_DEFAULT_H */