My Project
Loading...
Searching...
No Matches
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;
67 Scalar sg;
68 Scalar sgcr;
69 Scalar rhog;
70 Scalar xgW;
71 Scalar mM;
72 Scalar trappedGas;
73 Scalar strandedGas;
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 void assignGasWater(const unsigned globalDofIdx,
110 const std::array<Scalar, numPhases>& fip,
111 const Scalar gasInPlaceWater,
112 const Scalar waterInPlaceGas);
113
114 void assignOilGasDistribution(const unsigned globalDofIdx,
115 const Scalar gasInPlaceLiquid,
116 const Scalar oilInPlaceGas);
117
118 void assignPoreVolume(const unsigned globalDofIdx,
119 const Scalar value);
120
121 void assignVolumesSurface(const unsigned globalDofIdx,
122 const std::array<Scalar, numPhases>& fip);
123
124 void assignVolumesReservoir(const unsigned globalDofIdx,
125 const Scalar saltConcentration,
126 const std::array<Scalar, numPhases>& fipr);
127
128 void outputRestart(data::Solution& sol);
129
130private:
131 FIPMap fip_{};
132 std::size_t bufferSize_ = 0;
133
134 struct OutputRestart
135 {
138 bool noPrefix {false};
139
142 bool surface {false};
143
146 bool reservoir {false};
147
148 void clearBits()
149 {
150 this->noPrefix = this->surface = this->reservoir = false;
151 }
152
153 explicit operator bool() const
154 {
155 return this->noPrefix || this->surface || this->reservoir;
156 }
157 } outputRestart_{};
158};
159
160} // namespace Opm
161
162#endif // OPM_FIP_CONTAINER_HPP
Definition FIPContainer.hpp:47
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
Definition FIPContainer.hpp:65