ECLFluxCalc.hpp
Go to the documentation of this file.
1/*
2 Copyright 2017 Statoil ASA.
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 3 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*/
19
20#ifndef OPM_ECLFLUXCALC_HEADER_INCLUDED
21#define OPM_ECLFLUXCALC_HEADER_INCLUDED
22
30
31#include <memory>
32#include <vector>
33
34namespace Opm
35{
36
37 class ECLRestartData;
38 class ECLInitFileData;
39
42 {
43 public:
57 ECLFluxCalc(const ECLGraph& graph,
58 const ECLInitFileData& init,
59 const double grav,
60 const bool useEPS);
61
73 std::vector<double>
74 flux(const ECLRestartData& rstrt,
75 const ECLPhaseIndex phase) const;
76
88 std::vector<double>
90 const ECLPhaseIndex phase) const;
91
95 {
96 std::vector<double> pressure;
97 std::vector<double> mobility;
98 std::vector<double> density;
99 std::vector<double> saturation;
100 };
101
112 const ECLPhaseIndex phase) const;
113
121 double surfaceDensity(const ECLPhaseIndex phase) const;
122
123 private:
124 double singleFlux(const int connection,
125 const DynamicData& dyn_data) const;
126
127 double singleMassFlux(const int connection,
128 const DynamicData& dyn_data) const;
129
130
131 bool phaseIsActive(const ECLPhaseIndex phase) const;
132
133 DynamicData gasPVT(const ECLRestartData& rstrt,
134 DynamicData&& dyn_data) const;
135
136 DynamicData oilPVT(const ECLRestartData& rstrt,
137 DynamicData&& dyn_data) const;
138
139 DynamicData watPVT(DynamicData&& dyn_data) const;
140
141 void computePhaseMobility(const int regID,
142 const std::vector<double>& mu,
143 DynamicData& dyn_data) const;
144
145 template <typename T>
146 std::vector<T>
147 gatherRegionSubset(const int reg,
148 const std::vector<T>& x) const
149 {
150 auto y = std::vector<T>{};
151
152 if (x.empty()) {
153 return y;
154 }
155
156 for (const auto& ix : this->rmap_.getRegionIndices(reg)) {
157 y.push_back(x[ix]);
158 }
159
160 return y;
161 }
162
163 template <typename T>
164 void scatterRegionResults(const int reg,
165 const std::vector<T>& x_reg,
166 std::vector<T>& x) const
167 {
168 auto i = static_cast<decltype(x_reg.size())>(0);
169
170 for (const auto& ix : this->rmap_.getRegionIndices(reg)) {
171 x[ix] = x_reg[i++];
172 }
173 }
174
175 template <class RegOp>
176 void regionLoop(RegOp&& regOp) const
177 {
178 for (const auto& regID : this->rmap_.activeRegions()) {
179 regOp(regID);
180 }
181 }
182
183 const ECLGraph& graph_;
184 ECLSaturationFunc satfunc_;
185 ECLRegionMapping rmap_;
186 std::vector<int> neighbours_;
187 std::vector<double> transmissibility_;
188 std::vector<double> gravDz_;
189
190 bool disgas_{false};
191 bool vapoil_{false};
192
193 std::unique_ptr<ECLPVT::Gas> pvtGas_;
194 std::unique_ptr<ECLPVT::Oil> pvtOil_;
195 std::unique_ptr<ECLPVT::Water> pvtWat_;
196 };
197
198} // namespace Opm
199
200#endif // OPM_ECLFLUXCALC_HEADER_INCLUDED
Class for computing connection fluxes in the absence of flux output.
Definition: ECLFluxCalc.hpp:42
DynamicData phaseProperties(const ECLRestartData &rstrt, const ECLPhaseIndex phase) const
double surfaceDensity(const ECLPhaseIndex phase) const
std::vector< double > massflux(const ECLRestartData &rstrt, const ECLPhaseIndex phase) const
std::vector< double > flux(const ECLRestartData &rstrt, const ECLPhaseIndex phase) const
ECLFluxCalc(const ECLGraph &graph, const ECLInitFileData &init, const double grav, const bool useEPS)
Definition: ECLGraph.hpp:52
Definition: ECLResultData.hpp:177
std::vector< int > activeRegions() const
IndexView getRegionIndices(const int region) const
Definition: ECLResultData.hpp:57
std::vector< double > init(const std::string &kewyord, const TableManager &tables, const Phases &phases, const std::vector< double > &cell_depth, const std::vector< int > &num, const std::vector< int > &endnum)
Definition: A.hpp:4
ECLPhaseIndex
Definition: ECLPhaseIndex.hpp:28
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
Definition: ECLFluxCalc.hpp:95
std::vector< double > density
Definition: ECLFluxCalc.hpp:98
std::vector< double > pressure
Definition: ECLFluxCalc.hpp:96
std::vector< double > mobility
Definition: ECLFluxCalc.hpp:97
std::vector< double > saturation
Definition: ECLFluxCalc.hpp:99