Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
SWE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
SWE
Commits
c701ffb6
Commit
c701ffb6
authored
Jan 18, 2013
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some small bugs for the dynamic displacement
parent
9246194a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
+28
-21
SConstruct
SConstruct
+8
-6
swe_mpi.cpp
src/examples/swe_mpi.cpp
+16
-10
SWE_AsagiScenario.hpp
src/scenarios/SWE_AsagiScenario.hpp
+4
-5
No files found.
SConstruct
View file @
c701ffb6
...
@@ -120,7 +120,7 @@ vars.AddVariables(
...
@@ -120,7 +120,7 @@ vars.AddVariables(
)
)
# set environment
# 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
)
variables
=
vars
)
# generate help text
# generate help text
...
@@ -157,10 +157,10 @@ if env['parallelization'] != 'cuda' and env['openGL'] == True:
...
@@ -157,10 +157,10 @@ if env['parallelization'] != 'cuda' and env['openGL'] == True:
# If compiler is set to gnu, we use the default compiler
# If compiler is set to gnu, we use the default compiler
if
env
[
'parallelization'
]
in
[
'mpi'
,
'mpi_with_cuda'
]:
if
env
[
'parallelization'
]
in
[
'mpi'
,
'mpi_with_cuda'
]:
# TODO when compilerPath/linkerPath is set, this is overwritten
# TODO when compilerPath/linkerPath is set, this is overwritten
env
[
'CXX'
]
=
'mpi
CC
'
env
[
'CXX'
]
=
'mpi
cxx
'
if
env
[
'compiler'
]
==
'intel'
:
if
env
[
'compiler'
]
==
'intel'
:
# Environment variables to switch compiler for different MPI libraries
# 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
:
for
var
in
envVars
:
env
[
'ENV'
][
var
]
=
'icpc'
env
[
'ENV'
][
var
]
=
'icpc'
else
:
else
:
...
@@ -252,16 +252,15 @@ if env['parallelization'] in ['cuda', 'mpi_with_cuda']:
...
@@ -252,16 +252,15 @@ if env['parallelization'] in ['cuda', 'mpi_with_cuda']:
if
env
[
'parallelization'
]
in
[
'mpi_with_cuda'
]:
if
env
[
'parallelization'
]
in
[
'mpi_with_cuda'
]:
env
.
Append
(
NVCCFLAGS
=
' -DUSEMPI'
)
env
.
Append
(
NVCCFLAGS
=
' -DUSEMPI'
)
# set the precompiler flags for MPI (C++)
if
env
[
'parallelization'
]
in
[
'mpi_with_cuda'
,
'mpi'
]:
if
env
[
'parallelization'
]
in
[
'mpi_with_cuda'
,
'mpi'
]:
env
.
Append
(
CPPDEFINES
=
[
'USEMPI'
])
env
.
Append
(
CPPDEFINES
=
[
'USEMPI'
])
if
'compilerPath'
in
env
:
if
'compilerPath'
in
env
:
env
[
'CXX'
]
=
env
[
'compilerPath'
]
env
[
'CXX'
]
=
env
[
'compilerPath'
]
else
:
else
:
env
[
'CXX'
]
=
'mpi
CC
'
env
[
'CXX'
]
=
'mpi
cxx
'
if
'linkerPath'
in
env
:
if
'linkerPath'
in
env
:
env
[
'LINKERFORPROGRAMS'
]
=
env
[
'linkerPath'
]
env
[
'LINKERFORPROGRAMS'
]
=
env
[
'linkerPath'
]
env
[
'LINKERFORPROGRAMS'
]
=
'mpi
CC
'
env
[
'LINKERFORPROGRAMS'
]
=
'mpi
cxx
'
if
env
[
'openGL'
]
==
True
:
if
env
[
'openGL'
]
==
True
:
env
.
Append
(
LIBS
=
[
'SDL'
,
'GL'
,
'GLU'
])
env
.
Append
(
LIBS
=
[
'SDL'
,
'GL'
,
'GLU'
])
...
@@ -270,6 +269,9 @@ if env['openGL'] == True:
...
@@ -270,6 +269,9 @@ if env['openGL'] == True:
env
.
Append
(
LIBS
=
[
'SDL_ttf'
])
env
.
Append
(
LIBS
=
[
'SDL_ttf'
])
env
.
Append
(
CPPDEFINES
=
[
'USESDLTTF'
])
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
# set the compiler flags for libSDL
if
'libSDLDir'
in
env
:
if
'libSDLDir'
in
env
:
env
.
Append
(
CPPPATH
=
[
env
[
'libSDLDir'
]
+
'/include/SDL'
])
env
.
Append
(
CPPPATH
=
[
env
[
'libSDLDir'
]
+
'/include/SDL'
])
...
...
src/examples/swe_mpi.cpp
View file @
c701ffb6
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <cmath>
#include <cmath>
#include <cstdlib>
#include <cstdlib>
#include <string>
#include <string>
#include <vector>
#include "../tools/help.hh"
#include "../tools/help.hh"
...
@@ -201,20 +202,20 @@ int main( int argc, char** argv ) {
...
@@ -201,20 +202,20 @@ int main( int argc, char** argv ) {
//simulation area
//simulation area
float
simulationArea
[
4
];
float
simulationArea
[
4
];
simulationArea
[
0
]
=
-
450000
;
simulationArea
[
0
]
=
-
450000
;
simulationArea
[
1
]
=
645
0000
;
simulationArea
[
1
]
=
110
0000
;
simulationArea
[
2
]
=
-
2450000
;
simulationArea
[
2
]
=
-
2450000
;
simulationArea
[
3
]
=
1450
000
;
simulationArea
[
3
]
=
475
000
;
SWE_AsagiScenario
l_scenario
(
ASAGI_INPUT_DIR
"tohoku_gebco_ucsb3_500m_hawaii_bath.nc"
,
SWE_AsagiScenario
l_scenario
(
ASAGI_INPUT_DIR
"tohoku_gebco_ucsb3_500m_hawaii_bath.nc"
,
ASAGI_INPUT_DIR
"tohoku_percy_500m_displ.nc"
,
ASAGI_INPUT_DIR
"tohoku_percy_500m_displ.nc"
,
(
float
)
144
00.
,
simulationArea
,
true
);
(
float
)
40
00.
,
simulationArea
,
true
);
#else
#else
// create a simple artificial scenario
// create a simple artificial scenario
SWE_BathymetryDamBreakScenario
l_scenario
;
SWE_BathymetryDamBreakScenario
l_scenario
;
#endif
#endif
//! number of checkpoints for visualization (at each checkpoint in time, an output file is written).
//! 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.
//! number of grid cells in x- and y-direction per process.
...
@@ -265,12 +266,16 @@ int main( int argc, char** argv ) {
...
@@ -265,12 +266,16 @@ int main( int argc, char** argv ) {
float
l_endSimulation
=
l_scenario
.
endSimulation
();
float
l_endSimulation
=
l_scenario
.
endSimulation
();
//! checkpoints when output files are written.
//! checkpoints when output files are written.
float
*
l_checkPoints
=
new
float
[
l_numberOfCheckPoints
+
1
]
;
std
::
vector
<
float
>
l_checkPoints
;
// compute the checkpoints in time
// compute the checkpoints in time
for
(
int
cp
=
0
;
cp
<=
l_numberOfCheckPoints
;
cp
++
)
{
for
(
float
cp
=
0
;
cp
<
267
;
cp
+=
1.65
)
l_checkPoints
[
cp
]
=
cp
*
(
l_endSimulation
/
l_numberOfCheckPoints
);
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
* Connect SWE blocks at boundaries
...
@@ -386,7 +391,8 @@ int main( int argc, char** argv ) {
...
@@ -386,7 +391,8 @@ int main( int argc, char** argv ) {
l_boundarySize
,
l_boundarySize
,
l_nXLocal
,
l_nYLocal
,
l_nXLocal
,
l_nYLocal
,
l_dX
,
l_dY
,
l_dX
,
l_dY
,
l_originX
,
l_originY
);
l_originX
,
l_originY
,
10
);
#else
#else
// Construct a VtkWriter
// Construct a VtkWriter
io
::
VtkWriter
l_writer
(
l_fileName
,
io
::
VtkWriter
l_writer
(
l_fileName
,
...
@@ -418,7 +424,7 @@ int main( int argc, char** argv ) {
...
@@ -418,7 +424,7 @@ int main( int argc, char** argv ) {
bool
displAvail
=
true
;
bool
displAvail
=
true
;
// loop over checkpoints
// 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
// do time steps until next checkpoint is reached
while
(
l_t
<
l_checkPoints
[
c
]
)
{
while
(
l_t
<
l_checkPoints
[
c
]
)
{
...
...
src/scenarios/SWE_AsagiScenario.hpp
View file @
c701ffb6
...
@@ -240,9 +240,6 @@ class SWE_AsagiScenario: public SWE_Scenario {
...
@@ -240,9 +240,6 @@ class SWE_AsagiScenario: public SWE_Scenario {
//assert(dynamicDisplacement == false);
//assert(dynamicDisplacement == false);
// no assertation for compability
// no assertation for compability
if
(
dynamicDisplacement
)
return
0
;
return
getBathymetryAndDynamicDisplacement
(
i_positionX
,
i_positionY
,
0
);
return
getBathymetryAndDynamicDisplacement
(
i_positionX
,
i_positionY
,
0
);
}
}
...
@@ -274,8 +271,10 @@ class SWE_AsagiScenario: public SWE_Scenario {
...
@@ -274,8 +271,10 @@ class SWE_AsagiScenario: public SWE_Scenario {
i_positionY
<
displacementRange
[
3
]
)
{
i_positionY
<
displacementRange
[
3
]
)
{
if
(
dynamicDisplacement
==
false
)
if
(
dynamicDisplacement
==
false
)
displacementValue
=
displacementGrid
.
grid
().
getFloat2D
(
i_positionX
,
i_positionY
);
displacementValue
=
displacementGrid
.
grid
().
getFloat2D
(
i_positionX
,
i_positionY
);
else
else
{
displacementValue
=
displacementGrid
.
grid
().
getFloat3D
(
i_positionX
,
i_positionY
,
i_time
);
if
(
dynamicDisplacementAvailable
(
i_time
))
displacementValue
=
displacementGrid
.
grid
().
getFloat3D
(
i_positionX
,
i_positionY
,
i_time
);
}
}
}
return
bathymetryValue
+
displacementValue
;
return
bathymetryValue
+
displacementValue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment