fix: k = 2 pi

This commit is contained in:
Daniel Kapla 2022-03-15 18:03:11 +01:00
parent 1992c38dc4
commit 19995a1f05
2 changed files with 8 additions and 11 deletions

View File

@ -4,8 +4,7 @@
#include "Matrix.h" #include "Matrix.h"
/** Stencil /** Stencil */
*/
struct Stencil { struct Stencil {
const double C; /*< Center */ const double C; /*< Center */
const double B; /*< Bottom */ const double B; /*< Bottom */

View File

@ -108,7 +108,7 @@ int main(int argn, char* argv[]) {
auto start = std::chrono::high_resolution_clock::now(); auto start = std::chrono::high_resolution_clock::now();
/**************** Setup (local) PDE + Boundary Conditions *****************/ /**************** Setup (local) PDE + Boundary Conditions *****************/
const double k = M_PI; const double k = 2 * M_PI;
const double h = 1.0 / static_cast<double>(resolution - 1); const double h = 1.0 / static_cast<double>(resolution - 1);
#ifdef USE_MPI #ifdef USE_MPI
@ -124,11 +124,13 @@ int main(int argn, char* argv[]) {
} }
// Report grid topology // Report grid topology
if (mpi_world_rank == 0) {
std::cout << "topology: " << dim << "D"; std::cout << "topology: " << dim << "D";
if (dim == 2) { if (dim == 2) {
std::cout << " (" << mpi_dims[0] << " x " << mpi_dims[1] << ")"; std::cout << " (" << mpi_dims[0] << " x " << mpi_dims[1] << ")";
} }
std::cout << std::endl; std::cout << std::endl;
}
// Setup a Cartesian topology communicator (NON-cyclic) // Setup a Cartesian topology communicator (NON-cyclic)
const int mpi_periods[2] = {false, false}; const int mpi_periods[2] = {false, false};
@ -263,10 +265,6 @@ int main(int argn, char* argv[]) {
&mpi_requests[mpi_request_count++]); &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 // Get new boundary conditions using a blocking receive
MPI_Status mpi_status; MPI_Status mpi_status;
if (mpi_neighbors.north != MPI_PROC_NULL) { if (mpi_neighbors.north != MPI_PROC_NULL) {