Commit 357c1014 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'fix_683' into 'master'

Fix to issue 683

Closes #683

See merge request !1095
parents 80e600c2 6a52767f
......@@ -5615,12 +5615,14 @@ struct spart *cell_add_spart(struct engine *e, struct cell *const c) {
lock_lock(&top->stars.star_formation_lock);
/* Are there any extra particles left? */
if (top->stars.count >= top->stars.count_total - 1) {
if (top->stars.count == top->stars.count_total) {
message("We ran out of free star particles!");
/* Release the local lock before exiting. */
if (lock_unlock(&top->stars.star_formation_lock) != 0)
error("Failed to unlock the top-level cell.");
if (top->stars.count == top->stars.count_total - 1)
message("We ran out of star particles!");
atomic_inc(&e->forcerebuild);
return NULL;
}
......@@ -5748,12 +5750,14 @@ struct gpart *cell_add_gpart(struct engine *e, struct cell *c) {
lock_lock(&top->grav.star_formation_lock);
/* Are there any extra particles left? */
if (top->grav.count >= top->grav.count_total - 1) {
if (top->grav.count == top->grav.count_total) {
message("We ran out of free gravity particles!");
/* Release the local lock before exiting. */
if (lock_unlock(&top->grav.star_formation_lock) != 0)
error("Failed to unlock the top-level cell.");
if (top->grav.count == top->grav.count_total - 1)
message("We ran out of gravity particles!");
atomic_inc(&e->forcerebuild);
return NULL;
}
......
......@@ -5125,6 +5125,13 @@ void space_init(struct space *s, struct swift_params *params,
space_extra_sparts = 0;
}
if (star_formation && swift_star_formation_model_creates_stars &&
space_extra_sparts == 0) {
error(
"Running with star formation but without spare star particles. "
"Increase 'Scheduler:cell_extra_sparts'.");
}
/* Build the cells recursively. */
if (!dry_run) space_regrid(s, verbose);
......
Supports Markdown
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