Commit 8c9ff9f2 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'planetary_gravity_fixes' into 'master'

Planetary gravity fixes

Closes #451

See merge request !596
parents 6910ce46 625aefaa
......@@ -2746,6 +2746,9 @@ void engine_link_gravity_tasks(struct engine *e) {
/* Get a pointer to the task. */
struct task *t = &sched->tasks[k];
if(t->type == task_type_none)
continue;
/* Get the cells we act on */
struct cell *ci = t->ci;
struct cell *cj = t->cj;
......
......@@ -240,17 +240,17 @@ INLINE static void gravity_drift(struct gravity_tensors *m, double dt) {
m->CoM[2] += dz;
#ifdef SWIFT_DEBUG_CHECKS
if (m->m_pole.vel[0] > m->m_pole.max_delta_vel[0])
if (m->m_pole.vel[0] > m->m_pole.max_delta_vel[0] * 1.1)
error("Invalid maximal velocity");
if (m->m_pole.vel[0] < m->m_pole.min_delta_vel[0])
if (m->m_pole.vel[0] < m->m_pole.min_delta_vel[0] * 1.1)
error("Invalid minimal velocity");
if (m->m_pole.vel[1] > m->m_pole.max_delta_vel[1])
if (m->m_pole.vel[1] > m->m_pole.max_delta_vel[1] * 1.1)
error("Invalid maximal velocity");
if (m->m_pole.vel[1] < m->m_pole.min_delta_vel[1])
if (m->m_pole.vel[1] < m->m_pole.min_delta_vel[1] * 1.1)
error("Invalid minimal velocity");
if (m->m_pole.vel[2] > m->m_pole.max_delta_vel[2])
if (m->m_pole.vel[2] > m->m_pole.max_delta_vel[2] * 1.1)
error("Invalid maximal velocity");
if (m->m_pole.vel[2] < m->m_pole.min_delta_vel[2])
if (m->m_pole.vel[2] < m->m_pole.min_delta_vel[2] * 1.1)
error("Invalid minimal velocity");
#endif
......
......@@ -1529,7 +1529,6 @@ static INLINE void runner_do_grav_long_range(struct runner *r, struct cell *ci,
/* Flag that contributions will be recieved */
struct gravity_tensors *const multi_i = ci->multipole;
multi_i->pot.interacted = 1;
/* Recover the top-level multipole (for distance checks) */
struct gravity_tensors *const multi_top = top->multipole;
......@@ -1585,6 +1584,9 @@ static INLINE void runner_do_grav_long_range(struct runner *r, struct cell *ci,
runner_dopair_grav_mm(r, ci, cj);
// runner_dopair_recursive_grav_pm(r, ci, cj);
/* Record that this multipole received a contribution */
multi_i->pot.interacted = 1;
} /* We are in charge of this pair */
} /* Loop over top-level cells */
......
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