From 19995a1f05fe56ded22173ef593d604cece0ad4b Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 15 Mar 2022 18:03:11 +0100 Subject: [PATCH] fix: k = 2 pi --- Exercise_01/src/Solver.h | 3 +-- Exercise_01/src/main.cpp | 16 +++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Exercise_01/src/Solver.h b/Exercise_01/src/Solver.h index 73a11ac..e438e4e 100644 --- a/Exercise_01/src/Solver.h +++ b/Exercise_01/src/Solver.h @@ -4,8 +4,7 @@ #include "Matrix.h" -/** Stencil - */ +/** Stencil */ struct Stencil { const double C; /*< Center */ const double B; /*< Bottom */ diff --git a/Exercise_01/src/main.cpp b/Exercise_01/src/main.cpp index 83b8acc..f0dd5b1 100644 --- a/Exercise_01/src/main.cpp +++ b/Exercise_01/src/main.cpp @@ -108,7 +108,7 @@ int main(int argn, char* argv[]) { auto start = std::chrono::high_resolution_clock::now(); /**************** Setup (local) PDE + Boundary Conditions *****************/ - const double k = M_PI; + const double k = 2 * M_PI; const double h = 1.0 / static_cast(resolution - 1); #ifdef USE_MPI @@ -124,11 +124,13 @@ int main(int argn, char* argv[]) { } // Report grid topology - std::cout << "topology: " << dim << "D"; - if (dim == 2) { - std::cout << " (" << mpi_dims[0] << " x " << mpi_dims[1] << ")"; + if (mpi_world_rank == 0) { + std::cout << "topology: " << dim << "D"; + if (dim == 2) { + std::cout << " (" << mpi_dims[0] << " x " << mpi_dims[1] << ")"; + } + std::cout << std::endl; } - std::cout << std::endl; // Setup a Cartesian topology communicator (NON-cyclic) const int mpi_periods[2] = {false, false}; @@ -263,10 +265,6 @@ int main(int argn, char* argv[]) { &mpi_requests[mpi_request_count++]); } - // Wait for all send to complete before receiving new data - // (just to be save) - MPI_Waitall(mpi_request_count, mpi_requests, MPI_STATUSES_IGNORE); - // Get new boundary conditions using a blocking receive MPI_Status mpi_status; if (mpi_neighbors.north != MPI_PROC_NULL) {