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

Cleaning up

parent cb30d6f1
Branches
Tags
1 merge request!292Drift on demand
...@@ -6,9 +6,6 @@ InternalUnitSystem: ...@@ -6,9 +6,6 @@ InternalUnitSystem:
UnitCurrent_in_cgs: 1 # Amperes UnitCurrent_in_cgs: 1 # Amperes
UnitTemp_in_cgs: 1 # Kelvin UnitTemp_in_cgs: 1 # Kelvin
#Scheduler:
# max_top_level_cells: 3
# Parameters governing the time integration # Parameters governing the time integration
TimeIntegration: TimeIntegration:
time_begin: 0. # The starting time of the simulation (in internal units). time_begin: 0. # The starting time of the simulation (in internal units).
......
...@@ -47,32 +47,6 @@ __attribute__((always_inline)) INLINE static int cell_is_drifted( ...@@ -47,32 +47,6 @@ __attribute__((always_inline)) INLINE static int cell_is_drifted(
c->ti_old, e->ti_current); c->ti_old, e->ti_current);
#endif #endif
/* if (c->ti_old != e->ti_current) { */
/* int wrong = 0; */
/* for (int i = 0; i < c->count; ++i) { */
/* if (c->parts[i].ti_old < e->ti_current) ++wrong; */
/* } */
/* message( */
/* "Cell has not been drifted to the current time c->ti_old=%d, " */
/* "e->ti_current=%d wrong=%d c->count=%d c->drift=%p, c->depth=%d,
* c=%p, c->super=%p, c->parent=%p ", */
/* c->ti_old, e->ti_current, wrong, c->count, c->drift, c->depth, c,
* c->super, c->parent); */
/* cell_drift((struct cell*)c, e); */
/* message( */
/* "Cell has not been drifted to the current time c->ti_old=%d, " */
/* "e->ti_current=%d wrong=%d c->count=%d c->drift=%p, c->depth=%d,
* c=%p, c->super=%p, c->parent=%p ", */
/* c->ti_old, e->ti_current, wrong, c->count, c->drift, c->depth, c,
* c->super, c->parent); */
/* error("AAAAA"); */
/* } */
return (c->ti_old == e->ti_current); return (c->ti_old == e->ti_current);
} }
......
...@@ -717,14 +717,6 @@ void cell_check_drift_point(struct cell *c, void *data) { ...@@ -717,14 +717,6 @@ void cell_check_drift_point(struct cell *c, void *data) {
if (c->ti_old != ti_current) if (c->ti_old != ti_current)
error("Cell in an incorrect time-zone! c->ti_old=%d ti_current=%d", error("Cell in an incorrect time-zone! c->ti_old=%d ti_current=%d",
c->ti_old, ti_current); c->ti_old, ti_current);
/* for (int i = 0; i < c->count; ++i) */
/* if (c->parts[i].ti_old != ti_current) */
/* error( */
/* "Particle in an incorrect time-zone! part->ti_old=%d c->ti_old=%d "
*/
/* "ti_current=%d", */
/* c->parts[i].ti_old, c->ti_old, ti_current); */
} }
/** /**
...@@ -887,12 +879,6 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -887,12 +879,6 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
} }
} }
/* Activate the drift on both sides */
if (ci == c && cj != NULL && cj->drift != NULL)
scheduler_activate(s, cj->drift);
if (cj == c && ci != NULL && ci->drift != NULL)
scheduler_activate(s, ci->drift);
/* Check whether there was too much particle motion */ /* Check whether there was too much particle motion */
if (t->type == task_type_pair || t->type == task_type_sub_pair) { if (t->type == task_type_pair || t->type == task_type_sub_pair) {
if (t->tight && if (t->tight &&
...@@ -970,6 +956,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -970,6 +956,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
if (c->extra_ghost != NULL) scheduler_activate(s, c->extra_ghost); if (c->extra_ghost != NULL) scheduler_activate(s, c->extra_ghost);
if (c->ghost != NULL) scheduler_activate(s, c->ghost); if (c->ghost != NULL) scheduler_activate(s, c->ghost);
if (c->init != NULL) scheduler_activate(s, c->init); if (c->init != NULL) scheduler_activate(s, c->init);
if (c->drift != NULL) scheduler_activate(s, c->drift);
if (c->kick != NULL) scheduler_activate(s, c->kick); if (c->kick != NULL) scheduler_activate(s, c->kick);
if (c->cooling != NULL) scheduler_activate(s, c->cooling); if (c->cooling != NULL) scheduler_activate(s, c->cooling);
if (c->sourceterms != NULL) scheduler_activate(s, c->sourceterms); if (c->sourceterms != NULL) scheduler_activate(s, c->sourceterms);
......
...@@ -1988,16 +1988,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -1988,16 +1988,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if (t->ci->ti_end_min <= ti_end) scheduler_activate(s, t); if (t->ci->ti_end_min <= ti_end) scheduler_activate(s, t);
} }
/* Self? */
else if (t->type == task_type_self || t->type == task_type_sub_self) {
/* Local pointers. */
// const struct cell *ci = t->ci;
/* Activate the drift */
// if (ci->drift) scheduler_activate(s, ci->drift);
}
/* Pair? */ /* Pair? */
else if (t->type == task_type_pair || t->type == task_type_sub_pair) { else if (t->type == task_type_pair || t->type == task_type_sub_pair) {
...@@ -2005,10 +1995,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements, ...@@ -2005,10 +1995,6 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
const struct cell *ci = t->ci; const struct cell *ci = t->ci;
const struct cell *cj = t->cj; const struct cell *cj = t->cj;
/* Activate the drift on both sides */
// if (ci->drift) scheduler_activate(s, ci->drift);
// if (cj->drift) scheduler_activate(s, cj->drift);
/* Too much particle movement? */ /* Too much particle movement? */
if (t->tight && if (t->tight &&
(max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin || (max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin ||
...@@ -2258,13 +2244,7 @@ void engine_prepare(struct engine *e, int nodrift) { ...@@ -2258,13 +2244,7 @@ void engine_prepare(struct engine *e, int nodrift) {
if (rebuild) { if (rebuild) {
/* Drift all particles to the current time if needed. */ /* Drift all particles to the current time if needed. */
if (!nodrift) { if (!nodrift) engine_drift_all(e);
// e->drift_all = 1;
engine_drift_all(e);
/* Restore the default drifting policy */
// e->drift_all = (e->policy & engine_policy_drift_all);
}
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time */ /* Check that all cells have been drifted to the current time */
...@@ -2272,11 +2252,6 @@ void engine_prepare(struct engine *e, int nodrift) { ...@@ -2272,11 +2252,6 @@ void engine_prepare(struct engine *e, int nodrift) {
#endif #endif
engine_rebuild(e); engine_rebuild(e);
#ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time */
space_check_drift_point(e->s, e->ti_current);
#endif
} }
/* Re-rank the tasks every now and then. */ /* Re-rank the tasks every now and then. */
...@@ -2621,12 +2596,8 @@ void engine_step(struct engine *e) { ...@@ -2621,12 +2596,8 @@ void engine_step(struct engine *e) {
snapshot_drift_time = e->timeStep; snapshot_drift_time = e->timeStep;
/* Drift everybody to the snapshot position */ /* Drift everybody to the snapshot position */
// e->drift_all = 1;
engine_drift_all(e); engine_drift_all(e);
/* Restore the default drifting policy */
// e->drift_all = (e->policy & engine_policy_drift_all);
/* Dump... */ /* Dump... */
engine_dump_snapshot(e); engine_dump_snapshot(e);
...@@ -2658,17 +2629,14 @@ void engine_step(struct engine *e) { ...@@ -2658,17 +2629,14 @@ void engine_step(struct engine *e) {
/* Drift only the necessary particles, that means all particles /* Drift only the necessary particles, that means all particles
* if we are about to repartition. */ * if we are about to repartition. */
const int repart = (e->forcerepart != REPART_NONE); const int repart = (e->forcerepart != REPART_NONE);
// e->drift_all = repart || e->drift_all; const int drift_all = (e->policy & engine_policy_drift_all);
if (repart) engine_drift_all(e); if (repart || drift_all) engine_drift_all(e);
/* Re-distribute the particles amongst the nodes? */ /* Re-distribute the particles amongst the nodes? */
if (repart) engine_repartition(e); if (repart) engine_repartition(e);
/* Prepare the space. */ /* Prepare the space. */
engine_prepare(e, (e->drift_all || repart)); engine_prepare(e, (drift_all || repart));
/* Restore the default drifting policy */
// e->drift_all = (e->policy & engine_policy_drift_all);
if (e->verbose) engine_print_task_counts(e); if (e->verbose) engine_print_task_counts(e);
...@@ -2716,14 +2684,10 @@ void engine_unskip(struct engine *e) { ...@@ -2716,14 +2684,10 @@ void engine_unskip(struct engine *e) {
void engine_drift_all(struct engine *e) { void engine_drift_all(struct engine *e) {
e->drift_all = 1;
const ticks tic = getticks(); const ticks tic = getticks();
threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top, threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top,
e->s->nr_cells, sizeof(struct cell), 1, e); e->s->nr_cells, sizeof(struct cell), 1, e);
e->drift_all = e->policy & engine_policy_drift_all;
if (e->verbose) if (e->verbose)
message("took %.3f %s.", clocks_from_ticks(getticks() - tic), message("took %.3f %s.", clocks_from_ticks(getticks() - tic),
clocks_getunit()); clocks_getunit());
...@@ -3064,7 +3028,6 @@ void engine_init(struct engine *e, struct space *s, ...@@ -3064,7 +3028,6 @@ void engine_init(struct engine *e, struct space *s,
e->timeStep = 0.; e->timeStep = 0.;
e->timeBase = 0.; e->timeBase = 0.;
e->timeBase_inv = 0.; e->timeBase_inv = 0.;
e->drift_all = (policy & engine_policy_drift_all);
e->internalUnits = internal_units; e->internalUnits = internal_units;
e->timeFirstSnapshot = e->timeFirstSnapshot =
parser_get_param_double(params, "Snapshots:time_first"); parser_get_param_double(params, "Snapshots:time_first");
......
...@@ -133,9 +133,6 @@ struct engine { ...@@ -133,9 +133,6 @@ struct engine {
/* Minimal ti_end for the next time-step */ /* Minimal ti_end for the next time-step */
int ti_end_min; int ti_end_min;
/* Are we drifting all particles now ? */
int drift_all;
/* Number of particles updated */ /* Number of particles updated */
size_t updates, g_updates; size_t updates, g_updates;
......
...@@ -733,17 +733,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -733,17 +733,9 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
} }
} }
if (count) { if (count)
message("Smoothing length failed to converge on %i particles.", count); message("Smoothing length failed to converge on %i particles.", count);
for (int i = 0; i < count; ++i) {
struct part *restrict p = &parts[pid[i]];
struct xpart *restrict xp = &xparts[pid[i]];
printParticle_single(p, xp);
}
}
/* Be clean */ /* Be clean */
free(pid); free(pid);
} }
...@@ -772,8 +764,8 @@ static void runner_do_unskip(struct cell *c, struct engine *e, int drift) { ...@@ -772,8 +764,8 @@ static void runner_do_unskip(struct cell *c, struct engine *e, int drift) {
if (c->split) { if (c->split) {
for (int k = 0; k < 8; k++) { for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL) { if (c->progeny[k] != NULL) {
struct cell *cp = c->progeny[k]; struct cell *cp = c->progeny[k];
runner_do_unskip(cp, e, 0); runner_do_unskip(cp, e, 0);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment