22 #ifndef OPM_FLOWS_CONTAINER_HPP 23 #define OPM_FLOWS_CONTAINER_HPP 25 #include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp> 26 #include <opm/simulators/flow/FlowsData.hpp> 38 namespace data {
class Solution; }
42 template<
class Flu
idSystem>
45 using Scalar =
typename FluidSystem::Scalar;
46 using ScalarBuffer = std::vector<Scalar>;
48 static constexpr
auto numPhases = FluidSystem::numPhases;
49 static constexpr
auto gasPhaseIdx = FluidSystem::gasPhaseIdx;
50 static constexpr
auto oilPhaseIdx = FluidSystem::oilPhaseIdx;
51 static constexpr
auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
53 static constexpr
auto gasCompIdx = FluidSystem::gasCompIdx;
54 static constexpr
auto oilCompIdx = FluidSystem::oilCompIdx;
55 static constexpr
auto waterCompIdx = FluidSystem::waterCompIdx;
59 const SummaryConfig& summaryConfig,
60 std::function<
bool(
const int)> );
62 void allocate(
const std::size_t bufferSize,
63 const SummaryConfig& summaryConfig,
64 const unsigned numOutputNnc,
65 const bool allocRestart,
66 std::map<std::string, int>& rstKeywords);
68 void assignFlores(
const unsigned globalDofIdx,
75 void assignBlockVelocity(
const unsigned globalDofIdx,
78 const Scalar velocity);
80 void assignBlockFlows(
const unsigned globalDofIdx,
85 void assignFlows(
const unsigned globalDofIdx,
92 void outputRestart(data::Solution& sol);
94 const std::array<FlowsData<double>, 3>& getFlowsn()
const 95 {
return this->flowsn_; }
97 bool hasFlowsn()
const 98 {
return enableFlowsn_; }
100 bool hasFlows()
const 101 {
return enableFlows_; }
103 const std::vector<int> blockVelocity()
const 104 {
return blockVelocityAllIds_; }
106 const std::vector<int> blockFlows()
const 107 {
return blockFlowsAllIds_; }
109 unsigned blockFlowsIds(
const unsigned globalDofIdx,
111 const int comp_idx)
const 113 const auto& blockIdxs = blockFlowsIds_[comp_idx][dir];
114 auto it = std::lower_bound(blockIdxs.begin(), blockIdxs.end(), globalDofIdx);
115 return std::distance(blockIdxs.begin(), it);
118 unsigned blockVelocityIds(
const unsigned globalDofIdx,
120 const int comp_idx)
const 122 const auto& blockIdxs = blockVelocityIds_[comp_idx][dir];
123 auto it = std::lower_bound(blockIdxs.begin(), blockIdxs.end(), globalDofIdx);
124 return std::distance(blockIdxs.begin(), it);
127 bool anyFlows()
const 128 {
return anyFlows_; }
130 const std::array<FlowsData<double>, 3>& getFloresn()
const 131 {
return this->floresn_; }
133 bool hasFloresn()
const 134 {
return enableFloresn_; }
136 bool hasFlores()
const 137 {
return enableFlores_; }
139 bool anyFlores()
const 140 {
return anyFlores_; }
142 bool hasBlockVelocityValue(
const unsigned globalDofIdx,
144 const int comp_idx)
const 146 const auto& blockIdxs = blockVelocityIds_[comp_idx][dir];
147 return std::ranges::binary_search(blockIdxs, globalDofIdx);
150 bool hasBlockFlowValue(
const unsigned globalDofIdx,
152 const int comp_idx)
const 154 const auto& blockIdxs = blockFlowsIds_[comp_idx][dir];
155 return std::ranges::binary_search(blockIdxs, globalDofIdx);
158 Scalar getVelocity(
const unsigned globalDofIdx,
159 const FaceDir::DirEnum dir,
160 const int comp_idx)
const 161 {
return velocity_[comp_idx][FaceDir::ToIntersectionIndex(dir)][globalDofIdx]; }
163 Scalar getFlow(
const unsigned globalDofIdx,
164 const FaceDir::DirEnum dir,
165 const int comp_idx)
const 166 {
return flows_[comp_idx][FaceDir::ToIntersectionIndex(dir)][globalDofIdx]; }
169 bool anyFlows_{
false};
170 bool anyFlores_{
false};
171 bool enableFlows_{
false};
172 bool enableFlores_{
false};
173 bool enableFlowsn_{
false};
174 bool enableFloresn_{
false};
176 std::array<std::array<ScalarBuffer, 6>, numPhases> flows_;
177 std::array<std::array<ScalarBuffer, 6>, numPhases> flores_;
178 std::array<std::array<ScalarBuffer, 6>, numPhases> velocity_;
180 std::array<FlowsData<double>, 3> floresn_;
181 std::array<FlowsData<double>, 3> flowsn_;
183 std::vector<int> blockFlowsAllIds_;
184 std::vector<int> blockVelocityAllIds_;
185 std::array<std::array<std::vector<int>, 6>, numPhases> blockFlowsIds_;
186 std::array<std::array<std::vector<int>, 6>, numPhases> blockVelocityIds_;
191 #endif // OPM_FLOWS_CONTAINER_HPP Definition: FlowsContainer.hpp:43
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45