Fix some small bugs for the dynamic displacement

parent 9246194a
......@@ -120,7 +120,7 @@ vars.AddVariables(
)
# set environment
env = Environment(ENV = {'PATH': os.environ['PATH']},
env = Environment(ENV = {'PATH': os.environ['PATH'], 'INTEL_LICENSE_FILE': os.environ['INTEL_LICENSE_FILE']},
variables=vars)
# generate help text
......@@ -157,10 +157,10 @@ if env['parallelization'] != 'cuda' and env['openGL'] == True:
# If compiler is set to gnu, we use the default compiler
if env['parallelization'] in ['mpi', 'mpi_with_cuda']:
# TODO when compilerPath/linkerPath is set, this is overwritten
env['CXX'] = 'mpiCC'
env['CXX'] = 'mpicxx'
if env['compiler'] == 'intel':
# Environment variables to switch compiler for different MPI libraries
envVars = ['OMPI_CXX', 'MPICH_CXX']
envVars = ['OMPI_CXX', 'MPICH_CXX', 'MPICXX_CXX']
for var in envVars:
env['ENV'][var] = 'icpc'
else:
......@@ -252,16 +252,15 @@ if env['parallelization'] in ['cuda', 'mpi_with_cuda']:
if env['parallelization'] in ['mpi_with_cuda']:
env.Append(NVCCFLAGS=' -DUSEMPI')
# set the precompiler flags for MPI (C++)
if env['parallelization'] in ['mpi_with_cuda', 'mpi']:
env.Append(CPPDEFINES=['USEMPI'])
if 'compilerPath' in env:
env['CXX'] = env['compilerPath']
else:
env['CXX'] = 'mpiCC'
env['CXX'] = 'mpicxx'
if 'linkerPath' in env:
env['LINKERFORPROGRAMS'] = env['linkerPath']
env['LINKERFORPROGRAMS'] = 'mpiCC'
env['LINKERFORPROGRAMS'] = 'mpicxx'
if env['openGL'] == True:
env.Append(LIBS=['SDL', 'GL', 'GLU'])
......@@ -270,6 +269,9 @@ if env['openGL'] == True:
env.Append(LIBS=['SDL_ttf'])
env.Append(CPPDEFINES=['USESDLTTF'])
env.Append(CPPPATH=['/opt/sgi/mpt/mpt-2.04/include'])
env.Append(LIBPATH=['/opt/sgi/mpt/mpt-2.04/lib'])
# set the compiler flags for libSDL
if 'libSDLDir' in env:
env.Append(CPPPATH=[env['libSDLDir']+'/include/SDL'])
......
......@@ -32,6 +32,7 @@
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include "../tools/help.hh"
......@@ -201,20 +202,20 @@ int main( int argc, char** argv ) {
//simulation area
float simulationArea[4];
simulationArea[0] = -450000;
simulationArea[1] = 6450000;
simulationArea[1] = 1100000;
simulationArea[2] = -2450000;
simulationArea[3] = 1450000;
simulationArea[3] = 475000;
SWE_AsagiScenario l_scenario( ASAGI_INPUT_DIR "tohoku_gebco_ucsb3_500m_hawaii_bath.nc",
ASAGI_INPUT_DIR "tohoku_percy_500m_displ.nc",
(float) 14400., simulationArea, true);
(float) 4000., simulationArea, true);
#else
// create a simple artificial scenario
SWE_BathymetryDamBreakScenario l_scenario;
#endif
//! number of checkpoints for visualization (at each checkpoint in time, an output file is written).
int l_numberOfCheckPoints = 40;
//int l_numberOfCheckPoints = 40;
//! number of grid cells in x- and y-direction per process.
......@@ -265,12 +266,16 @@ int main( int argc, char** argv ) {
float l_endSimulation = l_scenario.endSimulation();
//! checkpoints when output files are written.
float* l_checkPoints = new float[l_numberOfCheckPoints+1];
std::vector<float> l_checkPoints;
// compute the checkpoints in time
for(int cp = 0; cp <= l_numberOfCheckPoints; cp++) {
l_checkPoints[cp] = cp*(l_endSimulation/l_numberOfCheckPoints);
}
for (float cp = 0; cp < 267; cp += 1.65)
l_checkPoints.push_back(cp);
for (float cp = 267; cp < 600; cp += 15)
l_checkPoints.push_back(cp);
for (float cp = 600; cp < 6000; cp += 60)
l_checkPoints.push_back(cp);
int l_numberOfCheckPoints = l_checkPoints.size();
/*
* Connect SWE blocks at boundaries
......@@ -386,7 +391,8 @@ int main( int argc, char** argv ) {
l_boundarySize,
l_nXLocal, l_nYLocal,
l_dX, l_dY,
l_originX, l_originY );
l_originX, l_originY,
10 );
#else
// Construct a VtkWriter
io::VtkWriter l_writer( l_fileName,
......@@ -418,7 +424,7 @@ int main( int argc, char** argv ) {
bool displAvail = true;
// loop over checkpoints
for(int c=1; c<=l_numberOfCheckPoints; c++) {
for(int c=1; c<l_numberOfCheckPoints; c++) {
// do time steps until next checkpoint is reached
while( l_t < l_checkPoints[c] ) {
......
......@@ -240,9 +240,6 @@ class SWE_AsagiScenario: public SWE_Scenario {
//assert(dynamicDisplacement == false);
// no assertation for compability
if (dynamicDisplacement)
return 0;
return getBathymetryAndDynamicDisplacement(i_positionX, i_positionY, 0);
}
......@@ -274,8 +271,10 @@ class SWE_AsagiScenario: public SWE_Scenario {
i_positionY < displacementRange[3] ) {
if(dynamicDisplacement == false)
displacementValue = displacementGrid.grid().getFloat2D(i_positionX, i_positionY);
else
displacementValue = displacementGrid.grid().getFloat3D(i_positionX, i_positionY, i_time);
else {
if (dynamicDisplacementAvailable(i_time))
displacementValue = displacementGrid.grid().getFloat3D(i_positionX, i_positionY, i_time);
}
}
return bathymetryValue + displacementValue;
......
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