Skip to content
Snippets Groups Projects
Commit ab6fdfc0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

a[3] --> a_grav[3]

parent 2b3a8386
No related branches found
No related tags found
1 merge request!135First implementation of gpart motion
......@@ -24,5 +24,5 @@ __attribute__((always_inline))
"v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n "
"mass=%.3e t_begin=%d, t_end=%d\n",
p->x[0], p->x[1], p->x[2], p->v_full[0], p->v_full[1], p->v_full[2],
p->a[0], p->a[1], p->a[2], p->mass, p->ti_begin, p->ti_end);
p->a_grav[0], p->a_grav[1], p->a_grav[2], p->mass, p->ti_begin, p->ti_end);
}
......@@ -49,8 +49,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav(
/* Aggregate the accelerations. */
for (k = 0; k < 3; k++) {
w = acc * dx[k];
pi->a[k] -= w * mj;
pj->a[k] += w * mi;
pi->a_grav[k] -= w * mj;
pj->a_grav[k] += w * mi;
}
}
......@@ -100,8 +100,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_vec_grav(
ai.v = w.v * mj.v;
aj.v = w.v * mi.v;
for (j = 0; j < VEC_SIZE; j++) {
pi[j]->a[k] -= ai.f[j];
pj[j]->a[k] += aj.f[j];
pi[j]->a_grav[k] -= ai.f[j];
pj[j]->a_grav[k] += aj.f[j];
}
}
......
......@@ -29,7 +29,7 @@ struct gpart {
float v_full[3];
/* Particle acceleration. */
float a[3];
float a_grav[3];
/* Particle mass. */
float mass;
......
......@@ -127,7 +127,7 @@ __attribute__((always_inline)) INLINE static void multipole_iact_mp(
/* Compute the forces on both multipoles. */
#if multipole_order == 1
for (k = 0; k < 3; k++) p->a[k] += dx[k] * acc;
for (k = 0; k < 3; k++) p->a_grav[k] += dx[k] * acc;
#else
#error( "Multipoles of order %i not yet implemented." , multipole_order )
#endif
......
......@@ -267,9 +267,9 @@ void runner_dograv_down(struct runner *r, struct cell *c) {
/* Apply the multipole acceleration to all gparts. */
for (int k = 0; k < c->gcount; k++) {
struct gpart *p = &c->gparts[k];
p->a[0] += m->a[0];
p->a[1] += m->a[1];
p->a[2] += m->a[2];
p->a_grav[0] += m->a[0];
p->a_grav[1] += m->a[1];
p->a_grav[2] += m->a[2];
}
}
}
......@@ -594,5 +594,4 @@ void runner_dosub_grav(struct runner *r, struct cell *ci, struct cell *cj,
if (gettimer) TIMER_TOC(timer_dosub_grav);
}
#endif /* SWIFT_RUNNER_DOIACT_GRAV_H */
......@@ -300,9 +300,9 @@ void pairs_single_grav(double *dim, long long int pid,
break;
if (k == N) error("Part not found.");
pi = parts[k];
pi.a[0] = 0.0f;
pi.a[1] = 0.0f;
pi.a[2] = 0.0f;
pi.a_grav[0] = 0.0f;
pi.a_grav[1] = 0.0f;
pi.a_grav[2] = 0.0f;
/* Loop over all particle pairs. */
for (k = 0; k < N; k++) {
......@@ -320,15 +320,15 @@ void pairs_single_grav(double *dim, long long int pid,
}
r2 = fdx[0] * fdx[0] + fdx[1] * fdx[1] + fdx[2] * fdx[2];
runner_iact_grav(r2, fdx, &pi, &pj);
a[0] += pi.a[0];
a[1] += pi.a[1];
a[2] += pi.a[2];
aabs[0] += fabsf(pi.a[0]);
aabs[1] += fabsf(pi.a[1]);
aabs[2] += fabsf(pi.a[2]);
pi.a[0] = 0.0f;
pi.a[1] = 0.0f;
pi.a[2] = 0.0f;
a[0] += pi.a_grav[0];
a[1] += pi.a_grav[1];
a[2] += pi.a_grav[2];
aabs[0] += fabsf(pi.a_grav[0]);
aabs[1] += fabsf(pi.a_grav[1]);
aabs[2] += fabsf(pi.a_grav[2]);
pi.a_grav[0] = 0.0f;
pi.a_grav[1] = 0.0f;
pi.a_grav[2] = 0.0f;
}
/* Dump the result. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment