DamarisKeywords.hpp
Go to the documentation of this file.
1/*
2 Copyright 2021 Equinor.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_DAMARISKEYWORDS_HEADER_INCLUDED
21#define OPM_DAMARISKEYWORDS_HEADER_INCLUDED
22
25
26#include <map>
27#include <string>
28
29/*
30 Below is the std::map with the keywords that are supported by Damaris.
31
32 Most entries in the map below are not critical ('static') and will not
33 be changed. We only allow changing FileMode together with output directory
34*/
35
36namespace Opm::DamarisOutput
37{
38
46bool FileExists(const std::string& filename_in,
47 const Parallel::Communication& comm);
48
51 bool saveToDamarisHDF5_ = true;
52 // if saveMeshToDamarisHDF5 is true, requires enableDamarisOutputCollective to be false
53 // (until offsets are are added to mesh data for collective writing)
54 bool saveMeshToHDF5_ = false;
55 std::string pythonFilename_;
57
58 std::string damarisSimName_; // empty and set to "opm-flow-<random-number>" if none provided on command line. Used as prefix to HDF5 filenames
59 std::string shmemName_; // empty and needs to be unique if multiple simulations are running on the same server/node. Used to name the Damaris shared memory region.
60 std::string damarisLogLevel_ = "info";
61 std::string damarisDaskFile_ = "";
62 int nDamarisCores_ = 1; // this is the number of (Damaris server) cores per node
64 long shmemSizeBytes_ = 536870912; // 512 MB
65
66 std::string rand_value_str_ ; // to be added to sheared memory name to make unique
67
68 std::map<std::string, std::string>
70 const std::string& OutputDir);
71
72 void SetRandString(void); // sets the value of rand_value_str_
73};
74
83template<class TypeTag>
84std::map<std::string, std::string>
85getDamarisKeywords(const Parallel::Communication& comm, const std::string& OutputDir)
86{
87 DamarisSettings settings;
88 // Get all of the Damaris keywords (except for --enable-damaris,
89 // which is used in simulators/flow/Main.hpp)
90 // These command line arguments are defined in opm/simulators/flow/DamarisWriter.hpp and
91 // defaults are set in opm/simulators/flow/FlowProblemProperties.hpp
92 settings.enableDamarisOutputCollective_ = Parameters::get<TypeTag, Properties::DamarisOutputHdfCollective>();
93 settings.saveMeshToHDF5_ = Parameters::get<TypeTag, Properties::DamarisSaveMeshToHdf>();
94 settings.saveToDamarisHDF5_ = Parameters::get<TypeTag, Properties::DamarisSaveToHdf>();
95 settings.pythonFilename_ = Parameters::get<TypeTag, Properties::DamarisPythonScript>();
96 settings.paraviewPythonFilename_ = Parameters::get<TypeTag, Properties::DamarisPythonParaviewScript>();
97 settings.damarisSimName_ = Parameters::get<TypeTag, Properties::DamarisSimName>();
98 settings.nDamarisCores_ = Parameters::get<TypeTag, Properties::DamarisDedicatedCores>();
99 settings.nDamarisNodes_ = Parameters::get<TypeTag, Properties::DamarisDedicatedNodes>();
100 settings.shmemSizeBytes_ = Parameters::get<TypeTag, Properties::DamarisSharedMemorySizeBytes>();
101 settings.shmemName_ = Parameters::get<TypeTag, Properties::DamarisSharedMemoryName>();
102 settings.damarisLogLevel_ = Parameters::get<TypeTag, Properties::DamarisLogLevel>();
103 settings.damarisDaskFile_ = Parameters::get<TypeTag, Properties::DamarisDaskFile>();
104 return settings.getKeywords(comm, OutputDir);
105}
106
107} // namespace Opm::DamarisOutput
108
109
110#endif
Definition: DamarisWriter.hpp:59
std::map< std::string, std::string > getDamarisKeywords(const Parallel::Communication &comm, const std::string &OutputDir)
Definition: DamarisKeywords.hpp:85
bool FileExists(const std::string &filename_in, const Parallel::Communication &comm)
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: DamarisKeywords.hpp:49
bool saveMeshToHDF5_
Definition: DamarisKeywords.hpp:54
std::string paraviewPythonFilename_
Definition: DamarisKeywords.hpp:56
std::string shmemName_
Definition: DamarisKeywords.hpp:59
long shmemSizeBytes_
Definition: DamarisKeywords.hpp:64
std::string rand_value_str_
Definition: DamarisKeywords.hpp:66
int nDamarisNodes_
Definition: DamarisKeywords.hpp:63
std::string damarisSimName_
Definition: DamarisKeywords.hpp:58
std::string damarisDaskFile_
Definition: DamarisKeywords.hpp:61
std::map< std::string, std::string > getKeywords(const Parallel::Communication &comm, const std::string &OutputDir)
std::string pythonFilename_
Definition: DamarisKeywords.hpp:55
bool enableDamarisOutputCollective_
Definition: DamarisKeywords.hpp:50
int nDamarisCores_
Definition: DamarisKeywords.hpp:62
std::string damarisLogLevel_
Definition: DamarisKeywords.hpp:60
bool saveToDamarisHDF5_
Definition: DamarisKeywords.hpp:51