From 6b2fcd8943a8cd089e6d2b38c373742ccfe2c1fc Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sat, 26 Mar 2016 18:11:00 +0000 Subject: [PATCH] Updated the tests to be safe against hydro-scheme changes --- tests/test27cells.c | 14 ++++++++++++-- tests/testPair.c | 14 ++++++++++++-- tests/testSPHStep.c | 8 ++++++-- tests/testSingle.c | 12 ++++++------ 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/tests/test27cells.c b/tests/test27cells.c index 7003ce8e6f..74c38996a8 100644 --- a/tests/test27cells.c +++ b/tests/test27cells.c @@ -156,9 +156,14 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, main_cell->parts[pid].v[2], main_cell->parts[pid].rho, main_cell->parts[pid].rho_dh, main_cell->parts[pid].density.wcount, main_cell->parts[pid].density.wcount_dh, +#ifdef GADGET2_SPH main_cell->parts[pid].div_v, main_cell->parts[pid].density.rot_v[0], main_cell->parts[pid].density.rot_v[1], - main_cell->parts[pid].density.rot_v[2]); + main_cell->parts[pid].density.rot_v[2] +#else + 0., 0., 0., 0. +#endif + ); } /* Write all other cells */ @@ -182,8 +187,13 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, cj->parts[pjd].x[2], cj->parts[pjd].v[0], cj->parts[pjd].v[1], cj->parts[pjd].v[2], cj->parts[pjd].rho, cj->parts[pjd].rho_dh, cj->parts[pjd].density.wcount, cj->parts[pjd].density.wcount_dh, +#ifdef GADGET2_SPH cj->parts[pjd].div_v, cj->parts[pjd].density.rot_v[0], - cj->parts[pjd].density.rot_v[1], cj->parts[pjd].density.rot_v[2]); + cj->parts[pjd].density.rot_v[1], cj->parts[pjd].density.rot_v[2] +#else + 0., 0., 0., 0. +#endif + ); } } } diff --git a/tests/testPair.c b/tests/testPair.c index 0bd513f059..23ce4eb3de 100644 --- a/tests/testPair.c +++ b/tests/testPair.c @@ -143,8 +143,13 @@ void dump_particle_fields(char *fileName, struct cell *ci, struct cell *cj) { ci->parts[pid].x[2], ci->parts[pid].v[0], ci->parts[pid].v[1], ci->parts[pid].v[2], ci->parts[pid].rho, ci->parts[pid].rho_dh, ci->parts[pid].density.wcount, ci->parts[pid].density.wcount_dh, +#ifdef GADGET2_SPH ci->parts[pid].div_v, ci->parts[pid].density.rot_v[0], - ci->parts[pid].density.rot_v[1], ci->parts[pid].density.rot_v[2]); + ci->parts[pid].density.rot_v[1], ci->parts[pid].density.rot_v[2] +#else + 0., 0., 0., 0. +#endif + ); } fprintf(file, "# cj --------------------------------------------\n"); @@ -157,8 +162,13 @@ void dump_particle_fields(char *fileName, struct cell *ci, struct cell *cj) { cj->parts[pjd].x[2], cj->parts[pjd].v[0], cj->parts[pjd].v[1], cj->parts[pjd].v[2], cj->parts[pjd].rho, cj->parts[pjd].rho_dh, cj->parts[pjd].density.wcount, cj->parts[pjd].density.wcount_dh, +#ifdef GADGET2_SPH cj->parts[pjd].div_v, cj->parts[pjd].density.rot_v[0], - cj->parts[pjd].density.rot_v[1], cj->parts[pjd].density.rot_v[2]); + cj->parts[pjd].density.rot_v[1], cj->parts[pjd].density.rot_v[2] +#else + 0., 0., 0., 0. +#endif + ); } fclose(file); diff --git a/tests/testSPHStep.c b/tests/testSPHStep.c index 984b8ea867..223078ecb6 100644 --- a/tests/testSPHStep.c +++ b/tests/testSPHStep.c @@ -77,6 +77,10 @@ struct cell *make_cell(size_t N, float cellSize, int offset[3], int id_offset) { #ifdef DEFAULT_SPH +/* Just a forward declaration... */ +void runner_doself1_density(struct runner *r, struct cell *ci); +void runner_doself2_force(struct runner *r, struct cell *ci); + /* Run a full time step integration for one cell */ int main() { @@ -132,7 +136,7 @@ int main() { /* Initialise the particles */ for (j = 0; j < 27; ++j) { - runner_doinit(&r, cells[j]); + runner_doinit(&r, cells[j], 0); } /* Compute density */ @@ -145,7 +149,7 @@ int main() { runner_doself2_force(&r, ci); runner_dokick(&r, ci, 1); - message("t_end=%f", p->t_end); + message("ti_end=%d", p->ti_end); free(ci->parts); free(ci->xparts); diff --git a/tests/testSingle.c b/tests/testSingle.c index c85b77ff1c..f7e7d03a5e 100644 --- a/tests/testSingle.c +++ b/tests/testSingle.c @@ -91,8 +91,8 @@ int main(int argc, char *argv[]) { p2.force.POrho2 = p2.u * (const_hydro_gamma - 1.0f) / p2.rho; /* Dump a header. */ - printParticle_single(&p1); - printParticle_single(&p2); + printParticle_single(&p1, NULL); + printParticle_single(&p2, NULL); printf("# r a_1 udt_1 a_2 udt_2\n"); /* Loop over the different radii. */ @@ -103,9 +103,9 @@ int main(int argc, char *argv[]) { r2 = dx[0] * dx[0]; /* Clear the particle fields. */ - p1.a[0] = 0.0f; + p1.a_hydro[0] = 0.0f; p1.force.u_dt = 0.0f; - p2.a[0] = 0.0f; + p2.a_hydro[0] = 0.0f; p2.force.u_dt = 0.0f; /* Interact the particles. */ @@ -130,8 +130,8 @@ int main(int argc, char *argv[]) { /* Output the results. */ printf( - "%.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e\n", -dx[0], p1.a[0], - p1.a[1], p1.a[2], p1.force.u_dt, + "%.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e %.3e\n", -dx[0], + p1.a_hydro[0], p1.a_hydro[1], p1.a_hydro[2], p1.force.u_dt, /// -dx[0] , p1.rho , p1.density.wcount , p2.rho , p2.density.wcount , w, dwdx, gradw[0], gradw[1], gradw[2]); -- GitLab