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
93a4ae11
Commit
93a4ae11
authored
Jan 17, 2013
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Measure one kernel only
parent
a9769f3f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
SWE_WavePropagationBlock.cpp
src/SWE_WavePropagationBlock.cpp
+13
-4
swe_mpi.cpp
src/examples/swe_mpi.cpp
+4
-4
swe_wavepropagation.cpp
src/examples/swe_wavepropagation.cpp
+3
-2
No files found.
src/SWE_WavePropagationBlock.cpp
View file @
93a4ae11
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
#include <omp.h>
#include <omp.h>
#endif
#endif
#include "tools/Logger.hpp"
/**
/**
* Constructor of a SWE_WavePropagationBlock.
* Constructor of a SWE_WavePropagationBlock.
*
*
...
@@ -106,6 +108,8 @@ SWE_WavePropagationBlock::SWE_WavePropagationBlock():
...
@@ -106,6 +108,8 @@ SWE_WavePropagationBlock::SWE_WavePropagationBlock():
* maximum allowed time step size
* maximum allowed time step size
*/
*/
void
SWE_WavePropagationBlock
::
computeNumericalFluxes
()
{
void
SWE_WavePropagationBlock
::
computeNumericalFluxes
()
{
// tools::Logger::logger.resetCpuClockToCurrentTime();
//maximum (linearized) wave speed within one iteration
//maximum (linearized) wave speed within one iteration
float
maxWaveSpeed
=
(
float
)
0.
;
float
maxWaveSpeed
=
(
float
)
0.
;
...
@@ -188,7 +192,7 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
...
@@ -188,7 +192,7 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
}
// end of parallel for block
}
// end of parallel for block
#endif
#endif
if
(
maxWaveSpeed
>
0.00001
)
{
//TODO zeroTol
//
if(maxWaveSpeed > 0.00001) { //TODO zeroTol
//compute the time step width
//compute the time step width
//CFL-Codition
//CFL-Codition
//(max. wave speed) * dt / dx < .5
//(max. wave speed) * dt / dx < .5
...
@@ -200,10 +204,11 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
...
@@ -200,10 +204,11 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
// #else
// #else
// dt *= (float) .8; //CFL-number = 1. (wave limiters)
// dt *= (float) .8; //CFL-number = 1. (wave limiters)
// #endif
// #endif
}
//
}
else
//
else
maxTimestep
=
std
::
numeric_limits
<
float
>::
max
();
//might happen in dry cells
//
maxTimestep = std::numeric_limits<float>::max(); //might happen in dry cells
// tools::Logger::logger.updateCpuTime();
}
}
/**
/**
...
@@ -212,6 +217,8 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
...
@@ -212,6 +217,8 @@ void SWE_WavePropagationBlock::computeNumericalFluxes() {
* @param dt time step width used in the update.
* @param dt time step width used in the update.
*/
*/
void
SWE_WavePropagationBlock
::
updateUnknowns
(
float
dt
)
{
void
SWE_WavePropagationBlock
::
updateUnknowns
(
float
dt
)
{
tools
::
Logger
::
logger
.
resetCpuClockToCurrentTime
();
//update cell averages with the net-updates
//update cell averages with the net-updates
#ifdef LOOP_OPENMP
#ifdef LOOP_OPENMP
#pragma omp parallel for
#pragma omp parallel for
...
@@ -248,6 +255,8 @@ void SWE_WavePropagationBlock::updateUnknowns(float dt) {
...
@@ -248,6 +255,8 @@ void SWE_WavePropagationBlock::updateUnknowns(float dt) {
hu
[
i
][
j
]
=
hv
[
i
][
j
]
=
0.
;
//no water, no speed!
hu
[
i
][
j
]
=
hv
[
i
][
j
]
=
0.
;
//no water, no speed!
}
}
}
}
tools
::
Logger
::
logger
.
updateCpuTime
();
}
}
/**
/**
...
...
src/examples/swe_mpi.cpp
View file @
93a4ae11
...
@@ -433,7 +433,7 @@ int main( int argc, char** argv ) {
...
@@ -433,7 +433,7 @@ int main( int argc, char** argv ) {
l_mpiRow
);
l_mpiRow
);
// reset the cpu clock
// reset the cpu clock
tools
::
Logger
::
logger
.
resetCpuClockToCurrentTime
();
//
tools::Logger::logger.resetCpuClockToCurrentTime();
// set values in ghost cells
// set values in ghost cells
l_wavePropgationBlock
.
setGhostLayer
();
l_wavePropgationBlock
.
setGhostLayer
();
...
@@ -445,7 +445,7 @@ int main( int argc, char** argv ) {
...
@@ -445,7 +445,7 @@ int main( int argc, char** argv ) {
float
l_maxTimeStepWidth
=
l_wavePropgationBlock
.
getMaxTimestep
();
float
l_maxTimeStepWidth
=
l_wavePropgationBlock
.
getMaxTimestep
();
// update the cpu time in the logger
// update the cpu time in the logger
tools
::
Logger
::
logger
.
updateCpuTime
();
//
tools::Logger::logger.updateCpuTime();
//! maximum allowed time steps of all blocks
//! maximum allowed time steps of all blocks
float
l_maxTimeStepWidthGlobal
;
float
l_maxTimeStepWidthGlobal
;
...
@@ -454,13 +454,13 @@ int main( int argc, char** argv ) {
...
@@ -454,13 +454,13 @@ int main( int argc, char** argv ) {
MPI_Allreduce
(
&
l_maxTimeStepWidth
,
&
l_maxTimeStepWidthGlobal
,
1
,
MPI_FLOAT
,
MPI_MIN
,
MPI_COMM_WORLD
);
MPI_Allreduce
(
&
l_maxTimeStepWidth
,
&
l_maxTimeStepWidthGlobal
,
1
,
MPI_FLOAT
,
MPI_MIN
,
MPI_COMM_WORLD
);
// reset the cpu time
// reset the cpu time
tools
::
Logger
::
logger
.
resetCpuClockToCurrentTime
();
//
tools::Logger::logger.resetCpuClockToCurrentTime();
// update the cell values
// update the cell values
l_wavePropgationBlock
.
updateUnknowns
(
l_maxTimeStepWidthGlobal
);
l_wavePropgationBlock
.
updateUnknowns
(
l_maxTimeStepWidthGlobal
);
// update the cpu and CPU-communication time in the logger
// update the cpu and CPU-communication time in the logger
tools
::
Logger
::
logger
.
updateCpuTime
();
//
tools::Logger::logger.updateCpuTime();
tools
::
Logger
::
logger
.
updateCpuCommunicationTime
();
tools
::
Logger
::
logger
.
updateCpuCommunicationTime
();
// update simulation time with time step width.
// update simulation time with time step width.
...
...
src/examples/swe_wavepropagation.cpp
View file @
93a4ae11
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
* Main program for the simulation on a single SWE_WavePropagationBlock.
* Main program for the simulation on a single SWE_WavePropagationBlock.
*/
*/
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
/**
/**
* Initialization.
* Initialization.
*/
*/
...
@@ -231,7 +232,7 @@ int main( int argc, char** argv ) {
...
@@ -231,7 +232,7 @@ int main( int argc, char** argv ) {
l_wavePropgationBlock
.
setGhostLayer
();
l_wavePropgationBlock
.
setGhostLayer
();
// reset the cpu clock
// reset the cpu clock
tools
::
Logger
::
logger
.
resetCpuClockToCurrentTime
();
//
tools::Logger::logger.resetCpuClockToCurrentTime();
// approximate the maximum time step
// approximate the maximum time step
// TODO: This calculation should be replaced by the usage of the wave speeds occuring during the flux computation
// TODO: This calculation should be replaced by the usage of the wave speeds occuring during the flux computation
...
@@ -248,7 +249,7 @@ int main( int argc, char** argv ) {
...
@@ -248,7 +249,7 @@ int main( int argc, char** argv ) {
l_wavePropgationBlock
.
updateUnknowns
(
l_maxTimeStepWidth
);
l_wavePropgationBlock
.
updateUnknowns
(
l_maxTimeStepWidth
);
// update the cpu time in the logger
// update the cpu time in the logger
tools
::
Logger
::
logger
.
updateCpuTime
();
//
tools::Logger::logger.updateCpuTime();
// update simulation time with time step width.
// update simulation time with time step width.
l_t
+=
l_maxTimeStepWidth
;
l_t
+=
l_maxTimeStepWidth
;
...
...
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