Commit ab82b8eb authored by Sebastian Rettenberger's avatar Sebastian Rettenberger

Merge branch 'master' into dynamic_displ

parents c701ffb6 42d1883c
......@@ -281,6 +281,9 @@ if 'libSDLDir' in env:
if env['writeNetCDF'] == True:
env.Append(CPPDEFINES=['WRITENETCDF'])
env.Append(LIBS=['netcdf'])
# define MPI_INCLUDED, if writeNetCDF is used together with MPI
if env['parallelization'] != 'none' and env['parallelization'] != 'cuda':
env.Append(CPPDEFINES=['MPI_INCLUDED'])
# set netCDF location
if 'netCDFDir' in env:
env.Append(CPPPATH=[env['netCDFDir']+'/include'])
......
......@@ -343,29 +343,42 @@ void SWE_Block::setOutflowBoundaries() {
void SWE_Block::setBoundaryType( const BoundaryEdge i_edge,
const BoundaryType i_boundaryType,
const SWE_Block1D* i_inflow) {
boundary[i_edge] = i_boundaryType;
neighbour[i_edge] = i_inflow;
boundary[i_edge] = i_boundaryType;
neighbour[i_edge] = i_inflow;
// set bathymetry values in the ghost layer, if necessary
if( boundary[BND_LEFT] == OUTFLOW || boundary[BND_LEFT] == WALL ) {
memcpy(b[0], b[1], sizeof(float)*(ny+2));
}
if( boundary[BND_RIGHT] == OUTFLOW || boundary[BND_RIGHT] == WALL ) {
memcpy(b[nx+1], b[nx], sizeof(float)*(ny+2));
}
if( boundary[BND_BOTTOM] == OUTFLOW || boundary[BND_BOTTOM] == WALL ) {
for(int i=0; i<=nx+1; i++) {
b[i][0] = b[i][1];
}
}
if( boundary[BND_TOP] == OUTFLOW || boundary[BND_TOP] == WALL ) {
for(int i=0; i<=nx+1; i++) {
b[i][ny+1] = b[i][ny];
}
}
if (i_boundaryType == OUTFLOW || i_boundaryType == WALL)
// One of the boundary was changed to OUTFLOW or WALL
// -> Update the bathymetry for this boundary
setBoundaryBathymetry();
}
// synchronize after an external update of the bathymetry
synchBathymetryAfterWrite();
/**
* Sets the bathymetry on OUTFLOW or WALL boundaries.
* Should be called very time a boundary is changed to a OUTFLOW or
* WALL boundary <b>or</b> the bathymetry changes.
*/
void SWE_Block::setBoundaryBathymetry()
{
// set bathymetry values in the ghost layer, if necessary
if( boundary[BND_LEFT] == OUTFLOW || boundary[BND_LEFT] == WALL ) {
memcpy(b[0], b[1], sizeof(float)*(ny+2));
}
if( boundary[BND_RIGHT] == OUTFLOW || boundary[BND_RIGHT] == WALL ) {
memcpy(b[nx+1], b[nx], sizeof(float)*(ny+2));
}
if( boundary[BND_BOTTOM] == OUTFLOW || boundary[BND_BOTTOM] == WALL ) {
for(int i=0; i<=nx+1; i++) {
b[i][0] = b[i][1];
}
}
if( boundary[BND_TOP] == OUTFLOW || boundary[BND_TOP] == WALL ) {
for(int i=0; i<=nx+1; i++) {
b[i][ny+1] = b[i][ny];
}
}
// synchronize after an external update of the bathymetry
synchBathymetryAfterWrite();
}
// /**
......
......@@ -232,6 +232,9 @@ class SWE_Block {
SWE_Block();
virtual ~SWE_Block();
// Sets the bathymetry on outflow and wall boundaries
void setBoundaryBathymetry();
// synchronisation Methods
virtual void synchAfterWrite();
virtual void synchWaterHeightAfterWrite();
......
......@@ -269,6 +269,9 @@ bool SWE_WavePropagationBlock::updateBathymetryWithDynamicDisplacement(SWE_Asagi
);
}
}
setBoundaryBathymetry();
return true;
}
#endif
......
......@@ -32,6 +32,12 @@
#include <cstring>
#include <string>
#include <vector>
// Needed for NetCDF
#ifdef USEMPI
#include <mpi.h>
#endif
#include <netcdf.h>
#include "writer/Writer.hh"
......
Markdown is supported
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