Commit 6b2fcd89 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Updated the tests to be safe against hydro-scheme changes

parent d6ab77d4
......@@ -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
);
}
}
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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]);
......
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