diff --git a/src/engine.c b/src/engine.c index 295fdb824b8378033aa254091695c4a325d136b6..28b1d4b2e8b42cb865125f610f718b1d7130bd63 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1669,10 +1669,10 @@ void engine_make_self_gravity_tasks(struct engine *e) { /* Make the ghosts implicit and add the dependencies */ for (int n = 0; n < n_ghosts / 2; ++n) { - ghosts[2 * n + 0] = scheduler_addtask(sched, task_type_grav_ghost, - task_subtype_none, 0, 0, NULL, NULL); - ghosts[2 * n + 1] = scheduler_addtask(sched, task_type_grav_ghost, - task_subtype_none, 0, 0, NULL, NULL); + ghosts[2 * n + 0] = scheduler_addtask( + sched, task_type_grav_ghost, task_subtype_none, 0, 0, NULL, NULL); + ghosts[2 * n + 1] = scheduler_addtask( + sched, task_type_grav_ghost, task_subtype_none, 0, 0, NULL, NULL); ghosts[2 * n + 0]->implicit = 1; ghosts[2 * n + 1]->implicit = 1; scheduler_addunlock(sched, ghosts[2 * n + 0], s->grav_top_level); @@ -3063,7 +3063,7 @@ void engine_print_stats(struct engine *e) { e->policy & engine_policy_self_gravity); /* Be verbose about this */ - if(e->nodeID == 0) message("Saving statistics at t=%e.", e->time); + if (e->nodeID == 0) message("Saving statistics at t=%e.", e->time); #else if (e->verbose) message("Saving statistics at t=%e.", e->time); #endif diff --git a/src/runner_doiact_fft.c b/src/runner_doiact_fft.c index 01ccb3446dda35135c01a13cd213c8b6368d79ec..a3e3f38fba920c0c58d600bb25feda88d4a3cf84 100644 --- a/src/runner_doiact_fft.c +++ b/src/runner_doiact_fft.c @@ -37,6 +37,8 @@ #include "space.h" #include "timers.h" +#ifdef HAVE_FFTW + /** * @brief Returns 1D index of a 3D NxNxN array using row-major style. * @@ -137,6 +139,8 @@ __attribute__((always_inline)) INLINE static void mesh_to_multipole_CIC( m->pot.F_000 += pot[row_major_id(i + 1, j + 1, k + 1, N)] * dx * dy * dz; } +#endif + /** * @brief Computes the potential on the top multipoles using a Fourier transform * diff --git a/src/space.c b/src/space.c index 9cb7e5f961005da7d73c53a910c9852e7bfcf174..b1612876b6339fb29648a87e9aec93a1d8f64664 100644 --- a/src/space.c +++ b/src/space.c @@ -2432,19 +2432,20 @@ void space_getcells(struct space *s, int nr_cells, struct cell **cells) { } void space_synchronize_particle_positions_mapper(void *map_data, int nr_gparts, - void *extra_data) { + void *extra_data) { /* Unpack the data */ struct gpart *restrict gparts = (struct gpart *)map_data; - struct space *s = (struct space*) extra_data; + struct space *s = (struct space *)extra_data; for (int k = 0; k < nr_gparts; k++) { /* Get the particle */ const struct gpart *restrict gp = &gparts[k]; - if(gp->type == swift_type_dark_matter) continue; - - else if(gp->type == swift_type_gas) { + if (gp->type == swift_type_dark_matter) + continue; + + else if (gp->type == swift_type_gas) { /* Get it's gassy friend */ struct part *p = &s->parts[-gp->id_or_neg_offset]; @@ -2460,7 +2461,7 @@ void space_synchronize_particle_positions_mapper(void *map_data, int nr_gparts, xp->v_full[2] = gp->v_full[2]; } - else if(gp->type == swift_type_star) { + else if (gp->type == swift_type_star) { /* Get it's stellar friend */ struct spart *sp = &s->sparts[-gp->id_or_neg_offset]; @@ -2470,17 +2471,16 @@ void space_synchronize_particle_positions_mapper(void *map_data, int nr_gparts, sp->x[1] = gp->x[1]; sp->x[2] = gp->x[2]; } - } } - void space_synchronize_particle_positions(struct space *s) { - if ((s->nr_gparts > 0 && s->nr_parts > 0) || - (s->nr_gparts > 0 && s->nr_sparts > 0)) - threadpool_map(&s->e->threadpool, space_synchronize_particle_positions_mapper, - s->gparts, s->nr_gparts, sizeof(struct gpart), 1000, (void*)s); + if ((s->nr_gparts > 0 && s->nr_parts > 0) || + (s->nr_gparts > 0 && s->nr_sparts > 0)) + threadpool_map(&s->e->threadpool, + space_synchronize_particle_positions_mapper, s->gparts, + s->nr_gparts, sizeof(struct gpart), 1000, (void *)s); } /** diff --git a/tests/difffloat.py b/tests/difffloat.py index f989ccb56fb1f008d4a60931cb7165f4f2156ebd..0bdc706a1c44ee6c42c54ad37e93f634742e06bc 100644 --- a/tests/difffloat.py +++ b/tests/difffloat.py @@ -107,7 +107,7 @@ for i in range(n_lines_to_check): print "" error = True - if abs(data1[i,j]) + abs(data2[i,j]) < 1e-6 : continue + if abs(data1[i,j]) < 4e-6 and abs(data2[i,j]) < 4e-6 : continue # Ignore pathological cases with rho_dh if ignoreSmallRhoDh and j == 8 and abs(data1[i,j]) < 2e-4: continue diff --git a/tests/test125cells.c b/tests/test125cells.c index b424187b743973c898ce887435eb8c1b64f4e386..e4c73b5e75df56436d277d719b3b83a179924a6f 100644 --- a/tests/test125cells.c +++ b/tests/test125cells.c @@ -237,6 +237,8 @@ void reset_particles(struct cell *c, struct hydro_space *hs, * separation. * @param density The density of the fluid. * @param partId The running counter of IDs. + * @param pert The perturbation to apply to the particles in the cell in units + *of the inter-particle separation. * @param vel The type of velocity field. * @param press The type of pressure field. */ diff --git a/tests/test125cells.sh.in b/tests/test125cells.sh.in index dbaf6ebd59a1fe7260b31e2cab5b661b0bfe704d..d6d3ddc5b6b61bbd493c94005fd500a93ae7a01d 100755 --- a/tests/test125cells.sh.in +++ b/tests/test125cells.sh.in @@ -7,15 +7,25 @@ do rm -f brute_force_125_standard.dat swift_dopair_125_standard.dat + echo "Running ./test125cells -n 6 -r 1 -v $v -p $p -f standard" ./test125cells -n 6 -r 1 -v $v -p $p -f standard if [ -e brute_force_125_standard.dat ] then - python @srcdir@/difffloat.py brute_force_125_standard.dat swift_dopair_125_standard.dat @srcdir@/tolerance_125_normal.dat 6 + if python @srcdir@/difffloat.py brute_force_125_standard.dat swift_dopair_125_standard.dat @srcdir@/tolerance_125_normal.dat 6 + then + echo "Accuracy test passed" + else + echo "Accuracy test failed" + exit 1 + fi else + echo "Error Missing test output file" exit 1 fi + echo "------------" + done done diff --git a/tests/test125cellsPerturbed.sh.in b/tests/test125cellsPerturbed.sh.in index 887eef4f6aa972368a3439f0c6fd9bc89f6b44c3..9a5cfc07c978b0cfd5aa050aa117e887a1d40907 100755 --- a/tests/test125cellsPerturbed.sh.in +++ b/tests/test125cellsPerturbed.sh.in @@ -7,15 +7,25 @@ do rm -f brute_force_125_perturbed.dat swift_dopair_125_perturbed.dat + echo "Running ./test125cells -n 6 -r 1 -d 0.1 -v $v -p $p -f perturbed" ./test125cells -n 6 -r 1 -d 0.1 -v $v -p $p -f perturbed if [ -e brute_force_125_perturbed.dat ] then - python @srcdir@/difffloat.py brute_force_125_perturbed.dat swift_dopair_125_perturbed.dat @srcdir@/tolerance_125_perturbed.dat 6 + if python @srcdir@/difffloat.py brute_force_125_perturbed.dat swift_dopair_125_perturbed.dat @srcdir@/tolerance_125_perturbed.dat 6 + then + echo "Accuracy test passed" + else + echo "Accuracy test failed" + exit 1 + fi else + echo "Error Missing test output file" exit 1 fi + echo "------------" + done done diff --git a/tests/test27cells.sh.in b/tests/test27cells.sh.in index 07b6b92a82cee2bbe9c593f8f62e750d4406f84e..4312ce55e13097d4ae40c289b9c5caa885ff37cc 100755 --- a/tests/test27cells.sh.in +++ b/tests/test27cells.sh.in @@ -3,18 +3,28 @@ for v in {0..3} do echo "" - + rm -f brute_force_27_standard.dat swift_dopair_27_standard.dat + echo "Running ./test27cells -n 6 -r 1 -d 0 -f standard -v $v -a 1e-4" ./test27cells -n 6 -r 1 -d 0 -f standard -v $v -a 1e-4 if [ -e brute_force_27_standard.dat ] then - python @srcdir@/difffloat.py brute_force_27_standard.dat swift_dopair_27_standard.dat @srcdir@/tolerance_27_normal.dat 6 + if python @srcdir@/difffloat.py brute_force_27_standard.dat swift_dopair_27_standard.dat @srcdir@/tolerance_27_normal.dat 6 + then + echo "Accuracy test passed" + else + echo "Accuracy test failed" + exit 1 + fi else + echo "Error Missing test output file" exit 1 fi + echo "------------" + done exit $? diff --git a/tests/test27cellsPerturbed.sh.in b/tests/test27cellsPerturbed.sh.in index 1eb7b31bcd668e7362a9eb907be501aa8016abb8..2f2e1db76346ca8f0ea4c2365ee349e232a1ce53 100755 --- a/tests/test27cellsPerturbed.sh.in +++ b/tests/test27cellsPerturbed.sh.in @@ -6,15 +6,25 @@ do rm -f brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat + echo "Running ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -a 5e-4" ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -a 5e-4 if [ -e brute_force_27_perturbed.dat ] then - python @srcdir@/difffloat.py brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat @srcdir@/tolerance_27_perturbed.dat 6 1 + if python @srcdir@/difffloat.py brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat @srcdir@/tolerance_27_perturbed.dat 6 1 + then + echo "Accuracy test passed" + else + echo "Accuracy test failed" + exit 1 + fi else + echo "Error Missing test output file" exit 1 fi + echo "------------" + done exit $? diff --git a/tests/tolerance_125_perturbed.dat b/tests/tolerance_125_perturbed.dat index c9ad23d4472c46e64e8418e46c5fe71f813b23b5..04e642b28cb3729cb81f8183c3e69595ac651876 100644 --- a/tests/tolerance_125_perturbed.dat +++ b/tests/tolerance_125_perturbed.dat @@ -1,3 +1,3 @@ # ID pos_x pos_y pos_z v_x v_y v_z h rho div_v S u P c a_x a_y a_z h_dt v_sig dS/dt du/dt 0 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 - 0 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 + 0 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 1e-4 5e-3 5e-3 5e-3 1e-4 1e-4 1e-4 1e-4 diff --git a/tests/tolerance_27_perturbed.dat b/tests/tolerance_27_perturbed.dat index b6ed8c2c18808156056f9c5816212866c2dfa998..9c6ee8c77cc6d53e67db9dbb86be197d49149b10 100644 --- a/tests/tolerance_27_perturbed.dat +++ b/tests/tolerance_27_perturbed.dat @@ -1,3 +1,3 @@ # ID pos_x pos_y pos_z v_x v_y v_z rho rho_dh wcount wcount_dh div_v curl_vx curl_vy curl_vz - 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1.2e-6 1e-4 5e-5 2e-3 3.1e-6 3e-6 3e-6 3e-6 - 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-3 1e-5 1e-4 2e-5 2e-3 2e-3 2e-3 + 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1.2e-6 1e-4 5e-5 2e-3 4e-6 3e-6 3e-6 3e-6 + 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-3 1e-5 1e-4 4e-5 2e-3 2e-3 2e-3