Skip to content
Snippets Groups Projects
Commit b2692841 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Output the position of the cell in the output of the periodic boundary...

Output the position of the cell in the output of the periodic boundary condition test. Better tolerance requirements.
parent 473ba476
No related branches found
No related tags found
1 merge request!350Test periodic bc
......@@ -211,7 +211,7 @@ void end_calculation(struct cell *c) {
/**
* @brief Dump all the particles to a file
*/
void dump_particle_fields(char *fileName, struct cell *main_cell) {
void dump_particle_fields(char *fileName, struct cell *main_cell, int i, int j, int k) {
FILE *file = fopen(fileName, "a");
/* Write header */
......@@ -221,7 +221,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell) {
"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");
fprintf(file, "# Main cell --------------------------------------------\n");
fprintf(file, "# Centre cell at (i,j,k)=(%d, %d, %d) ---------------------\n", i,j,k);
/* Write main cell */
for (int pid = 0; pid < main_cell->count; pid++) {
......@@ -331,7 +331,7 @@ void test_boundary_conditions(struct cell **cells, struct runner runner,
end_calculation(main_cell);
/* Dump particles from the main cell. */
dump_particle_fields(swiftOutputFileName, main_cell);
dump_particle_fields(swiftOutputFileName, main_cell, loc_i, loc_j, loc_k);
/* Now perform a brute-force version for accuracy tests */
......@@ -369,7 +369,7 @@ void test_boundary_conditions(struct cell **cells, struct runner runner,
end_calculation(main_cell);
/* Dump */
dump_particle_fields(bruteForceOutputFileName, main_cell);
dump_particle_fields(bruteForceOutputFileName, main_cell, loc_i, loc_j, loc_k);
}
/* And go... */
......
# 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 4e-6 4e-5 2e-4 3e-3 2e-4 1e-4 1e-4 1e-4
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-6 1.2e-4 1e-4 1e-4 3e-4 5e-4 5e-4 5e-4
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-4 1e-6 1e-4 1e-4 1e-4 1e-4 1e-4
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-6 2e-4 1e-4 1e-4 5e-4 2e-3 2e-3 2e-3
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-4 1e-6 1e-4 5e-4 2e-4 2e-4 2e-4
# 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 3e-6 4e-5 2e-4 3e-3 2e-4 1e-4 1e-4 1e-4
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-6 3e-3 1e-4 1e-4 2e-3 6e-3 6e-3 6e-3
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-3 1e-6 1e-4 1e-4 1e-4 1e-4 1e-4
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-6 6e-3 1e-4 1e-4 5e-3 6e-3 6e-3 6e-3
0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 2e-3 1e-6 1e-4 5e-4 3e-3 3e-3 3e-3
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment