My Project
Loading...
Searching...
No Matches
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 <opm/input/eclipse/Units/UnitSystem.hpp>
24
25#include <utility>
26#include <vector>
27
28namespace Opm { namespace data {
29
30 // The 3D data which are saved to file are assembled in one large
31 // container. In the container the data is tagged with an element from
32 // the TargetType enum which specifies the vector's intended output
33 // destination.
34 //
35 //RESTART_SOLUTION: Cell-based quantities that are output to the
36 // SOLUTION section of the restart file. ECLIPSE-compatible names.
37 //
38 //RESTART_AUXILIARY: Fields with extra information, not required
39 // for restart. Examples of this include fluid in place values or
40 // evaluations of relative permeability. Will end up in the
41 // restart file. Deprecated and will be removed.
42 //
43 //SUMMARY: Fields which are added only to serve as input data for
44 // calculations of summary results. The Summary implementation can
45 // use data with any tag value, but if it is tagged as SUMMARY it
46 // will not be output anywhere else.
47 //
48 //INIT: Fields which should go to the INIT file.
49 //
50 //RESTART_OPM_EXTENDED: Cell-based quantities that are specific to
51 // OPM-Flow. Output only to extended OPM restart files. Specifically
52 // not output to ECLIPSE-compatible restart files.
53
54 enum class TargetType
55 {
56 RESTART_SOLUTION,
57 RESTART_AUXILIARY,
58 RESTART_TRACER_SOLUTION,
59 SUMMARY,
60 INIT,
61 RESTART_OPM_EXTENDED,
62 };
63
66 struct CellData
67 {
69 UnitSystem::measure dim{UnitSystem::measure::identity};
70
72 std::vector<double> data{};
73
75 TargetType target{TargetType::RESTART_SOLUTION};
76
77 CellData() = default;
78 explicit CellData(UnitSystem::measure m,
79 std::vector<double> x,
80 TargetType dest)
81 : dim { m }
82 , data { std::move(x) }
83 , target { dest }
84 {}
85
86 bool operator==(const CellData& cell2) const
87 {
88 return (dim == cell2.dim)
89 && (target == cell2.target)
90 && (data == cell2.data);
91 }
92
93 template <class Serializer>
94 void serializeOp(Serializer& serializer)
95 {
96 serializer(this->dim);
97 serializer(this->data);
98 serializer(this->target);
99 }
100
101 static CellData serializationTestObject()
102 {
103 return CellData {
104 UnitSystem::measure::runtime,
105 {1.0, 2.0, 3.0},
106 TargetType::RESTART_OPM_EXTENDED
107 };
108 }
109 };
110
111}} // namespace Opm::data
112
113#endif //OPM_OUTPUT_CELLS_HPP
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Small struct that keeps track of data for output to restart/summary files.
Definition Cells.hpp:67
UnitSystem::measure dim
Dimension of the data to write.
Definition Cells.hpp:69
std::vector< double > data
Per-cell solution values.
Definition Cells.hpp:72
TargetType target
File output destination.
Definition Cells.hpp:75