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 void assignGasWater(const unsigned globalDofIdx,
90 const std::array<Scalar, numPhases>& fip,
91 const Scalar gasInPlaceWater,
92 const Scalar waterInPlaceGas);
93
94 void assignOilGasDistribution(const unsigned globalDofIdx,
95 const Scalar gasInPlaceLiquid,
96 const Scalar oilInPlaceGas);
97
98 void assignPoreVolume(const unsigned globalDofIdx,
99 const Scalar value);
100
101 void assignVolumesSurface(const unsigned globalDofIdx,
102 const std::array<Scalar, numPhases>& fip);
103
104 void assignVolumesReservoir(const unsigned globalDofIdx,
105 const Scalar saltConcentration,
106 const std::array<Scalar, numPhases>& fipr);
107
108 void outputRestart(data::Solution& sol);
109
110private:
111 FIPMap fip_{};
112 std::size_t bufferSize_ = 0;
113
114 struct OutputRestart
115 {
118 bool noPrefix {false};
119
122 bool surface {false};
123
126 bool reservoir {false};
127
128 void clearBits()
129 {
130 this->noPrefix = this->surface = this->reservoir = false;
131 }
132
133 explicit operator bool() const
134 {
135 return this->noPrefix || this->surface || this->reservoir;
136 }
137 } outputRestart_{};
138};
139
140} // namespace Opm
141
142#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