Quick implementation for dynamic displacements

parent a9769f3f
......@@ -94,6 +94,8 @@ vars.AddVariables(
allowed_values=('rusanov', 'fwave', 'augrie', 'hybrid', 'fwavevec')
),
BoolVariable( 'dynamicDispl', 'support dynamic displacement files with ASAGI', False ),
BoolVariable( 'vectorize', 'add pragmas to help vectorization (release only)', True ),
BoolVariable( 'showVectorization', 'show loop vectorization (Intel compiler only)', False ),
......@@ -218,6 +220,10 @@ elif env['solver'] == 'hybrid':
env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=0'])
elif env['solver'] == 'fwavevec':
env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=4'])
# Dynamic displacement?
if env['dynamicDispl']:
env.Append(CPPDEFINES=['DYNAMIC_DISPLACEMENTS'])
# set the precompiler flags for CUDA
if env['parallelization'] in ['cuda', 'mpi_with_cuda']:
......
......@@ -256,7 +256,7 @@ void SWE_WavePropagationBlock::updateUnknowns(float dt) {
* @param i_asagiScenario the corresponding ASAGI-scenario
*/
#ifdef DYNAMIC_DISPLACEMENTS
bool SWE_WavePropagationBlock::updateBathymetryWithDynamicDisplacement(scenarios::Asagi &i_asagiScenario, const float i_time) {
bool SWE_WavePropagationBlock::updateBathymetryWithDynamicDisplacement(SWE_AsagiScenario &i_asagiScenario, const float i_time) {
if (!i_asagiScenario.dynamicDisplacementAvailable(i_time))
return false;
......
......@@ -33,7 +33,7 @@
#include "tools/help.hh"
#include "SWE_Block.hh"
#ifdef DYNAMIC_DISPLACEMENTS
#include "scenarios/Asagi.hpp"
#include "scenarios/SWE_AsagiScenario.hpp"
#endif
//which wave propagation solver should be used
......@@ -136,7 +136,7 @@ class SWE_WavePropagationBlock: public SWE_Block {
//updates the bathymetry with the current displacment values
#ifdef DYNAMIC_DISPLACEMENTS
bool updateBathymetryWithDynamicDisplacement(scenarios::Asagi &i_asagiScenario, float time);
bool updateBathymetryWithDynamicDisplacement(SWE_AsagiScenario &i_asagiScenario, float time);
#endif
//get hybrid statistics
......
......@@ -206,8 +206,8 @@ int main( int argc, char** argv ) {
simulationArea[3] = 1450000;
SWE_AsagiScenario l_scenario( ASAGI_INPUT_DIR "tohoku_gebco_ucsb3_500m_hawaii_bath.nc",
ASAGI_INPUT_DIR "tohoku_gebco_ucsb3_500m_hawaii_displ.nc",
(float) 14400., simulationArea);
ASAGI_INPUT_DIR "tohoku_percy_500m_displ.nc",
(float) 14400., simulationArea, true);
#else
// create a simple artificial scenario
SWE_BathymetryDamBreakScenario l_scenario;
......@@ -415,6 +415,8 @@ int main( int argc, char** argv ) {
unsigned int l_iterations = 0;
bool displAvail = true;
// loop over checkpoints
for(int c=1; c<=l_numberOfCheckPoints; c++) {
......@@ -453,6 +455,10 @@ int main( int argc, char** argv ) {
// determine smallest time step of all blocks
MPI_Allreduce(&l_maxTimeStepWidth, &l_maxTimeStepWidthGlobal, 1, MPI_FLOAT, MPI_MIN, MPI_COMM_WORLD);
if (displAvail)
// Minimum available time step in dynamic displacements = 1.65
l_maxTimeStepWidthGlobal = std::min(l_maxTimeStepWidthGlobal, 1.65f);
// reset the cpu time
tools::Logger::logger.resetCpuClockToCurrentTime();
......@@ -467,6 +473,9 @@ int main( int argc, char** argv ) {
l_t += l_maxTimeStepWidthGlobal;
l_iterations++;
// Update displacement
displAvail = l_wavePropgationBlock.updateBathymetryWithDynamicDisplacement(l_scenario, l_t);
// print the current simulation time
progressBar.clear();
tools::Logger::logger.printSimulationTime(l_t);
......
......@@ -47,7 +47,7 @@ private:
public:
SWE_AsagiGrid()
{
_grid = asagi::Grid::create();
_grid = asagi::Grid::create(asagi::Grid::FLOAT);
_refCount = 0;
}
......@@ -240,6 +240,9 @@ class SWE_AsagiScenario: public SWE_Scenario {
//assert(dynamicDisplacement == false);
// no assertation for compability
if (dynamicDisplacement)
return 0;
return getBathymetryAndDynamicDisplacement(i_positionX, i_positionY, 0);
}
......
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