opm-simulators
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 
38 namespace Opm::data {
39 class Solution;
40 }
41 
42 namespace Opm {
43 
44 class SummaryConfig;
45 
46 template<class FluidSystem>
47 class FIPContainer {
48 public:
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  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 
135 private:
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:64
Definition: FIPContainer.hpp:47
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: BioeffectsContainer.hpp:33