Commit 48bb7c68 authored by Loic Hausammann's avatar Loic Hausammann Committed by Matthieu Schaller

Sf crash if no star

parent 3502cdb5
...@@ -1458,7 +1458,7 @@ with_subgrid_pressure_floor=none ...@@ -1458,7 +1458,7 @@ with_subgrid_pressure_floor=none
with_subgrid_stars=none with_subgrid_stars=none
with_subgrid_star_formation=none with_subgrid_star_formation=none
with_subgrid_feedback=none with_subgrid_feedback=none
with_subgrid_task_order=none with_subgrid_task_order=default
case "$with_subgrid" in case "$with_subgrid" in
yes) yes)
...@@ -1475,7 +1475,7 @@ case "$with_subgrid" in ...@@ -1475,7 +1475,7 @@ case "$with_subgrid" in
with_subgrid_feedback=GEAR with_subgrid_feedback=GEAR
with_subgrid_black_holes=none with_subgrid_black_holes=none
# GEAR's order is not used anymore # GEAR's order is not used anymore
with_subgrid_task_order=none with_subgrid_task_order=default
enable_fof=no enable_fof=no
;; ;;
EAGLE) EAGLE)
...@@ -2009,7 +2009,7 @@ EAGLE) ...@@ -2009,7 +2009,7 @@ EAGLE)
AC_DEFINE([TASK_ORDER_EAGLE], [1], [EAGLE task order]) AC_DEFINE([TASK_ORDER_EAGLE], [1], [EAGLE task order])
;; ;;
default) 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) GEAR)
AC_DEFINE([TASK_ORDER_GEAR], [1], [GEAR task order]) AC_DEFINE([TASK_ORDER_GEAR], [1], [GEAR task order])
......
...@@ -171,6 +171,7 @@ int main(int argc, char *argv[]) { ...@@ -171,6 +171,7 @@ int main(int argc, char *argv[]) {
int with_structure_finding = 0; int with_structure_finding = 0;
int with_logger = 0; int with_logger = 0;
int with_eagle = 0; int with_eagle = 0;
int with_gear = 0;
int verbose = 0; int verbose = 0;
int nr_threads = 1; int nr_threads = 1;
int with_verbose_timers = 0; int with_verbose_timers = 0;
...@@ -239,6 +240,13 @@ int main(int argc, char *argv[]) { ...@@ -239,6 +240,13 @@ int main(int argc, char *argv[]) {
"--star-formation --cooling --feedback --black-holes --fof.", "--star-formation --cooling --feedback --black-holes --fof.",
NULL, 0, 0), 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_GROUP(" Control options:\n"),
OPT_BOOLEAN('a', "pin", &with_aff, OPT_BOOLEAN('a', "pin", &with_aff,
"Pin runners using processor affinity.", NULL, 0, 0), "Pin runners using processor affinity.", NULL, 0, 0),
...@@ -310,6 +318,18 @@ int main(int argc, char *argv[]) { ...@@ -310,6 +318,18 @@ int main(int argc, char *argv[]) {
with_fof = 1; 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 */ /* Write output parameter file */
if (myrank == 0 && output_parameters_filename != NULL) { if (myrank == 0 && output_parameters_filename != NULL) {
io_write_output_field_parameter(output_parameters_filename); io_write_output_field_parameter(output_parameters_filename);
......
...@@ -261,7 +261,7 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h ...@@ -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.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_iact.h pressure_floor/none/pressure_floor_iact.h \
pressure_floor/GEAR/pressure_floor_struct.h pressure_floor/none/pressure_floor_struct.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 # Sources and special flags for the gravity library
......
...@@ -356,6 +356,13 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { ...@@ -356,6 +356,13 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
logger_mask_data[logger_consts].mask, logger_mask_data[logger_consts].mask,
/* special flags */ 0); /* special flags */ 0);
#endif #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);
} }
} }
......
...@@ -739,4 +739,17 @@ __attribute__((always_inline)) INLINE static void star_formation_split_part( ...@@ -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; 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 */ #endif /* SWIFT_EAGLE_STAR_FORMATION_H */
...@@ -309,4 +309,20 @@ __attribute__((always_inline)) INLINE static void star_formation_split_part( ...@@ -309,4 +309,20 @@ __attribute__((always_inline)) INLINE static void star_formation_split_part(
error("Loic: to be implemented"); 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 */ #endif /* SWIFT_GEAR_STAR_FORMATION_H */
...@@ -238,4 +238,16 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, ...@@ -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( __attribute__((always_inline)) INLINE static void star_formation_split_part(
struct part* p, struct xpart* xp, const double n) {} 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 */ #endif /* SWIFT_NONE_STAR_FORMATION_H */
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
/* Local includes */ /* Local includes */
#include "scheduler.h" #include "scheduler.h"
#ifdef TASK_ORDER_NONE #ifdef TASK_ORDER_DEFAULT
#include "task_order/none/task_order.h" #include "task_order/default/task_order.h"
#elif TASK_ORDER_GEAR #elif TASK_ORDER_GEAR
#include "task_order/GEAR/task_order.h" #include "task_order/GEAR/task_order.h"
#elif TASK_ORDER_EAGLE #elif TASK_ORDER_EAGLE
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
******************************************************************************/ ******************************************************************************/
#ifndef SWIFT_TASK_ORDER_NONE_H #ifndef SWIFT_TASK_ORDER_DEFAULT_H
#define SWIFT_TASK_ORDER_NONE_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 * @brief Defines the order of the subgrid tasks when no subgrid model has
* been specified. Defaults to the EAGLE model. * been specified. Defaults to the EAGLE model.
*/ */
...@@ -74,4 +74,4 @@ INLINE static void task_order_addunlock_cooling(struct scheduler *s, ...@@ -74,4 +74,4 @@ INLINE static void task_order_addunlock_cooling(struct scheduler *s,
scheduler_addunlock(s, c->hydro.cooling, c->super->kick2); scheduler_addunlock(s, c->hydro.cooling, c->super->kick2);
} }
#endif /* SWIFT_TASK_ORDER_NONE_H */ #endif /* SWIFT_TASK_ORDER_DEFAULT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment