Loading...
Searching...
No Matches
Inplace.hpp
/*
Copyright 2020 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ORIGINAL_OIP
#define ORIGINAL_OIP
#include <cstddef>
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm {
// The purpose of this class is to transport in-place values from the
// simulator code to the summary output code. The code is written very much
// to fit in with the current implementation in the simulator. Functions
// which do not take both region set name and region ID arguments are
// intended for field-level values.
class Inplace
{
public:
// The Inplace class is implemented in close connection to the black-oil
// output module in opm-simulators. There are certain idiosyncracies
// here which are due to that coupling. For instance the enumerators
// PressurePV, HydroCarbonPV, PressureHydroCarbonPV, and
// DynamicPoreVolume are not included in the return value from phases().
enum class Phase {
WATER = 0, // Omitted from mixingPhases()
OIL = 1, // Omitted from mixingPhases()
GAS = 2, // Omitted from mixingPhases()
OilInLiquidPhase = 3,
OilInGasPhase = 4,
GasInLiquidPhase = 5,
GasInGasPhase = 6,
PoreVolume = 7,
PressurePV = 8, // Omitted from both phases() and mixingPhases()
HydroCarbonPV = 9, // Omitted from both phases() and mixingPhases()
PressureHydroCarbonPV = 10, // Omitted from both phases() and mixingPhases()
DynamicPoreVolume = 11, // Omitted from both phases() and mixingPhases()
WaterResVolume = 12,
OilResVolume = 13,
GasResVolume = 14,
SALT = 15,
CO2InWaterPhase = 16,
CO2InGasPhaseInMob = 17,
CO2InGasPhaseMob = 18,
CO2InGasPhaseInMobKrg = 19,
CO2InGasPhaseMobKrg = 20,
WaterInGasPhase = 21,
WaterInWaterPhase = 22,
CO2Mass = 23,
CO2MassInWaterPhase = 24,
CO2MassInGasPhase = 25,
CO2MassInGasPhaseInMob = 26,
CO2MassInGasPhaseMob = 27,
CO2MassInGasPhaseInMobKrg = 28,
CO2MassInGasPhaseMobKrg = 29,
CO2MassInGasPhaseEffectiveTrapped = 30,
CO2MassInGasPhaseEffectiveUnTrapped = 31,
CO2MassInGasPhaseMaximumTrapped = 32,
CO2MassInGasPhaseMaximumUnTrapped = 33,
MicrobialMass = 34,
OxygenMass = 35,
UreaMass = 36,
BiofilmMass = 37,
CalciteMass = 38,
WaterMass = 39,
};
static Inplace serializationTestObject();
static std::string EclString(const Phase phase);
void add(const std::string& region,
Phase phase,
std::size_t region_number,
double value);
void add(Phase phase, double value);
double get(const std::string& region,
Phase phase,
std::size_t region_number) const;
double get(Phase phase) const;
bool has(const std::string& region,
Phase phase,
std::size_t region_number) const;
bool has(Phase phase) const;
std::size_t max_region() const;
std::size_t max_region(const std::string& region_name) const;
std::vector<double>
get_vector(const std::string& region, Phase phase) const;
static const std::vector<Phase>& phases();
static const std::vector<Phase>& mixingPhases();
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(phase_values);
}
bool operator==(const Inplace& rhs) const;
private:
using ValueMap = std::unordered_map<std::size_t, double>;
using PhaseMap = std::unordered_map<Phase, ValueMap>;
using RegionMap = std::unordered_map<std::string, PhaseMap>;
RegionMap phase_values{};
};
} // namespace Opm
#endif // ORIGINAL_OIP
Opm::Inplace
Definition Inplace.hpp:36
Opm::Inplace::serializationTestObject
static Inplace serializationTestObject()
Create non-defaulted object suitable for testing the serialisation operation.
Definition Inplace.cpp:69
Opm::Inplace::mixingPhases
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:265
Opm::Inplace::phases
static const std::vector< Phase > & phases()
Get iterable list of all quantities which can be handled/updated in a generic way.
Definition Inplace.cpp:254
Opm::Inplace::get_vector
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:227
Opm::Inplace::has
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:180
Opm::Inplace::get
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:145
Opm::Inplace::add
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:132
Opm::Inplace::max_region
std::size_t max_region() const
Retrieve the maximum region ID registered across all quantities in all registered region sets.
Definition Inplace.cpp:203
Opm::Inplace::operator==
bool operator==(const Inplace &rhs) const
Equality predicate.
Definition Inplace.cpp:306
Opm::Inplace::EclString
static std::string EclString(const Phase phase)
Converts phase enum to ECL textual representation.
Definition Inplace.cpp:77
Opm::Inplace::serializeOp
void serializeOp(Serializer &serializer)
Serialisation interface.
Definition Inplace.hpp:212
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30