/import/home/rettenbs/src/SWE/src/examples/swe_mpi.cpp File Reference
#include <mpi.h>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <string>
#include "blocks/SWE_WavePropagationBlock.hh"
#include "writer/VtkWriter.hh"
#include "scenarios/SWE_simple_scenarios.hh"
#include "tools/help.hh"
#include "tools/Logger.hh"
#include "tools/ProgressBar.hh"


int computeNumberOfBlockRows (int i_numberOfProcesses)
void exchangeLeftRightGhostLayers (const int i_leftNeighborRank, SWE_Block1D *o_leftInflow, SWE_Block1D *i_leftOutflow, const int i_rightNeighborRank, SWE_Block1D *o_rightInflow, SWE_Block1D *i_rightOutflow, MPI_Datatype i_mpiCol)
void exchangeBottomTopGhostLayers (const int i_bottomNeighborRank, SWE_Block1D *o_bottomNeighborInflow, SWE_Block1D *i_bottomNeighborOutflow, const int i_topNeighborRank, SWE_Block1D *o_topNeighborInflow, SWE_Block1D *i_topNeighborOutflow, const MPI_Datatype i_mpiRow)
int main (int argc, char **argv)

Detailed Description

This file is part of SWE.

Michael Bader (bader AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Univ.-Prof._Dr._Michael_Bader)
Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)


SWE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SWE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with SWE. If not, see <http://www.gnu.org/licenses/>.


Setting of SWE, which uses a wave propagation solver and an artificial or ASAGI scenario on multiple blocks.

Function Documentation

int computeNumberOfBlockRows ( int  i_numberOfProcesses)

Compute the number of block rows from the total number of processes.

The number of rows is determined as the square root of the number of processes, if this is a square number; otherwise, we use the largest number that is smaller than the square root and still a divisor of the number of processes.

numProcsnumber of process.
number of block rows
void exchangeBottomTopGhostLayers ( const int  i_bottomNeighborRank,
SWE_Block1D o_bottomNeighborInflow,
SWE_Block1D i_bottomNeighborOutflow,
const int  i_topNeighborRank,
SWE_Block1D o_topNeighborInflow,
SWE_Block1D i_topNeighborOutflow,
const MPI_Datatype  i_mpiRow 

Exchanges the bottom and top ghost layers with MPI's SendReceive.

i_bottomNeighborRankMPI rank of the bottom neighbor.
o_bottomNeighborInflowghost layer, where the bottom neighbor writes into.
i_bottomNeighborOutflowhost layer, where the bottom neighbor reads from.
i_topNeighborRankMPI rank of the top neighbor.
o_topNeighborInflowghost layer, where the top neighbor writes into.
i_topNeighborOutflowghost layer, where the top neighbor reads from.
i_mpiRowMPI data type for the horizontal ghost layers.
void exchangeLeftRightGhostLayers ( const int  i_leftNeighborRank,
SWE_Block1D o_leftInflow,
SWE_Block1D i_leftOutflow,
const int  i_rightNeighborRank,
SWE_Block1D o_rightInflow,
SWE_Block1D i_rightOutflow,
MPI_Datatype  i_mpiCol 

Exchanges the left and right ghost layers with MPI's SendReceive.

i_leftNeighborRankMPI rank of the left neighbor.
o_leftInflowghost layer, where the left neighbor writes into.
i_leftOutflowlayer where the left neighbor reads from.
i_rightNeighborRankMPI rank of the right neighbor.
o_rightInflowghost layer, where the right neighbor writes into.
i_rightOutflowlayer, where the right neighbor reads form.
i_mpiColMPI data type for the vertical gost layers.
int main ( int  argc,
char **  argv 

Main program for the simulation on a single SWE_WavePropagationBlock.


MPI Rank of a process.

number of MPI processes.

total number of grid cell in x- and y-direction.

l_baseName of the plots.

number of SWE_Blocks in x- and y-direction.

local position of each MPI process in x- and y-direction.

number of checkpoints for visualization (at each checkpoint in time, an output file is written).

number of grid cells in x- and y-direction per process.

size of a single cell in x- and y-direction

origin of the simulation domain in x- and y-direction

time when the simulation ends.

checkpoints when output files are written.

MPI row-vector: l_nXLocal+2 blocks, 1 element per block, stride of l_nYLocal+2

MPI row-vector: 1 block, l_nYLocal+2 elements per block, stride of 1

MPI ranks of the neighbors


simulation time.

maximum allowed time step width within a block.

maximum allowed time steps of all blocks


 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends