My Project
Loading...
Searching...
No Matches
Inplace.hpp
1/*
2 Copyright 2020 Equinor 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 ORIGINAL_OIP
21#define ORIGINAL_OIP
22
23#include <string>
24#include <unordered_map>
25#include <vector>
26
27namespace Opm {
28
29
30class Inplace {
31public:
32
33 enum class Phase {
34 WATER = 0,
35 OIL = 1,
36 GAS = 2,
37 OilInLiquidPhase = 3,
38 OilInGasPhase = 4,
39 GasInLiquidPhase = 5,
40 GasInGasPhase = 6,
41 PoreVolume = 7,
42 // The Inplace class is implemented in close relation to the
43 // ecloutputblackoilmodule in opm-simulators, ane there are
44 // certainly idiosyncracies here due to that coupling. For instance
45 // the enum values PressurePV, HydroCarbonPV, PressureHydroCarbonPV,
46 // and DynamicPoreVolume are *not* included in the return value from
47 // phases().
48 PressurePV = 8,
49 HydroCarbonPV = 9,
50 PressureHydroCarbonPV = 10,
51 DynamicPoreVolume = 11,
52 WaterResVolume = 12,
53 OilResVolume = 13,
54 GasResVolume = 14,
55 SALT = 15,
56 CO2InWaterPhase = 16,
57 CO2InGasPhaseInMob = 17,
58 CO2InGasPhaseMob = 18,
59 WaterInGasPhase = 19,
60 WaterInWaterPhase = 20,
61 };
62
63 /*
64 The purpose of this class is to transport inplace values from the
65 simulator code to the summary output code. The code is written very much
66 to fit in with the current implementation in the simulator. The functions
67 which don't accept region_name & region_number arguments should be called
68 for totals, i.e. field properties.
69 */
70
71 static Inplace serializationTestObject();
72
73 void add(const std::string& region, Phase phase, std::size_t region_number, double value);
74 void add(Phase phase, double value);
75
76 double get(const std::string& region, Phase phase, std::size_t region_number) const;
77 double get(Phase phase) const;
78
79 bool has(const std::string& region, Phase phase, std::size_t region_number) const;
80 bool has(Phase phase) const;
81
82 std::size_t max_region() const;
83 std::size_t max_region(const std::string& region_name) const;
84
85 /*
86 The get_vector functions return a vector length max_region() which
87 contains the values added with the add() function and indexed with
88 (region_number - 1). This is an incarnation of id <-> index confusion and
89 should be replaced with a std::map instead.
90 */
91 std::vector<double> get_vector(const std::string& region, Phase phase) const;
92
93 static const std::vector<Phase>& phases();
94
95 template<class Serializer>
96 void serializeOp(Serializer& serializer)
97 {
98 serializer(phase_values);
99 }
100
101 bool operator==(const Inplace& rhs) const;
102
103private:
104 std::unordered_map<std::string, std::unordered_map<Phase, std::unordered_map<std::size_t, double>>> phase_values;
105};
106
107
108}
109
110#endif
Definition Inplace.hpp:30
Class for (de-)serializing.
Definition Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30