opm-simulators
DamarisKeywords.hpp
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 
24 
26 #include <opm/simulators/utils/ParallelCommunication.hpp>
27 
28 #include <map>
29 #include <string>
30 #include <tuple>
31 #include <unordered_set>
32 
33 /*
34  Below is the std::map with the keywords that are supported by Damaris.
35 
36  Most entries in the map below are not critical ('static') and will not
37  be changed. We only allow changing FileMode together with output directory
38 */
39 
40 namespace Opm::DamarisOutput {
41 
49 bool FileExists(const std::string& filename_in,
50  const Parallel::Communication& comm);
51 
53 {
54  bool enableDamarisOutputCollective_ = true;
55  bool saveToDamarisHDF5_ = true;
56  // if saveMeshToDamarisHDF5 is true, requires enableDamarisOutputCollective to be false
57  // (until offsets are are added to mesh data for collective writing)
58  bool saveMeshToHDF5_ = false;
59  std::string pythonFilename_;
60  std::string paraviewPythonFilename_;
61 
62  std::string damarisSimName_; // empty and set to "opm-flow-<random-number>" if none provided on command line. Used as prefix to HDF5 filenames
63  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.
64  std::string damarisLogLevel_ = "info";
65  std::string damarisDaskFile_ = "";
66  // std::string damarisLimitVars_ = "";
67  int nDamarisCores_ = 1; // this is the number of (Damaris server) cores per node
68  int nDamarisNodes_ = 0;
69  long shmemSizeBytes_ = 536870912; // 512 MB
70 
71  std::string rand_value_str_ ; // to be added to sheared memory name to make unique
72 
73  std::map<std::string, std::string>
74  getKeywords(const Parallel::Communication& comm,
75  const std::string& OutputDir);
76 
77 private:
78  void SetRandString(); // sets the value of rand_value_str_
79 
80  struct StartEnd
81  {
82  std::string start;
83  std::string end;
84  };
85 
86  std::tuple<StartEnd, StartEnd, std::string>
87  checkFiles(const Parallel::Communication& comm);
88 };
89 
100 std::map<std::string, std::string>
101 getDamarisKeywords(const Parallel::Communication& comm, const std::string& OutputDir);
102 
103 std::unordered_set<std::string> getSetOfIncludedVariables();
104 
105 } // namespace Opm::DamarisOutput
106 
107 
108 #endif
Below are the Damaris Keywords supported by Damaris to be filled in the built-in XML file...
Definition: DamarisWriter.cpp:39
Definition: DamarisKeywords.hpp:52
This file provides the infrastructure to retrieve run-time parameters.
Collects necessary output values and pass them to Damaris server processes.
std::map< std::string, std::string > getDamarisKeywords(const Parallel::Communication &comm, const std::string &OutputDir)
Creates the map of search strings and repacement strings that will be used to modify a templated Dama...
Definition: DamarisKeywords.cpp:236
bool FileExists(const std::string &filename_in, const Parallel::Communication &comm)
Returns true if the file exists.
Definition: DamarisKeywords.cpp:54