Geometric mesh data added for in-situ visualisation

added access to DUNE mesh geometry and passing through data to Damaris;
Updated command line so users can specifiy Python or Paraview script names and other paramaters that control Damaris
- Simulation name
- Number of dedicated cores or dedicated nodes
- Shared memory region size
- switch to turn off HDF5 output.
- Damaris logging level
This commit is contained in:
josh bowden
2023-09-22 23:23:29 +02:00
parent 18f0d8fd27
commit 8095eb0c48
13 changed files with 1522 additions and 132 deletions

View File

@@ -233,20 +233,19 @@ void Main::setupVanguard()
}
#if HAVE_DAMARIS
void Main::setupDamaris(const std::string& outputDir,
const bool enableDamarisOutputCollective)
void Main::setupDamaris(const std::string& outputDir , std::map<std::string, std::string>& find_replace_map)
{
if (!outputDir.empty()) {
ensureOutputDirExists(outputDir);
}
// By default EnableDamarisOutputCollective is true so all simulation results will
// be written into one single file for each iteration using Parallel HDF5.
// It set to false, FilePerCore mode is used in Damaris, then simulation results in each
// node are aggregated by dedicated Damaris cores and stored to separate files per Damaris core.
// Irrespective of mode, output is written asynchronously at the end of each timestep.
// Using the ModifyModel class to set the XML file for Damaris.
DamarisOutput::initializeDamaris(EclGenericVanguard::comm(), EclGenericVanguard::comm().rank(), outputDir, enableDamarisOutputCollective);
DamarisOutput::initializeDamaris(EclGenericVanguard::comm(), EclGenericVanguard::comm().rank(), find_replace_map);
int is_client;
MPI_Comm new_comm;
int err = damaris_start(&is_client);

View File

@@ -72,6 +72,10 @@
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#endif
#if HAVE_DAMARIS
#include <opm/simulators/utils/DamarisKeywords.hpp>
#endif
#include <cassert>
#include <cstdlib>
#include <iostream>
@@ -323,9 +327,14 @@ private:
deckFilename = EWOMS_GET_PARAM(PreTypeTag, std::string, EclDeckFileName);
outputDir = EWOMS_GET_PARAM(PreTypeTag, std::string, OutputDir);
}
if (outputDir.empty()) {
outputDir = ".";
}
#if HAVE_DAMARIS
enableDamarisOutput_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableDamarisOutput);
// Reset to false as we cannot use Damaris if there is only one rank.
if ((enableDamarisOutput_ == true) && (EclGenericVanguard::comm().size() == 1)) {
std::string msg ;
@@ -335,8 +344,32 @@ private:
}
if (enableDamarisOutput_) {
this->setupDamaris(outputDir,
EWOMS_GET_PARAM(PreTypeTag, bool, EnableDamarisOutputCollective));
enableDamarisOutputCollective_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableDamarisOutputCollective) ;
saveToDamarisHDF5_ = EWOMS_GET_PARAM(PreTypeTag, bool, DamarisSaveToHdf);
damarisPythonFilename_ = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisPythonScript);
damarisPythonParaviewFilename_ = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisPythonParaviewScript);
damarisSimName_ = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisSimName);
nDamarisCores_ = EWOMS_GET_PARAM(PreTypeTag, int, DamarisDedicatedCores);
nDamarisNodes_ = EWOMS_GET_PARAM(PreTypeTag, int, DamarisDedicatedNodes);
shmemSizeBytes_ = EWOMS_GET_PARAM(PreTypeTag, long, DamarisSharedMemeorySizeBytes);
damarisLogLevel_ = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisLogLevel);
std::map<std::string, std::string> find_replace_map ;
find_replace_map = Opm::DamarisOutput::DamarisKeywords(EclGenericVanguard::comm(),
outputDir,
enableDamarisOutputCollective_,
saveToDamarisHDF5_,
nDamarisCores_,
nDamarisNodes_,
shmemSizeBytes_,
damarisPythonFilename_,
damarisSimName_,
damarisLogLevel_,
damarisPythonParaviewFilename_
);
this->setupDamaris(outputDir, find_replace_map);
}
#endif // HAVE_DAMARIS
@@ -704,8 +737,8 @@ private:
}
#if HAVE_DAMARIS
void setupDamaris(const std::string& outputDir,
const bool enableDamarisOutputCollective);
void setupDamaris(const std::string& outputDir,
std::map<std::string, std::string>& find_replace_map);
#endif
int argc_{0};
@@ -730,6 +763,16 @@ private:
bool isSimulationRank_ = true;
#if HAVE_DAMARIS
bool enableDamarisOutput_ = false;
bool enableDamarisOutputCollective_ = true ;
bool saveToDamarisHDF5_ = true ;
std::string damarisPythonFilename_ = "" ;
std::string damarisPythonParaviewFilename_ = "" ;
std::string damarisSimName_ = "" ; // empty defaults to opm-sim-<magic_number>
std::string damarisLogLevel_ = "info" ;
int nDamarisCores_ = 1 ;
int nDamarisNodes_ = 0 ;
long shmemSizeBytes_ = 536870912 ;
#endif
};