My Project
Cells.hpp
1 /*
2  Copyright 2016 Statoil ASA.
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_OUTPUT_CELLS_HPP
21 #define OPM_OUTPUT_CELLS_HPP
22 
23 #include <map>
24 #include <vector>
25 
26 #include <opm/input/eclipse/Units/UnitSystem.hpp>
27 
28 namespace Opm {
29 
30 namespace data {
31 
32 
33  /*
34  The 3D data which are saved to file are assembled in one large
35  container. In the container the data is tagged with an element
36  from the TargetType enum which indicates why they they have been
37  added to the container - and where they are headed.
38 
39  RESTART_SOLUTION : Cell-based quantities that are output to the
40  SOLUTION section of the restart file. ECLIPSE-compatible names.
41  Many, but not necessarily all, of these quantities are required
42  for restarting the simulator.
43 
44  RESTART_AUXILIARY : Fields with extra information, not required
45  for restart. Examples of this include fluid in place values or
46  evaluations of relative permeability. Will end up in the
47  restart file.
48 
49  SUMMARY : Fields which are added only to serve as input data for
50  calculations of summary results. The Summary implementation can
51  use data with any tag value, but if it is tagged as SUMMARY it
52  will not be output anywhere else.
53 
54  INIT : Fields which should go to the INIT file.
55 
56  RESTART_OPM_EXTENDED: Cell-based quantities that are specific to
57  OPM-Flow. Output only to extended OPM restart files. Specifically
58  not output to ECLIPSE-compatible restart files.
59  */
60 
61 
62  enum class TargetType {
63  RESTART_SOLUTION,
64  RESTART_AUXILIARY,
65  RESTART_TRACER_SOLUTION,
66  SUMMARY,
67  INIT,
68  RESTART_OPM_EXTENDED,
69  };
70 
74  struct CellData {
75  UnitSystem::measure dim; //< Dimension of the data to write
76  std::vector<double> data; //< The actual data itself
77  TargetType target;
78 
79  bool operator==(const CellData& cell2) const
80  {
81  return dim == cell2.dim &&
82  data == cell2.data &&
83  target == cell2.target;
84  }
85 
86  template<class Serializer>
87  void serializeOp(Serializer& serializer)
88  {
89  serializer(dim);
90  serializer(data);
91  serializer(target);
92  }
93 
94  static CellData serializationTestObject()
95  {
96  return CellData{UnitSystem::measure::runtime,
97  {1.0, 2.0, 3.0},
98  TargetType::RESTART_TRACER_SOLUTION};
99  }
100  };
101 
102 }
103 }
104 
105 #endif //OPM_OUTPUT_CELLS_HPP
Class for (de-)serializing.
Definition: Serializer.hpp:75
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Small struct that keeps track of data for output to restart/summary files.
Definition: Cells.hpp:74