FIPContainer.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
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 2 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 Consult the COPYING file in the top-level source directory of this
19 module for the precise wording of the license and the list of
20 copyright holders.
21*/
26#ifndef OPM_FIP_CONTAINER_HPP
27#define OPM_FIP_CONTAINER_HPP
28
29#include <opm/output/eclipse/Inplace.hpp>
30
31#include <array>
32#include <cstddef>
33#include <map>
34#include <unordered_map>
35#include <string>
36#include <vector>
37
38namespace Opm::data {
39class Solution;
40}
41
42namespace Opm {
43
44class SummaryConfig;
45
46template<class FluidSystem>
48public:
49 using Scalar = typename FluidSystem::Scalar;
50 using FIPMap = std::unordered_map<Inplace::Phase, std::vector<Scalar>>;
51
52 static constexpr auto numPhases = FluidSystem::numPhases;
53 static constexpr auto gasPhaseIdx = FluidSystem::gasPhaseIdx;
54 static constexpr auto oilPhaseIdx = FluidSystem::oilPhaseIdx;
55 static constexpr auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
56
57 bool allocate(const std::size_t bufferSize,
58 const SummaryConfig& summaryConfig,
59 const bool forceAlloc,
60 std::map<std::string, int>& rstKeywords);
61
62 void add(const Inplace::Phase phase);
63
65 {
66 double pv;
74 };
75
76 const std::vector<Scalar>& get(const Inplace::Phase phase) const;
77
78 bool has(const Inplace::Phase phase) const;
79
80 bool hasCo2InGas() const;
81 void assignCo2InGas(const unsigned globalDofIdx,
82 const Co2InGasInput& v);
83
84 bool hasCo2InWater() const;
85 void assignCo2InWater(const unsigned globalDofIdx,
86 const Scalar co2InWater,
87 const Scalar mM);
88
89 bool hasMicrobialMass() const;
90 void assignMicrobialMass(const unsigned globalDofIdx,
91 const Scalar microbialMass);
92
93 bool hasOxygenMass() const;
94 void assignOxygenMass(const unsigned globalDofIdx,
95 const Scalar oxygenMass);
96
97 bool hasUreaMass() const;
98 void assignUreaMass(const unsigned globalDofIdx,
99 const Scalar ureaMass);
100
101 bool hasBiofilmMass() const;
102 void assignBiofilmMass(const unsigned globalDofIdx,
103 const Scalar biofilmMass);
104
105 bool hasCalciteMass() const;
106 void assignCalciteMass(const unsigned globalDofIdx,
107 const Scalar calciteMass);
108
109 bool hasWaterMass() const;
110 void assignWaterMass(const unsigned globalDofIdx,
111 const std::array<Scalar, numPhases>& fip,
112 const Scalar rhoW);
113
114 void assignGasWater(const unsigned globalDofIdx,
115 const std::array<Scalar, numPhases>& fip,
116 const Scalar gasInPlaceWater,
117 const Scalar waterInPlaceGas);
118
119 void assignOilGasDistribution(const unsigned globalDofIdx,
120 const Scalar gasInPlaceLiquid,
121 const Scalar oilInPlaceGas);
122
123 void assignPoreVolume(const unsigned globalDofIdx,
124 const Scalar value);
125
126 void assignVolumesSurface(const unsigned globalDofIdx,
127 const std::array<Scalar, numPhases>& fip);
128
129 void assignVolumesReservoir(const unsigned globalDofIdx,
130 const Scalar saltConcentration,
131 const std::array<Scalar, numPhases>& fipr);
132
133 void outputRestart(data::Solution& sol);
134
135private:
136 FIPMap fip_{};
137 std::size_t bufferSize_ = 0;
138
139 struct OutputRestart
140 {
143 bool noPrefix {false};
144
147 bool surface {false};
148
151 bool reservoir {false};
152
153 void clearBits()
154 {
155 this->noPrefix = this->surface = this->reservoir = false;
156 }
157
158 explicit operator bool() const
159 {
160 return this->noPrefix || this->surface || this->reservoir;
161 }
162 } outputRestart_{};
163};
164
165} // namespace Opm
166
167#endif // OPM_FIP_CONTAINER_HPP
Definition: FIPContainer.hpp:47
void assignMicrobialMass(const unsigned globalDofIdx, const Scalar microbialMass)
void assignCalciteMass(const unsigned globalDofIdx, const Scalar calciteMass)
typename FluidSystem::Scalar Scalar
Definition: FIPContainer.hpp:49
static constexpr auto oilPhaseIdx
Definition: FIPContainer.hpp:54
bool hasCo2InGas() const
void assignCo2InWater(const unsigned globalDofIdx, const Scalar co2InWater, const Scalar mM)
void assignVolumesSurface(const unsigned globalDofIdx, const std::array< Scalar, numPhases > &fip)
static constexpr auto gasPhaseIdx
Definition: FIPContainer.hpp:53
bool has(const Inplace::Phase phase) const
bool hasMicrobialMass() const
void outputRestart(data::Solution &sol)
void assignWaterMass(const unsigned globalDofIdx, const std::array< Scalar, numPhases > &fip, const Scalar rhoW)
void assignCo2InGas(const unsigned globalDofIdx, const Co2InGasInput &v)
bool hasOxygenMass() const
void assignVolumesReservoir(const unsigned globalDofIdx, const Scalar saltConcentration, const std::array< Scalar, numPhases > &fipr)
void assignPoreVolume(const unsigned globalDofIdx, const Scalar value)
static constexpr auto waterPhaseIdx
Definition: FIPContainer.hpp:55
void assignOxygenMass(const unsigned globalDofIdx, const Scalar oxygenMass)
bool hasUreaMass() const
void assignOilGasDistribution(const unsigned globalDofIdx, const Scalar gasInPlaceLiquid, const Scalar oilInPlaceGas)
void assignBiofilmMass(const unsigned globalDofIdx, const Scalar biofilmMass)
std::unordered_map< Inplace::Phase, std::vector< Scalar > > FIPMap
Definition: FIPContainer.hpp:50
bool hasWaterMass() const
bool hasCo2InWater() const
bool allocate(const std::size_t bufferSize, const SummaryConfig &summaryConfig, const bool forceAlloc, std::map< std::string, int > &rstKeywords)
static constexpr auto numPhases
Definition: FIPContainer.hpp:52
void add(const Inplace::Phase phase)
void assignUreaMass(const unsigned globalDofIdx, const Scalar ureaMass)
bool hasCalciteMass() const
bool hasBiofilmMass() const
const std::vector< Scalar > & get(const Inplace::Phase phase) const
void assignGasWater(const unsigned globalDofIdx, const std::array< Scalar, numPhases > &fip, const Scalar gasInPlaceWater, const Scalar waterInPlaceGas)
Definition: CompositionalContainer.hpp:37
Definition: blackoilboundaryratevector.hh:39
Definition: FIPContainer.hpp:65
Scalar strandedGas
Definition: FIPContainer.hpp:73
double pv
Definition: FIPContainer.hpp:66
Scalar mM
Definition: FIPContainer.hpp:71
Scalar rhog
Definition: FIPContainer.hpp:69
Scalar sg
Definition: FIPContainer.hpp:67
Scalar sgcr
Definition: FIPContainer.hpp:68
Scalar trappedGas
Definition: FIPContainer.hpp:72
Scalar xgW
Definition: FIPContainer.hpp:70