Commit 515007da authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Version that passes 3000+ steps on eagle-25

parent 6ad43f47
...@@ -36,6 +36,9 @@ Statistics: ...@@ -36,6 +36,9 @@ Statistics:
time_first: 0.01 # Time of the first stat dump (non-cosmological run) (in internal units) time_first: 0.01 # Time of the first stat dump (non-cosmological run) (in internal units)
delta_time: 1.05 # Time between statistics output delta_time: 1.05 # Time between statistics output
Scheduler:
links_per_tasks: 25
# Parameters for the self-gravity scheme # Parameters for the self-gravity scheme
Gravity: Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration. eta: 0.025 # Constant dimensionless multiplier for time integration.
......
...@@ -49,7 +49,7 @@ Gravity: ...@@ -49,7 +49,7 @@ Gravity:
theta: 0.7 # Opening angle (Multipole acceptance criterion) theta: 0.7 # Opening angle (Multipole acceptance criterion)
comoving_softening: 0.0026994 # Comoving softening length (in internal units). comoving_softening: 0.0026994 # Comoving softening length (in internal units).
max_physical_softening: 0.0007 # Physical softening length (in internal units). max_physical_softening: 0.0007 # Physical softening length (in internal units).
mesh_side_length: 64 mesh_side_length: 256
# Parameters for the hydrodynamics scheme # Parameters for the hydrodynamics scheme
SPH: SPH:
...@@ -85,6 +85,9 @@ EAGLECooling: ...@@ -85,6 +85,9 @@ EAGLECooling:
He_reion_z_sigma: 0.5 He_reion_z_sigma: 0.5
He_reion_eV_p_H: 2.0 He_reion_eV_p_H: 2.0
Scheduler:
links_per_tasks: 25
# EAGLE star formation parameters # EAGLE star formation parameters
EAGLEStarFormation: EAGLEStarFormation:
EOS_density_norm_H_p_cm3: 0.1 # Physical density used for the normalisation of the EOS assumed for the star-forming gas in Hydrogen atoms per cm^3. EOS_density_norm_H_p_cm3: 0.1 # Physical density used for the normalisation of the EOS assumed for the star-forming gas in Hydrogen atoms per cm^3.
......
...@@ -160,6 +160,11 @@ struct cell_split_pair cell_split_pairs[13] = { ...@@ -160,6 +160,11 @@ struct cell_split_pair cell_split_pairs[13] = {
{5, 6, 9}, {5, 6, 9},
{7, 6, 12}}}}; {7, 6, 12}}}};
extern int cell_to_check;
extern int parent_cell_to_check;
extern int super_cell_to_check;
int CHECK = 0;
/** /**
* @brief Get the size of the cell subtree. * @brief Get the size of the cell subtree.
* *
...@@ -1072,7 +1077,8 @@ int cell_pack_sf_counts(struct cell *restrict c, ...@@ -1072,7 +1077,8 @@ int cell_pack_sf_counts(struct cell *restrict c,
/* Pack this cell's data. */ /* Pack this cell's data. */
pcells[0].stars.delta_from_rebuild = c->stars.parts - c->stars.parts_rebuild; pcells[0].stars.delta_from_rebuild = c->stars.parts - c->stars.parts_rebuild;
pcells[0].stars.count = c->stars.count; pcells[0].stars.count = c->stars.count;
pcells[0].stars.dx_max_part = c->stars.dx_max_part;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->stars.parts_rebuild == NULL) if (c->stars.parts_rebuild == NULL)
error("Star particles array at rebuild is NULL! c->depth=%d", c->depth); error("Star particles array at rebuild is NULL! c->depth=%d", c->depth);
...@@ -1122,6 +1128,7 @@ int cell_unpack_sf_counts(struct cell *restrict c, ...@@ -1122,6 +1128,7 @@ int cell_unpack_sf_counts(struct cell *restrict c,
/* Unpack this cell's data. */ /* Unpack this cell's data. */
c->stars.count = pcells[0].stars.count; c->stars.count = pcells[0].stars.count;
c->stars.parts = c->stars.parts_rebuild + pcells[0].stars.delta_from_rebuild; c->stars.parts = c->stars.parts_rebuild + pcells[0].stars.delta_from_rebuild;
c->stars.dx_max_part = pcells[0].stars.dx_max_part;
/* Fill in the progeny, depth-first recursion. */ /* Fill in the progeny, depth-first recursion. */
int count = 1; int count = 1;
...@@ -2541,7 +2548,11 @@ void cell_activate_hydro_sorts(struct cell *c, int sid, struct scheduler *s) { ...@@ -2541,7 +2548,11 @@ void cell_activate_hydro_sorts(struct cell *c, int sid, struct scheduler *s) {
* @brief Activate the sorts up a cell hierarchy. * @brief Activate the sorts up a cell hierarchy.
*/ */
void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) { void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) {
if (c == c->hydro.super) { if (c == c->hydro.super) {
if(CHECK) message("in if");
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (c->stars.sorts == NULL) if (c->stars.sorts == NULL)
error("Trying to activate un-existing c->stars.sorts"); error("Trying to activate un-existing c->stars.sorts");
...@@ -2551,11 +2562,31 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) { ...@@ -2551,11 +2562,31 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) {
cell_activate_drift_spart(c, s); cell_activate_drift_spart(c, s);
} }
} else { } else {
if(CHECK) message("in else");
if(CHECK) {
int sub_sort = cell_get_flag(c, cell_flag_do_stars_sub_sort);
int parent_sub_sort = cell_get_flag(c->parent, cell_flag_do_stars_sub_sort);
message("depth=%d cellID=%d sub_sort=%d parent->sub_sort=%d",
c->depth, c->nodeID, sub_sort, parent_sub_sort);
message("super->stars.sorts=%p", c->hydro.super->stars.sorts);
message("super->stars.sorts->skip=%d", c->hydro.super->stars.sorts->skip);
}
for (struct cell *parent = c->parent; for (struct cell *parent = c->parent;
parent != NULL && !cell_get_flag(parent, cell_flag_do_stars_sub_sort); parent != NULL && !cell_get_flag(parent, cell_flag_do_stars_sub_sort);
parent = parent->parent) { parent = parent->parent) {
cell_set_flag(parent, cell_flag_do_stars_sub_sort); cell_set_flag(parent, cell_flag_do_stars_sub_sort);
if(CHECK) message("parent->depth=%d", parent->depth);
if (parent == c->hydro.super) { if (parent == c->hydro.super) {
if(CHECK) message("in other if");
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if (parent->stars.sorts == NULL) if (parent->stars.sorts == NULL)
error("Trying to activate un-existing parents->stars.sorts"); error("Trying to activate un-existing parents->stars.sorts");
...@@ -2572,8 +2603,16 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) { ...@@ -2572,8 +2603,16 @@ void cell_activate_stars_sorts_up(struct cell *c, struct scheduler *s) {
* @brief Activate the sorts on a given cell, if needed. * @brief Activate the sorts on a given cell, if needed.
*/ */
void cell_activate_stars_sorts(struct cell *c, int sid, struct scheduler *s) { void cell_activate_stars_sorts(struct cell *c, int sid, struct scheduler *s) {
if(CHECK)
message("Activating sorts for cell %d", c->cellID);
/* Do we need to re-sort? */ /* Do we need to re-sort? */
if (c->stars.dx_max_sort > space_maxreldx * c->dmin) { if (c->stars.dx_max_sort > space_maxreldx * c->dmin) {
if(c->cellID == cell_to_check)
message("In first if");
/* Climb up the tree to active the sorts in that direction */ /* Climb up the tree to active the sorts in that direction */
for (struct cell *finger = c; finger != NULL; finger = finger->parent) { for (struct cell *finger = c; finger != NULL; finger = finger->parent) {
if (finger->stars.requires_sorts) { if (finger->stars.requires_sorts) {
...@@ -2586,6 +2625,10 @@ void cell_activate_stars_sorts(struct cell *c, int sid, struct scheduler *s) { ...@@ -2586,6 +2625,10 @@ void cell_activate_stars_sorts(struct cell *c, int sid, struct scheduler *s) {
/* Has this cell been sorted at all for the given sid? */ /* Has this cell been sorted at all for the given sid? */
if (!(c->stars.sorted & (1 << sid)) || c->nodeID != engine_rank) { if (!(c->stars.sorted & (1 << sid)) || c->nodeID != engine_rank) {
if(CHECK)
message("In second if");
atomic_or(&c->stars.do_sort, (1 << sid)); atomic_or(&c->stars.do_sort, (1 << sid));
cell_activate_stars_sorts_up(c, s); cell_activate_stars_sorts_up(c, s);
} }
...@@ -2744,21 +2787,52 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj, ...@@ -2744,21 +2787,52 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj,
/* Otherwise, pair interation */ /* Otherwise, pair interation */
else { else {
/* Get the orientation of the pair. */
double shift[3];
const int sid = space_getsid(s->space, &ci, &cj, shift);
const int ci_active = cell_is_active_stars(ci, e) || const int ci_active = cell_is_active_stars(ci, e) ||
(with_star_formation && cell_is_active_hydro(ci, e)); (with_star_formation && cell_is_active_hydro(ci, e));
const int cj_active = cell_is_active_stars(cj, e) || const int cj_active = cell_is_active_stars(cj, e) ||
(with_star_formation && cell_is_active_hydro(cj, e)); (with_star_formation && cell_is_active_hydro(cj, e));
/* Should we even bother? */ /* Should we even bother? */
if (!ci_active && !cj_active) return; if (!ci_active && !cj_active) return;
/* Get the orientation of the pair. */
double shift[3];
const int sid = space_getsid(s->space, &ci, &cj, shift);
/* if(e->nodeID == 7 && ci->cellID == super_cell_to_check) */
/* message("Found the super ci! ci_active=%d cj_active=%d depth=%d", ci_active, cj_active, ci->depth); */
/* if(e->nodeID == 7 && cj->cellID == super_cell_to_check) */
/* message("Found the super cj! ci_active=%d cj_active=%d depth=%d", ci_active, cj_active, cj->depth); */
/* if(e->nodeID == 7 && ci->depth > 0 && ci->parent->cellID == super_cell_to_check) */
/* message("Found the parent ci! ci_active=%d cj_active=%d depth=%d", ci_active, cj_active, ci->depth); */
/* if(e->nodeID == 7 && cj->depth > 0 &&cj->parent->cellID == super_cell_to_check) */
/* message("Found the parent cj! ci_active=%d cj_active=%d depth=%d", ci_active, cj_active, cj->depth); */
/* if(e->nodeID == 7 && cj->hydro.super->cellID == super_cell_to_check) */
/* message("Found a cell with super-cell= %d depth=%d cellID=%d ci_active=%d cj_active=%d cj->requires_sorts=%d cj->do_sort=%d sid=%d cj->dx_max_part=%e cj->dx_max_part_old=%e cj->dx_max_sort=%e cj->dx_max_sort_old=%e", */
/* cj->hydro.super->cellID, cj->depth, cj->cellID, ci_active, cj_active, cj->stars.requires_sorts, cj->stars.do_sort, sid, */
/* cj->stars.dx_max_part, cj->stars.dx_max_part_old, */
/* cj->stars.dx_max_sort, cj->stars.dx_max_sort_old); */
/* recurse? */ /* recurse? */
if (cell_can_recurse_in_pair_stars_task(ci, cj) && if (cell_can_recurse_in_pair_stars_task(ci, cj) &&
cell_can_recurse_in_pair_stars_task(cj, ci)) { cell_can_recurse_in_pair_stars_task(cj, ci)) {
/* if(e->nodeID == 7 && ci->cellID == super_cell_to_check) */
/* message("Found the super ci! Recursing!"); */
/* if(e->nodeID == 7 && cj->cellID == super_cell_to_check) */
/* message("Found the super cj! Recursing!"); */
/* if(e->nodeID == 7 && ci->depth > 0 && ci->parent->cellID == super_cell_to_check) */
/* message("Found the parent ci! Recursing!"); */
/* if(e->nodeID == 7 && cj->depth > 0 && cj->parent->cellID == super_cell_to_check) */
/* message("Found the parent cj! Recursing!"); */
const struct cell_split_pair *csp = &cell_split_pairs[sid]; const struct cell_split_pair *csp = &cell_split_pairs[sid];
for (int k = 0; k < csp->count; k++) { for (int k = 0; k < csp->count; k++) {
const int pid = csp->pairs[k].pid; const int pid = csp->pairs[k].pid;
...@@ -2772,7 +2846,16 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj, ...@@ -2772,7 +2846,16 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj,
/* Otherwise, activate the sorts and drifts. */ /* Otherwise, activate the sorts and drifts. */
else { else {
if (ci_active) { if (cell_is_active_stars(ci, e) ||
(with_star_formation && cell_is_active_hydro(ci, e))) {
/* if(e->nodeID == 7 && cj->hydro.super->cellID == super_cell_to_check && cj->depth==3) */
/* message("ACTIVATING ci!!! Found a cell with super-cell= %d depth=%d cellID=%d ci_active=%d cj_active=%d cj->requires_sorts=%d cj->do_sort=%d sid=%d cj->dx_max_part=%e cj->dx_max_part_old=%e cj->dx_max_sort=%e cj->dx_max_sort_old=%e", */
/* cj->hydro.super->cellID, cj->depth, cj->cellID, ci_active, cj_active, cj->stars.requires_sorts, cj->stars.do_sort, sid, */
/* cj->stars.dx_max_part, cj->stars.dx_max_part_old, */
/* cj->stars.dx_max_sort, cj->stars.dx_max_sort_old); */
/* We are going to interact this pair, so store some values. */ /* We are going to interact this pair, so store some values. */
atomic_or(&cj->hydro.requires_sorts, 1 << sid); atomic_or(&cj->hydro.requires_sorts, 1 << sid);
atomic_or(&ci->stars.requires_sorts, 1 << sid); atomic_or(&ci->stars.requires_sorts, 1 << sid);
...@@ -2789,7 +2872,19 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj, ...@@ -2789,7 +2872,19 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj,
cell_activate_stars_sorts(ci, sid, s); cell_activate_stars_sorts(ci, sid, s);
} }
if (cj_active) { if (cell_is_active_stars(cj, e) ||
(with_star_formation && cell_is_active_hydro(cj, e))) {
/* if(e->nodeID == 7 && cj->hydro.super->cellID == super_cell_to_check && cj->depth==3) { */
/* message("ACTIVATING cj!!! Found a cell with super-cell= %d depth=%d cellID=%d ci_active=%d cj_active=%d cj->requires_sorts=%d cj->do_sort=%d sid=%d cj->dx_max_part=%e cj->dx_max_part_old=%e cj->dx_max_sort=%e cj->dx_max_sort_old=%e", */
/* cj->hydro.super->cellID, cj->depth, cj->cellID, ci_active, cj_active, cj->stars.requires_sorts, cj->stars.do_sort, sid, */
/* cj->stars.dx_max_part, cj->stars.dx_max_part_old, */
/* cj->stars.dx_max_sort, cj->stars.dx_max_sort_old); */
/* if(sid == 3) CHECK =1; */
/* } */
/* We are going to interact this pair, so store some values. */ /* We are going to interact this pair, so store some values. */
atomic_or(&cj->stars.requires_sorts, 1 << sid); atomic_or(&cj->stars.requires_sorts, 1 << sid);
atomic_or(&ci->hydro.requires_sorts, 1 << sid); atomic_or(&ci->hydro.requires_sorts, 1 << sid);
...@@ -2804,6 +2899,8 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj, ...@@ -2804,6 +2899,8 @@ void cell_activate_subcell_stars_tasks(struct cell *ci, struct cell *cj,
/* Do we need to sort the cells? */ /* Do we need to sort the cells? */
cell_activate_hydro_sorts(ci, sid, s); cell_activate_hydro_sorts(ci, sid, s);
cell_activate_stars_sorts(cj, sid, s); cell_activate_stars_sorts(cj, sid, s);
CHECK = 0;
} }
} }
} /* Otherwise, pair interation */ } /* Otherwise, pair interation */
...@@ -3512,6 +3609,19 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s, ...@@ -3512,6 +3609,19 @@ int cell_unskip_stars_tasks(struct cell *c, struct scheduler *s,
(ci_nodeID == nodeID || cj_nodeID == nodeID)) { (ci_nodeID == nodeID || cj_nodeID == nodeID)) {
scheduler_activate(s, t); scheduler_activate(s, t);
if(ci->cellID == cell_to_check)
message("Activating task ci case t->type=%s/%s", taskID_names[t->type], subtaskID_names[t->subtype]);
if(cj != NULL && cj->cellID == cell_to_check)
message("Activating task cj case t->type=%s/%s", taskID_names[t->type], subtaskID_names[t->subtype]);
if(ci->cellID == super_cell_to_check)
message("Activating super task ci case t->type=%s/%s", taskID_names[t->type], subtaskID_names[t->subtype]);
if(cj != NULL && cj->cellID == super_cell_to_check)
message("Activating super task cj case t->type=%s/%s", taskID_names[t->type], subtaskID_names[t->subtype]);
if (t->type == task_type_pair) { if (t->type == task_type_pair) {
/* Do ci */ /* Do ci */
if (ci_active) { if (ci_active) {
...@@ -4801,6 +4911,35 @@ void cell_check_spart_pos(const struct cell *c, ...@@ -4801,6 +4911,35 @@ void cell_check_spart_pos(const struct cell *c,
#endif #endif
} }
void cell_check_sort_flags(const struct cell* c) {
#ifdef SWIFT_DEBUG_CHECKS
const int do_hydro_sub_sort = cell_get_flag(c, cell_flag_do_hydro_sub_sort);
const int do_stars_sub_sort = cell_get_flag(c, cell_flag_do_stars_sub_sort);
if(do_hydro_sub_sort)
error("cell %d has a hydro sub_sort flag set. Node=%d depth=%d maxdepth=%d",
c->cellID, c->nodeID, c->depth, c->maxdepth);
if(do_stars_sub_sort) {
message("cell %d has a stars sub_sort flag set. Node=%d depth=%d maxdepth=%d super=%p",
c->cellID, c->nodeID, c->depth, c->maxdepth, c->hydro.super);
message("c->stars.count=%d", c->stars.count);
message("super->cellID=%d super->sorts=%p super->depth=%d", c->hydro.super->cellID,
c->hydro.super->stars.sorts, c->hydro.super->depth);
message("super->sorts->skip=%d",c->hydro.super->stars.sorts->skip);
error("oooo");
}
if(c->split) {
for(int k = 0; k < 8; ++k) {
if(c->progeny[k] != NULL) cell_check_sort_flags(c->progeny[k]);
}
}
#endif
}
/** /**
* @brief Recursively update the pointer and counter for #spart after the * @brief Recursively update the pointer and counter for #spart after the
* addition of a new particle. * addition of a new particle.
...@@ -5190,6 +5329,11 @@ struct spart *cell_convert_part_to_spart(struct engine *e, struct cell *c, ...@@ -5190,6 +5329,11 @@ struct spart *cell_convert_part_to_spart(struct engine *e, struct cell *c,
/* Did we run out of free spart slots? */ /* Did we run out of free spart slots? */
if (sp == NULL) return NULL; if (sp == NULL) return NULL;
/* Copy over the distance since rebuild */
sp->x_diff[0] = xp->x_diff[0];
sp->x_diff[1] = xp->x_diff[1];
sp->x_diff[2] = xp->x_diff[2];
/* Destroy the gas particle and get it's gpart friend */ /* Destroy the gas particle and get it's gpart friend */
struct gpart *gp = cell_convert_part_to_gpart(e, c, p, xp); struct gpart *gp = cell_convert_part_to_gpart(e, c, p, xp);
......
...@@ -253,6 +253,26 @@ struct pcell_step_black_holes { ...@@ -253,6 +253,26 @@ struct pcell_step_black_holes {
float dx_max_part; float dx_max_part;
}; };
/**
* @brief Cell information to propagate the new counts of star particles.
*/
struct pcell_sf {
/*! Stars variables */
struct {
/* Distance by which the stars pointer has moved since the last rebuild */
ptrdiff_t delta_from_rebuild;
/* Number of particles in the cell */
int count;
/*! Maximum part movement in this cell since last construction. */
float dx_max_part;
} stars;
};
/** Bitmasks for the cell flags. Beware when adding flags that you don't exceed /** Bitmasks for the cell flags. Beware when adding flags that you don't exceed
the size of the flags variable in the struct cell. */ the size of the flags variable in the struct cell. */
enum cell_flags { enum cell_flags {
...@@ -271,23 +291,6 @@ enum cell_flags { ...@@ -271,23 +291,6 @@ enum cell_flags {
cell_flag_do_bh_sub_drift = (1UL << 12) cell_flag_do_bh_sub_drift = (1UL << 12)
}; };
/**
* @brief Cell information to propagate the new counts of star particles.
*/
struct pcell_sf {
/*! Stars variables */
struct {
/* Distance by which the stars pointer has moved since the last rebuild */
ptrdiff_t delta_from_rebuild;
/* Number of particles in the cell */
int count;
} stars;
};
/** /**
* @brief Cell within the tree structure. * @brief Cell within the tree structure.
* *
...@@ -880,6 +883,7 @@ void cell_clear_limiter_flags(struct cell *c, void *data); ...@@ -880,6 +883,7 @@ void cell_clear_limiter_flags(struct cell *c, void *data);
void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data); void cell_set_super_mapper(void *map_data, int num_elements, void *extra_data);
void cell_check_spart_pos(const struct cell *c, void cell_check_spart_pos(const struct cell *c,
const struct spart *global_sparts); const struct spart *global_sparts);
void cell_check_sort_flags(const struct cell* c);
void cell_clear_stars_sort_flags(struct cell *c); void cell_clear_stars_sort_flags(struct cell *c);
int cell_has_tasks(struct cell *c); int cell_has_tasks(struct cell *c);
void cell_remove_part(const struct engine *e, struct cell *c, struct part *p, void cell_remove_part(const struct engine *e, struct cell *c, struct part *p,
......
...@@ -2561,6 +2561,8 @@ void engine_rebuild(struct engine *e, int repartitioned, ...@@ -2561,6 +2561,8 @@ void engine_rebuild(struct engine *e, int repartitioned,
for (int k = 0; k < e->s->nr_local_cells; k++) for (int k = 0; k < e->s->nr_local_cells; k++)
cell_check_foreign_multipole(&e->s->cells_top[e->s->local_cells_top[k]]); cell_check_foreign_multipole(&e->s->cells_top[e->s->local_cells_top[k]]);
} }
space_check_sort_flags(e->s);
#endif #endif
/* Run through the tasks and mark as skip or not. */ /* Run through the tasks and mark as skip or not. */
...@@ -3834,6 +3836,7 @@ void engine_step(struct engine *e) { ...@@ -3834,6 +3836,7 @@ void engine_step(struct engine *e) {
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Make sure all woken-up particles have been processed */ /* Make sure all woken-up particles have been processed */
space_check_limiter(e->s); space_check_limiter(e->s);
space_check_sort_flags(e->s);
#endif #endif
/* Collect information about the next time-step */ /* Collect information about the next time-step */
...@@ -4722,22 +4725,22 @@ void engine_dump_snapshot(struct engine *e) { ...@@ -4722,22 +4725,22 @@ void engine_dump_snapshot(struct engine *e) {
#endif #endif
/* Dump... */ /* Dump... */
#if defined(HAVE_HDF5) /* #if defined(HAVE_HDF5) */
#if defined(WITH_MPI) /* #if defined(WITH_MPI) */
#if defined(HAVE_PARALLEL_HDF5) /* #if defined(HAVE_PARALLEL_HDF5) */
write_output_parallel(e, e->snapshot_base_name, e->internal_units, /* write_output_parallel(e, e->snapshot_base_name, e->internal_units, */
e->snapshot_units, e->nodeID, e->nr_nodes, /* e->snapshot_units, e->nodeID, e->nr_nodes, */
MPI_COMM_WORLD, MPI_INFO_NULL); /* MPI_COMM_WORLD, MPI_INFO_NULL); */
#else /* #else */
write_output_serial(e, e->snapshot_base_name, e->internal_units, /* write_output_serial(e, e->snapshot_base_name, e->internal_units, */
e->snapshot_units, e->nodeID, e->nr_nodes, MPI_COMM_WORLD, /* e->snapshot_units, e->nodeID, e->nr_nodes, MPI_COMM_WORLD, */
MPI_INFO_NULL); /* MPI_INFO_NULL); */
#endif /* #endif */
#else /* #else */
write_output_single(e, e->snapshot_base_name, e->internal_units, /* write_output_single(e, e->snapshot_base_name, e->internal_units, */
e->snapshot_units); /* e->snapshot_units); */
#endif /* #endif */
#endif /* #endif */
/* Flag that we dumped a snapshot */ /* Flag that we dumped a snapshot */
e->step_props |= engine_step_prop_snapshot; e->step_props |= engine_step_prop_snapshot;
......
...@@ -142,6 +142,10 @@ ...@@ -142,6 +142,10 @@
#undef FUNCTION_TASK_LOOP #undef FUNCTION_TASK_LOOP
#undef FUNCTION #undef FUNCTION
int cell_to_check = -10000000;
int parent_cell_to_check = -10000000;
int super_cell_to_check = -10000000;
/** /**
* @brief Intermediate task after the density to check that the smoothing * @brief Intermediate task after the density to check that the smoothing
* lengths are correct. * lengths are correct.
...@@ -1100,6 +1104,9 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { ...@@ -1100,6 +1104,9 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
/* Did we get a star? (Or did we run out of spare ones?) */ /* Did we get a star? (Or did we run out of spare ones?) */
if (sp != NULL) { if (sp != NULL) {
message("We formed a star id=%lld cellID=%d", sp->id,
c->cellID);
/* Copy the properties of the gas particle to the star particle */ /* Copy the properties of the gas particle to the star particle */
star_formation_copy_properties(p, xp, sp, e, sf_props, cosmo, star_formation_copy_properties(p, xp, sp, e, sf_props, cosmo,
with_cosmology, phys_const, with_cosmology, phys_const,
...@@ -1243,6 +1250,20 @@ void runner_do_sort_ascending(struct entry *sort, int N) { ...@@ -1243,6 +1250,20 @@ void runner_do_sort_ascending(struct entry *sort, int N) {
RUNNER_CHECK_SORTS(hydro) RUNNER_CHECK_SORTS(hydro)
RUNNER_CHECK_SORTS(stars) RUNNER_CHECK_SORTS(stars)
void cell_clear_hydro_sort_flags2(struct cell *c) {
c->hydro.do_sort = 0;
cell_clear_flag(c, cell_flag_do_hydro_sub_sort);
c->hydro.requires_sorts = 0;
if(c->split) {
for(int k = 0; k < 8; ++k){
if(c->progeny[k] != NULL)
cell_clear_hydro_sort_flags2(c->progeny[k]);
}
}
}
/** /**
* @brief Sort the particles in the given cell along all cardinal directions. * @brief Sort the particles in the given cell along all cardinal directions.
* *
...@@ -1308,15 +1329,20 @@ void runner_do_hydro_sort(struct runner *r, struct cell *c, int flags, ...@@ -1308,15 +1329,20 @@ void runner_do_hydro_sort(struct runner *r, struct cell *c, int flags,
float dx_max_sort = 0.0f; float dx_max_sort = 0.0f;
float dx_max_sort_old = 0.0f; float dx_max_sort_old = 0.0f;
for (int k = 0; k < 8; k++) { for (int k = 0; k < 8; k++) {
if (c->progeny[k] != NULL && c->progeny[k]->hydro.count > 0) { if (c->progeny[k] != NULL) {
/* Only propagate cleanup if the progeny is stale. */
runner_do_hydro_sort(r, c->progeny[k], flags, if( c->progeny[k]->hydro.count > 0) {
cleanup && (c->progeny[k]->hydro.dx_max_sort_old > /* Only propagate cleanup if the progeny is stale. */
space_maxreldx * c->progeny[k]->dmin), runner_do_hydro_sort(r, c->progeny[k], flags,
0); cleanup && (c->progeny[k]->hydro.dx_max_sort_old >
dx_max_sort = max(dx_max_sort, c->progeny[k]->hydro.dx_max_sort); space_maxreldx * c->progeny[k]->dmin),
dx_max_sort_old = 0);
dx_max_sort = max(dx_max_sort, c->progeny[k]->hydro.dx_max_sort);
dx_max_sort_old =
max(dx_max_sort_old, c->progeny[k]->hydro.dx_max_sort_old); max(dx_max_sort_old, c->progeny[k]->hydro.dx_max_sort_old);
} else {
cell_clear_hydro_sort_flags2(c->progeny[k]);
}
} }
}