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 CO2MassInGasPhaseEffectiveTrapped = 30,
75 CO2MassInGasPhaseEffectiveUnTrapped = 31,
76 CO2MassInGasPhaseMaximumTrapped = 32,
77 CO2MassInGasPhaseMaximumUnTrapped = 33,
78 MicrobialMass = 34,
79 OxygenMass = 35,
80 UreaMass = 36,
81 BiofilmMass = 37,
82 CalciteMass = 38,
83 };
84
88
90 static std::string EclString(const Phase phase);
91
104 void add(const std::string& region,
105 Phase phase,
106 std::size_t region_number,
107 double value);
108
114 void add(Phase phase, double value);
115
131 double get(const std::string& region,
132 Phase phase,
133 std::size_t region_number) const;
134
143 double get(Phase phase) const;
144
157 bool has(const std::string& region,
158 Phase phase,
159 std::size_t region_number) const;
160
167 bool has(Phase phase) const;
168
171 std::size_t max_region() const;
172
181 std::size_t max_region(const std::string& region_name) const;
182
194 std::vector<double>
195 get_vector(const std::string& region, Phase phase) const;
196
199 static const std::vector<Phase>& phases();
200
203 static const std::vector<Phase>& mixingPhases();
204
210 template<class Serializer>
211 void serializeOp(Serializer& serializer)
212 {
213 serializer(phase_values);
214 }
215
222 bool operator==(const Inplace& rhs) const;
223
224private:
225 using ValueMap = std::unordered_map<std::size_t, double>;
226 using PhaseMap = std::unordered_map<Phase, ValueMap>;
227 using RegionMap = std::unordered_map<std::string, PhaseMap>;
228
231 RegionMap phase_values{};
232};
233
234} // namespace Opm
235
236#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:264
static const std::vector< Phase > & phases()
Get iterable list of all quantities which can be handled/updated in a generic way.
Definition Inplace.cpp:253
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:226
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:179
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:144
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:131
std::size_t max_region() const
Retrieve the maximum region ID registered across all quantities in all registered region sets.
Definition Inplace.cpp:202
bool operator==(const Inplace &rhs) const
Equality predicate.
Definition Inplace.cpp:304
static std::string EclString(const Phase phase)
Converts phase enum to ECL textual representation.
Definition Inplace.cpp:77
void serializeOp(Serializer &serializer)
Serialisation interface.
Definition Inplace.hpp:211
Class for (de-)serializing.
Definition Serializer.hpp:94
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30