Commit 177227c0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Removed some debugging code.

parent ec6a47c9
...@@ -42,5 +42,5 @@ PointMassPotential: ...@@ -42,5 +42,5 @@ PointMassPotential:
position_y: 50. position_y: 50.
position_z: 50. position_z: 50.
mass: 1e10 # mass of external point mass in internal units mass: 1e10 # mass of external point mass in internal units
timestep_mult: 0.001 # controls time step timestep_mult: 0.03 # controls time step
...@@ -96,10 +96,6 @@ grp1 = file.create_group("/PartType1") ...@@ -96,10 +96,6 @@ grp1 = file.create_group("/PartType1")
#generate particle positions #generate particle positions
radius = max_radius * (numpy.random.rand(numPart))**(1./3.) radius = max_radius * (numpy.random.rand(numPart))**(1./3.)
#radius = numpy.zeros(3)
#radius[0] = 8.
#radius[1] = 10.
#radius[2] = 20.
print '---------------------' print '---------------------'
print 'Radius: minimum = ',min(radius) print 'Radius: minimum = ',min(radius)
print 'Radius: maximum = ',max(radius) print 'Radius: maximum = ',max(radius)
......
...@@ -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).
......
...@@ -60,8 +60,6 @@ ...@@ -60,8 +60,6 @@
#include "space.h" #include "space.h"
#include "timers.h" #include "timers.h"
int counter = 0;
/* Global variables. */ /* Global variables. */
int cell_next_tag = 0; int cell_next_tag = 0;
...@@ -913,7 +911,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) { ...@@ -913,7 +911,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
#endif #endif
int rebuild = 0; int rebuild = 0;
/* Un-skip the density tasks involved with this cell. */ /* Un-skip the density tasks involved with this cell. */
for (struct link *l = c->density; l != NULL; l = l->next) { for (struct link *l = c->density; l != NULL; l = l->next) {
struct task *t = l->t; struct task *t = l->t;
...@@ -1078,10 +1076,6 @@ void cell_drift(struct cell *c, const struct engine *e) { ...@@ -1078,10 +1076,6 @@ void cell_drift(struct cell *c, const struct engine *e) {
const double dt = (ti_current - ti_old) * timeBase; const double dt = (ti_current - ti_old) * timeBase;
float dx_max = 0.f, dx2_max = 0.f, h_max = 0.f; float dx_max = 0.f, dx2_max = 0.f, h_max = 0.f;
/* if (c->gcount > 0) */
/* message("dt=%e, ti_old=%lld ti_current=%lld", dt, c->ti_old,
* e->ti_current); */
/* Check that we are actually going to move forward. */ /* Check that we are actually going to move forward. */
if (ti_current < ti_old) error("Attempt to drift to the past"); if (ti_current < ti_old) error("Attempt to drift to the past");
...@@ -1113,8 +1107,6 @@ void cell_drift(struct cell *c, const struct engine *e) { ...@@ -1113,8 +1107,6 @@ void cell_drift(struct cell *c, const struct engine *e) {
if (gp->id_or_neg_offset == ICHECK) { if (gp->id_or_neg_offset == ICHECK) {
message("--- ti_current=%lld time=%e dt=%e---", e->ti_current, e->time, message("--- ti_current=%lld time=%e dt=%e---", e->ti_current, e->time,
dt); dt);
counter++;
message("Drift counter: %d", counter);
printgParticle_single(gp); printgParticle_single(gp);
} }
#endif #endif
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef SWIFT_CONST_H #ifndef SWIFT_CONST_H
#define SWIFT_CONST_H #define SWIFT_CONST_H
#include <stdio.h>
/* SPH Viscosity constants. */ /* SPH Viscosity constants. */
#define const_viscosity_alpha 0.8f #define const_viscosity_alpha 0.8f
#define const_viscosity_alpha_min \ #define const_viscosity_alpha_min \
...@@ -63,7 +61,4 @@ ...@@ -63,7 +61,4 @@
#define ICHECK 0 #define ICHECK 0
#define num_files 4
extern FILE* files_timestep[num_files];
#endif /* SWIFT_CONST_H */ #endif /* SWIFT_CONST_H */
...@@ -71,8 +71,6 @@ ...@@ -71,8 +71,6 @@
#include "units.h" #include "units.h"
#include "version.h" #include "version.h"
FILE *files_timestep[num_files];
/* Particle cache size. */ /* Particle cache size. */
#define CACHE_SIZE 512 #define CACHE_SIZE 512
...@@ -2608,7 +2606,7 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) { ...@@ -2608,7 +2606,7 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) {
struct clocks_time time1, time2; struct clocks_time time1, time2;
clocks_gettime(&time1); clocks_gettime(&time1);
if (e->nodeID == 0) message("Computing initial gas densities.\n\n\n"); if (e->nodeID == 0) message("Computing initial gas densities.");
engine_rebuild(e); engine_rebuild(e);
...@@ -2704,15 +2702,6 @@ void engine_step(struct engine *e) { ...@@ -2704,15 +2702,6 @@ void engine_step(struct engine *e) {
fprintf(e->file_timesteps, " %6d %14e %14e %10zu %10zu %21.3f\n", e->step, fprintf(e->file_timesteps, " %6d %14e %14e %10zu %10zu %21.3f\n", e->step,
e->time, e->timeStep, e->updates, e->g_updates, e->wallclock_time); e->time, e->timeStep, e->updates, e->g_updates, e->wallclock_time);
fflush(e->file_timesteps); fflush(e->file_timesteps);
/* for(int i=0; i<num_files; ++i) { */
/* fprintf(files_timestep[i], " %6d %14e %14e %10zu %10zu %21.3f\n",
* e->step, */
/* e->time, e->timeStep, e->updates, e->g_updates,
* e->wallclock_time); */
/* fflush(files_timestep[i]); */
/* } */
} }
/* Do we need repartitioning ? */ /* Do we need repartitioning ? */
...@@ -2738,12 +2727,11 @@ void engine_step(struct engine *e) { ...@@ -2738,12 +2727,11 @@ void engine_step(struct engine *e) {
engine_launch(e, e->nr_threads); engine_launch(e, e->nr_threads);
TIMER_TOC(timer_runners); TIMER_TOC(timer_runners);
/* Collect the values of rebuild from all nodes. */
/* Collect the values of rebuild from all nodes. */
#ifdef WITH_MPI #ifdef WITH_MPI
int buff = 0; int buff = 0;
if (MPI_Allreduce(&e->forcerebuild, &buff, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD) != if (MPI_Allreduce(&e->forcerebuild, &buff, 1, MPI_INT, MPI_MAX,
MPI_SUCCESS) MPI_COMM_WORLD) != MPI_SUCCESS)
error("Failed to aggregate the rebuild flag across nodes."); error("Failed to aggregate the rebuild flag across nodes.");
e->forcerebuild = buff; e->forcerebuild = buff;
#endif #endif
...@@ -2767,7 +2755,7 @@ void engine_step(struct engine *e) { ...@@ -2767,7 +2755,7 @@ void engine_step(struct engine *e) {
} }
message("snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild, message("snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild,
e->forcerepart); e->forcerepart);
/* Write a snapshot ? */ /* Write a snapshot ? */
if (e->dump_snapshot) { if (e->dump_snapshot) {
...@@ -2782,8 +2770,6 @@ void engine_step(struct engine *e) { ...@@ -2782,8 +2770,6 @@ void engine_step(struct engine *e) {
/* Recover the (integer) end of the next time-step */ /* Recover the (integer) end of the next time-step */
engine_collect_timestep(e); engine_collect_timestep(e);
TIMER_TOC2(timer_step); TIMER_TOC2(timer_step);
clocks_gettime(&time2); clocks_gettime(&time2);
...@@ -2826,10 +2812,6 @@ void engine_drift_all(struct engine *e) { ...@@ -2826,10 +2812,6 @@ void engine_drift_all(struct engine *e) {
message("drift all"); message("drift all");
/* for(int i=0; i<num_files; ++i) { */
/* fprintf(files_timestep[i], "drift all\n"); */
/* } */
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);
...@@ -3047,10 +3029,6 @@ void engine_dump_snapshot(struct engine *e) { ...@@ -3047,10 +3029,6 @@ void engine_dump_snapshot(struct engine *e) {
if (e->verbose) message("writing snapshot at t=%e.", e->time); if (e->verbose) message("writing snapshot at t=%e.", e->time);
/* for(int i=0; i<num_files; ++i) { */
/* fprintf(files_timestep[i], "dump\n"); */
/* } */
message("dump"); message("dump");
/* Dump... */ /* Dump... */
...@@ -3554,12 +3532,6 @@ void engine_init(struct engine *e, struct space *s, ...@@ -3554,12 +3532,6 @@ void engine_init(struct engine *e, struct space *s,
free(buf); free(buf);
#endif #endif
for (int i = 0; i < num_files; ++i) {
char name[10];
sprintf(name, "dt_%d.txt", i);
files_timestep[i] = fopen(name, "w");
}
/* Wait for the runner threads to be in place. */ /* Wait for the runner threads to be in place. */
while (e->barrier_running || e->barrier_launch) while (e->barrier_running || e->barrier_launch)
if (pthread_cond_wait(&e->barrier_cond, &e->barrier_mutex) != 0) if (pthread_cond_wait(&e->barrier_cond, &e->barrier_mutex) != 0)
...@@ -3627,8 +3599,6 @@ void engine_compute_next_snapshot_time(struct engine *e) { ...@@ -3627,8 +3599,6 @@ void engine_compute_next_snapshot_time(struct engine *e) {
*/ */
void engine_clean(struct engine *e) { void engine_clean(struct engine *e) {
for (int i = 0; i < num_files; ++i) fclose(files_timestep[i]);
free(e->snapshotUnits); free(e->snapshotUnits);
free(e->links); free(e->links);
scheduler_clean(&e->sched); scheduler_clean(&e->sched);
......
...@@ -52,9 +52,6 @@ __attribute__((always_inline)) INLINE static void kick_gpart( ...@@ -52,9 +52,6 @@ __attribute__((always_inline)) INLINE static void kick_gpart(
gp->ti_kick = ti_end; gp->ti_kick = ti_end;
#endif #endif
// message("dt= %e gp->ti_kick=%lld", dt, gp->ti_kick);
// fprintf(files_timestep[gp->id_or_neg_offset], "kick: dt=%e\n", dt);
/* Kick particles in momentum space */ /* Kick particles in momentum space */
gp->v_full[0] += gp->a_grav[0] * dt; gp->v_full[0] += gp->a_grav[0] * dt;
gp->v_full[1] += gp->a_grav[1] * dt; gp->v_full[1] += gp->a_grav[1] * dt;
......
...@@ -783,8 +783,6 @@ static void runner_do_unskip(struct cell *c, struct engine *e) { ...@@ -783,8 +783,6 @@ static void runner_do_unskip(struct cell *c, struct engine *e) {
if (forcerebuild) atomic_inc(&e->forcerebuild); if (forcerebuild) atomic_inc(&e->forcerebuild);
} }
// message("c->depth=%d c->split=%d c->count=%.5d c->ti_end_min=%lld c->ti_end_max=%lld c->ti_beg_max=%lld ti_current=%lld", c->depth, c->split, c->count, c->ti_end_min, c->ti_end_max, c->ti_beg_max ,e->ti_current);
/* Recurse */ /* Recurse */
if (c->split) { if (c->split) {
for (int k = 0; k < 8; k++) { for (int k = 0; k < 8; k++) {
......
...@@ -477,10 +477,6 @@ void space_rebuild(struct space *s, int verbose) { ...@@ -477,10 +477,6 @@ void space_rebuild(struct space *s, int verbose) {
fflush(stdout); fflush(stdout);
#endif #endif
/* for(int i=0; i<num_files; ++i) { */
/* fprintf(files_timestep[i], "REBUILD\n"); */
/* } */
/* Re-grid if necessary, or just re-set the cell data. */ /* Re-grid if necessary, or just re-set the cell data. */
space_regrid(s, verbose); space_regrid(s, verbose);
...@@ -1256,23 +1252,21 @@ void space_gparts_sort_mapper(void *map_data, int num_elements, ...@@ -1256,23 +1252,21 @@ void space_gparts_sort_mapper(void *map_data, int num_elements,
} }
} }
/* #ifdef SWIFT_DEBUG_CHECKS */ #ifdef SWIFT_DEBUG_CHECKS
/* /\* Verify space_sort_struct. *\/ */ /* Verify space_sort_struct. */
/* for (int k = i; k <= jj; k++) */ for (int k = i; k <= jj; k++)
/* if (ind[k] > pivot) { */ if (ind[k] > pivot) {
/* message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, j=%li.",
* j=%li.", */ k, ind[k], pivot, i, j);
/* k, ind[k], pivot, i, j); */ error("Partition failed (<=pivot).");
/* error("Partition failed (<=pivot)."); */ }
/* } */ for (int k = jj + 1; k <= j; k++)
/* for (int k = jj + 1; k <= j; k++) */ if (ind[k] <= pivot) {
/* if (ind[k] <= pivot) { */ message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, j=%li.",
/* message("sorting failed at k=%i, ind[k]=%i, pivot=%i, i=%li, k, ind[k], pivot, i, j);
* j=%li.", */ error("Partition failed (>pivot).");
/* k, ind[k], pivot, i, j); */ }
/* error("Partition failed (>pivot)."); */ #endif
/* } */
/* #endif */
/* Split-off largest interval. */ /* Split-off largest interval. */
if (jj - i > j - jj + 1) { if (jj - i > j - jj + 1) {
......
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