Commit 379c619c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fixed bug in runner_do_end_force().

parent 0dc16751
......@@ -1350,7 +1350,13 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
/* Get a handle on the part. */
struct part *restrict p = &parts[k];
if (part_is_active(p, e)) hydro_end_force(p);
if (part_is_active(p, e)) {
/* First, finish the force loop */
hydro_end_force(p);
if (p->gpart != NULL) gravity_end_force(p->gpart, const_G);
}
}
/* Loop over the g-particles in this cell. */
......@@ -1358,7 +1364,12 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
/* Get a handle on the gpart. */
struct gpart *restrict gp = &gparts[k];
if (gpart_is_active(gp, e)) gravity_end_force(gp, const_G);
if (gp->type == swift_type_dark_matter) {
if (gpart_is_active(gp, e)) gravity_end_force(gp, const_G);
}
#ifdef SWIFT_DEBUG_CHECKS
if (e->policy & engine_policy_self_gravity) {
......@@ -1377,7 +1388,12 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
/* Get a handle on the spart. */
struct spart *restrict sp = &sparts[k];
if (spart_is_active(sp, e)) star_end_force(sp);
if (spart_is_active(sp, e)) {
/* First, finish the force loop */
star_end_force(sp);
gravity_end_force(sp->gpart, const_G);
}
}
}
......
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