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

Also drift foreign top-level multipoles every time-step

parent 6ea5c6b0
No related branches found
No related tags found
1 merge request!433Correct wrapping of multipoles in FFT task
...@@ -1977,8 +1977,8 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements, ...@@ -1977,8 +1977,8 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements,
const int cjd = cell_getid(cdim, iii, jjj, kkk); const int cjd = cell_getid(cdim, iii, jjj, kkk);
struct cell *cj = &cells[cjd]; struct cell *cj = &cells[cjd];
if(i==11 && j==0 && k==10) /* if(i==11 && j==0 && k==10) */
message("Found direct neighbour: (i,j,k)=(%d,%d,%d) (iii,jjj,kkk)=(%d,%d,%d) nodeID=%d", i,j,k, iii,jjj,kkk, cj->nodeID); /* message("Found direct neighbour: (i,j,k)=(%d,%d,%d) (iii,jjj,kkk)=(%d,%d,%d) nodeID=%d", i,j,k, iii,jjj,kkk, cj->nodeID); */
/* Avoid duplicates of local pairs*/ /* Avoid duplicates of local pairs*/
...@@ -3947,11 +3947,11 @@ void engine_step(struct engine *e) { ...@@ -3947,11 +3947,11 @@ void engine_step(struct engine *e) {
if (e->policy & engine_policy_self_gravity) { if (e->policy & engine_policy_self_gravity) {
for (int i = 0; i < e->s->nr_cells; ++i) for (int i = 0; i < e->s->nr_cells; ++i)
num_gpart_mpole += e->s->cells_top[i].multipole->m_pole.num_gpart; num_gpart_mpole += e->s->cells_top[i].multipole->m_pole.num_gpart;
if (num_gpart_mpole != e->s->nr_gparts) if (num_gpart_mpole != e->total_nr_gparts)
error( error(
"Multipoles don't contain the total number of gpart mpoles=%zd " "Multipoles don't contain the total number of gpart mpoles=%zd "
"ngparts=%zd", "ngparts=%zd",
num_gpart_mpole, e->s->nr_gparts); num_gpart_mpole, e->total_nr_gparts);
} }
#endif #endif
...@@ -4140,7 +4140,7 @@ void engine_do_drift_top_multipoles_mapper(void *map_data, int num_elements, ...@@ -4140,7 +4140,7 @@ void engine_do_drift_top_multipoles_mapper(void *map_data, int num_elements,
for (int ind = 0; ind < num_elements; ind++) { for (int ind = 0; ind < num_elements; ind++) {
struct cell *c = &cells[ind]; struct cell *c = &cells[ind];
if (c != NULL && c->nodeID == e->nodeID) { if (c != NULL) {
/* Drift the multipole at this level only */ /* Drift the multipole at this level only */
if (c->ti_old_multipole != e->ti_current) cell_drift_multipole(c, e); if (c->ti_old_multipole != e->ti_current) cell_drift_multipole(c, e);
......
...@@ -1241,8 +1241,8 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) { ...@@ -1241,8 +1241,8 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
if(check) { if(check) {
++direct_ngbs; ++direct_ngbs;
direct_ngbs_gpart += cj->multipole->m_pole.num_gpart; direct_ngbs_gpart += cj->multipole->m_pole.num_gpart;
message("Found direct neighbour %d: (i,j,k)=(%d,%d,%d) (ii,jj,kk)=(%d,%d,%d) nodeID=%d", /* message("Found direct neighbour %d: (i,j,k)=(%d,%d,%d) (ii,jj,kk)=(%d,%d,%d) nodeID=%d", */
direct_ngbs, i,j,k, ii,jj,kk, cj->nodeID); /* direct_ngbs, i,j,k, ii,jj,kk, cj->nodeID); */
} }
#endif #endif
......
...@@ -234,6 +234,8 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements, ...@@ -234,6 +234,8 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements,
c->xparts = NULL; c->xparts = NULL;
c->gparts = NULL; c->gparts = NULL;
c->sparts = NULL; c->sparts = NULL;
if(s->gravity)
bzero(c->multipole, sizeof(struct gravity_tensors));
for (int i = 0; i < 13; i++) for (int i = 0; i < 13; i++)
if (c->sort[i] != NULL) { if (c->sort[i] != NULL) {
free(c->sort[i]); free(c->sort[i]);
...@@ -264,6 +266,7 @@ void space_free_cells(struct space *s) { ...@@ -264,6 +266,7 @@ void space_free_cells(struct space *s) {
threadpool_map(&s->e->threadpool, space_rebuild_recycle_mapper, s->cells_top, threadpool_map(&s->e->threadpool, space_rebuild_recycle_mapper, s->cells_top,
s->nr_cells, sizeof(struct cell), 0, s); s->nr_cells, sizeof(struct cell), 0, s);
s->maxdepth = 0; s->maxdepth = 0;
message("Done"); fflush(stdout);
} }
/** /**
...@@ -953,6 +956,8 @@ void space_rebuild(struct space *s, int verbose) { ...@@ -953,6 +956,8 @@ void space_rebuild(struct space *s, int verbose) {
// message( "hooking up cells took %.3f %s." , // message( "hooking up cells took %.3f %s." ,
// clocks_from_ticks(getticks() - tic), clocks_getunit()); // clocks_from_ticks(getticks() - tic), clocks_getunit());
message("ti_old=%lld", ti_old);
/* At this point, we have the upper-level cells, old or new. Now make /* At this point, we have the upper-level cells, old or new. Now make
sure that the parts in each cell are ok. */ sure that the parts in each cell are ok. */
space_split(s, cells_top, s->nr_cells, verbose); space_split(s, cells_top, s->nr_cells, verbose);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment