opm-simulators
RFTContainer.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_RFT_CONTAINER_HPP
27 #define OPM_RFT_CONTAINER_HPP
28 
29 #include <opm/simulators/utils/ParallelCommunication.hpp>
30 
31 #include <cstddef>
32 #include <functional>
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 namespace Opm {
38 
39 namespace data { class Wells; }
40 class EclipseState;
41 class Schedule;
42 
50 template<class FluidSystem>
51 class RFTContainer {
53  using Scalar = typename FluidSystem::Scalar;
54 
57  using ScalarBuffer = std::vector<Scalar>;
58 
60  static constexpr auto gasPhaseIdx = FluidSystem::gasPhaseIdx;
61 
63  static constexpr auto oilPhaseIdx = FluidSystem::oilPhaseIdx;
64 
66  static constexpr auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
67 
68 public:
71  using AssignmentFunc = std::function<Scalar()>;
72 
77  using WellQueryFunc = std::function<bool(const std::string&)>;
78 
95  RFTContainer(const EclipseState& eclState,
96  const Schedule& schedule,
97  const WellQueryFunc& wellIsOwnedByCurrent,
98  const WellQueryFunc& wellOnCurrent)
99  : eclState_(eclState)
100  , schedule_(schedule)
101  , wellIsOwnedByCurrentRank_(wellIsOwnedByCurrent)
102  , wellOnCurrentRank_(wellOnCurrent)
103  {}
104 
122  void addToWells(data::Wells& wellDatas,
123  const std::size_t reportStepNum,
124  const Parallel::Communication& comm);
125 
130  void allocate(const std::size_t reportStepNum);
131 
152  void assign(const unsigned cartesianIndex,
153  const AssignmentFunc& oil,
154  const AssignmentFunc& water,
155  const AssignmentFunc& gas);
156 
157 private:
159  const EclipseState& eclState_;
160 
162  const Schedule& schedule_;
163 
168  WellQueryFunc wellIsOwnedByCurrentRank_;
169 
174  WellQueryFunc wellOnCurrentRank_;
175 
180  std::map<std::size_t, Scalar> oilConnectionPressures_;
181 
187  std::map<std::size_t, Scalar> waterConnectionSaturations_;
188 
193  std::map<std::size_t, Scalar> gasConnectionSaturations_;
194 };
195 
196 } // namespace Opm
197 
198 #endif // OPM_RFT_CONTAINER_HPP
void allocate(const std::size_t reportStepNum)
Prepare internal data structures to collect RFT state.
Definition: RFTContainer.cpp:139
void assign(const unsigned cartesianIndex, const AssignmentFunc &oil, const AssignmentFunc &water, const AssignmentFunc &gas)
Collect cell level RFT state into internal data structures.
Definition: RFTContainer.cpp:175
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Collection of cell-level RFT data–i.e., pressures and saturations–in cells intersected by wells...
Definition: RFTContainer.hpp:51
std::function< bool(const std::string &)> WellQueryFunc
Call-back predicate type for inferring MPI characteristics for a named well.
Definition: RFTContainer.hpp:77
void addToWells(data::Wells &wellDatas, const std::size_t reportStepNum, const Parallel::Communication &comm)
Export RFT cell level state data to requisite connections.
Definition: RFTContainer.cpp:74
std::function< Scalar()> AssignmentFunc
Call-back function type for collecting cell level dynamic state values.
Definition: RFTContainer.hpp:71
RFTContainer(const EclipseState &eclState, const Schedule &schedule, const WellQueryFunc &wellIsOwnedByCurrent, const WellQueryFunc &wellOnCurrent)
Constructor.
Definition: RFTContainer.hpp:95