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 <string>
35#include <vector>
36
37namespace Opm::data {
38class Solution;
39}
40
41namespace Opm {
42
43class SummaryConfig;
44
45template<class FluidSystem>
47public:
48 using Scalar = typename FluidSystem::Scalar;
49 using FIPArray = std::array<std::vector<Scalar>,
50 static_cast<std::size_t>(Inplace::Phase::NumberOfEnumerators)>;
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 poreVolume,
125 const Scalar dynamicPoreVolume);
126
127 void assignVolumesSurface(const unsigned globalDofIdx,
128 const std::array<Scalar, numPhases>& fip);
129
130 void assignVolumesReservoir(const unsigned globalDofIdx,
131 const Scalar saltConcentration,
132 const std::array<Scalar, numPhases>& fipr);
133
134 void outputRestart(data::Solution& sol);
135
136private:
137 std::vector<Scalar>& phaseData(const Inplace::Phase phase)
138 {
139 return fip_[static_cast<std::size_t>(phase)];
140 }
141
142 const std::vector<Scalar>& phaseData(const Inplace::Phase phase) const
143 {
144 return fip_[static_cast<std::size_t>(phase)];
145 }
146
147 FIPArray fip_{};
148 std::size_t bufferSize_ = 0;
149
150 struct OutputRestart
151 {
154 bool noPrefix {false};
155
158 bool surface {false};
159
162 bool reservoir {false};
163
164 void clearBits()
165 {
166 this->noPrefix = this->surface = this->reservoir = false;
167 }
168
169 explicit operator bool() const
170 {
171 return this->noPrefix || this->surface || this->reservoir;
172 }
173 } outputRestart_{};
174};
175
176} // namespace Opm
177
178#endif // OPM_FIP_CONTAINER_HPP
Definition: FIPContainer.hpp:46
void assignMicrobialMass(const unsigned globalDofIdx, const Scalar microbialMass)
void assignCalciteMass(const unsigned globalDofIdx, const Scalar calciteMass)
typename FluidSystem::Scalar Scalar
Definition: FIPContainer.hpp:48
static constexpr auto oilPhaseIdx
Definition: FIPContainer.hpp:54
bool hasCo2InGas() const
void assignCo2InWater(const unsigned globalDofIdx, const Scalar co2InWater, const Scalar mM)
void assignPoreVolume(const unsigned globalDofIdx, const Scalar poreVolume, const Scalar dynamicPoreVolume)
void assignVolumesSurface(const unsigned globalDofIdx, const std::array< Scalar, numPhases > &fip)
std::array< std::vector< Scalar >, static_cast< std::size_t >(Inplace::Phase::NumberOfEnumerators)> FIPArray
Definition: FIPContainer.hpp:50
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)
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)
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)
Phase
Phase indices for reservoir coupling, we currently only support black-oil phases (oil,...
Definition: ReservoirCoupling.hpp:183
Definition: BioeffectsContainer.hpp:33
Definition: blackoilbioeffectsmodules.hh:45
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