diff --git a/examples/main.c b/examples/main.c index 3cd20787b1db8a951247b27b21aed421c8ed5c69..7c447c51b4e7e1211e9156b0dbcf60c06ca0e63f 100644 --- a/examples/main.c +++ b/examples/main.c @@ -315,7 +315,7 @@ int main(int argc, char *argv[]) { with_black_holes = 1; with_fof = 1; } - if(with_qla) { + if (with_qla) { with_hydro = 1; with_self_gravity = 1; with_stars = 1; diff --git a/src/runner_others.c b/src/runner_others.c index 0ae254b2c08a5f2208bc365fdfdb79605215f123..5ee054715473236059e9e2b6a984b2dd15153b83 100644 --- a/src/runner_others.c +++ b/src/runner_others.c @@ -329,7 +329,13 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { #endif /* Convert the gas particle to a star particle */ - struct spart *sp = cell_convert_part_to_spart(e, c, p, xp); + struct spart *sp = NULL; + + if (swift_star_formation_model_creates_stars) { + sp = cell_convert_part_to_spart(e, c, p, xp); + } else { + cell_convert_part_to_gpart(e, c, p, xp); + } /* Did we get a star? (Or did we run out of spare ones?) */ if (sp != NULL) { diff --git a/src/space.c b/src/space.c index 35580484198dd2bd4817d2f339c19cdf7b7043dc..b63a261aab5cfb0ee412085192ca6e50e8dc34ba 100644 --- a/src/space.c +++ b/src/space.c @@ -5072,7 +5072,8 @@ void space_init(struct space *s, struct swift_params *params, #endif /* Do we want any spare particles for on the fly creation? */ - if (!star_formation) space_extra_sparts = 0; + if (!star_formation || !swift_star_formation_model_creates_stars) + space_extra_sparts = 0; /* Build the cells recursively. */ if (!dry_run) space_regrid(s, verbose); diff --git a/src/star_formation.h b/src/star_formation.h index cef8194a8942c54622253fa6d6106e4e5e7a9168..3ac28ad02b557aa06ba03e9c43da0d6f511a56f7 100644 --- a/src/star_formation.h +++ b/src/star_formation.h @@ -32,12 +32,16 @@ /* Import the right star formation law definition */ #if defined(STAR_FORMATION_NONE) +#define swift_star_formation_model_creates_stars 1 #include "./star_formation/none/star_formation.h" #elif defined(STAR_FORMATION_QLA) +#define swift_star_formation_model_creates_stars 0 #include "./star_formation/QLA/star_formation.h" #elif defined(STAR_FORMATION_EAGLE) +#define swift_star_formation_model_creates_stars 1 #include "./star_formation/EAGLE/star_formation.h" #elif defined(STAR_FORMATION_GEAR) +#define swift_star_formation_model_creates_stars 1 #include "./star_formation/GEAR/star_formation.h" #else #error "Invalid choice of star formation law"