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 <cstddef>
24#include <string>
25#include <unordered_map>
26#include <vector>
27
28namespace Opm {
29
30// The purpose of this class is to transport in-place values from the
31// simulator code to the summary output code. The code is written very much
32// to fit in with the current implementation in the simulator. Functions
33// which do not take both region set name and region ID arguments are
34// intended for field-level values.
36{
37public:
38 // The Inplace class is implemented in close connection to the black-oil
39 // output module in opm-simulators. There are certain idiosyncracies
40 // here which are due to that coupling. For instance the enumerators
41 // PressurePV, HydroCarbonPV, PressureHydroCarbonPV, and
42 // DynamicPoreVolume are not included in the return value from phases().
43 enum class Phase {
44 WATER = 0, // Omitted from mixingPhases()
45 OIL = 1, // Omitted from mixingPhases()
46 GAS = 2, // Omitted from mixingPhases()
47 OilInLiquidPhase = 3,
48 OilInGasPhase = 4,
49 GasInLiquidPhase = 5,
50 GasInGasPhase = 6,
51 PoreVolume = 7,
52 PressurePV = 8, // Omitted from both phases() and mixingPhases()
53 HydroCarbonPV = 9, // Omitted from both phases() and mixingPhases()
54 PressureHydroCarbonPV = 10, // Omitted from both phases() and mixingPhases()
55 DynamicPoreVolume = 11, // Omitted from both phases() and mixingPhases()
56 WaterResVolume = 12,
57 OilResVolume = 13,
58 GasResVolume = 14,
59 SALT = 15,
60 CO2InWaterPhase = 16,
61 CO2InGasPhaseInMob = 17,
62 CO2InGasPhaseMob = 18,
63 CO2InGasPhaseInMobKrg = 19,
64 CO2InGasPhaseMobKrg = 20,
65 WaterInGasPhase = 21,
66 WaterInWaterPhase = 22,
67 CO2Mass = 23,
68 CO2MassInWaterPhase = 24,
69 CO2MassInGasPhase = 25,
70 CO2MassInGasPhaseInMob = 26,
71 CO2MassInGasPhaseMob = 27,
72 CO2MassInGasPhaseInMobKrg = 28,
73 CO2MassInGasPhaseMobKrg = 29,
74 };
75
79
92 void add(const std::string& region,
93 Phase phase,
94 std::size_t region_number,
95 double value);
96
102 void add(Phase phase, double value);
103
119 double get(const std::string& region,
120 Phase phase,
121 std::size_t region_number) const;
122
131 double get(Phase phase) const;
132
145 bool has(const std::string& region,
146 Phase phase,
147 std::size_t region_number) const;
148
155 bool has(Phase phase) const;
156
159 std::size_t max_region() const;
160
169 std::size_t max_region(const std::string& region_name) const;
170
182 std::vector<double>
183 get_vector(const std::string& region, Phase phase) const;
184
187 static const std::vector<Phase>& phases();
188
191 static const std::vector<Phase>& mixingPhases();
192
198 template<class Serializer>
199 void serializeOp(Serializer& serializer)
200 {
201 serializer(phase_values);
202 }
203
210 bool operator==(const Inplace& rhs) const;
211
212private:
213 using ValueMap = std::unordered_map<std::size_t, double>;
214 using PhaseMap = std::unordered_map<Phase, ValueMap>;
215 using RegionMap = std::unordered_map<std::string, PhaseMap>;
216
219 RegionMap phase_values{};
220};
221
222} // namespace Opm
223
224#endif // ORIGINAL_OIP
Definition Inplace.hpp:36
static Inplace serializationTestObject()
Create non-defaulted object suitable for testing the serialisation operation.
Definition Inplace.cpp:69
static const std::vector< Phase > & mixingPhases()
Get iterable list of all quantities, other than "pure" phases, which can be handled/updated in a gene...
Definition Inplace.cpp:210
static const std::vector< Phase > & phases()
Get iterable list of all quantities which can be handled/updated in a generic way.
Definition Inplace.cpp:199
std::vector< double > get_vector(const std::string &region, Phase phase) const
Linearised per-region values for a given phase in a specific region set.
Definition Inplace.cpp:172
bool has(const std::string &region, Phase phase, std::size_t region_number) const
Check existence of particular quantity in specific region of named region set.
Definition Inplace.cpp:125
double get(const std::string &region, Phase phase, std::size_t region_number) const
Retrieve numerical value of particular quantity in specific region of named region set.
Definition Inplace.cpp:90
void add(const std::string &region, Phase phase, std::size_t region_number, double value)
Assign value of particular quantity in specific region of named region set.
Definition Inplace.cpp:77
std::size_t max_region() const
Retrieve the maximum region ID registered across all quantities in all registered region sets.
Definition Inplace.cpp:148
bool operator==(const Inplace &rhs) const
Equality predicate.
Definition Inplace.cpp:241
void serializeOp(Serializer &serializer)
Serialisation interface.
Definition Inplace.hpp:199
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