22#ifndef OPM_FLOWS_CONTAINER_HPP
23#define OPM_FLOWS_CONTAINER_HPP
25#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
38namespace data {
class Solution; }
42template<
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)> );
63 const SummaryConfig& summaryConfig,
64 const unsigned numOutputNnc,
65 const bool allocRestart,
66 std::map<std::string, int>& rstKeywords);
78 const Scalar velocity);
94 const std::array<FlowsData<double>, 3>&
getFlowsn()
const
95 {
return this->flowsn_; }
98 {
return enableFlowsn_; }
101 {
return enableFlows_; }
104 {
return blockVelocityAllIds_; }
107 {
return blockFlowsAllIds_; }
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);
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);
128 {
return anyFlows_; }
131 {
return this->floresn_; }
134 {
return enableFloresn_; }
137 {
return enableFlores_; }
140 {
return anyFlores_; }
144 const int comp_idx)
const
146 const auto& blockIdxs = blockVelocityIds_[comp_idx][dir];
147 return std::ranges::binary_search(blockIdxs, globalDofIdx);
152 const int comp_idx)
const
154 const auto& blockIdxs = blockFlowsIds_[comp_idx][dir];
155 return std::ranges::binary_search(blockIdxs, globalDofIdx);
159 const FaceDir::DirEnum dir,
160 const int comp_idx)
const
161 {
return velocity_[comp_idx][FaceDir::ToIntersectionIndex(dir)][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_;
Definition: FlowsContainer.hpp:44
const std::vector< int > blockFlows() const
Definition: FlowsContainer.hpp:106
void outputRestart(data::Solution &sol)
void assignBlockVelocity(const unsigned globalDofIdx, const int faceId, const int comp_idx, const Scalar velocity)
void allocate(const std::size_t bufferSize, const SummaryConfig &summaryConfig, const unsigned numOutputNnc, const bool allocRestart, std::map< std::string, int > &rstKeywords)
bool anyFlores() const
Definition: FlowsContainer.hpp:139
void assignBlockFlows(const unsigned globalDofIdx, const int faceId, const int comp_idx, const Scalar flow)
bool hasFlores() const
Definition: FlowsContainer.hpp:136
FlowsContainer(const Schedule &schedule, const SummaryConfig &summaryConfig, std::function< bool(const int)>)
const std::array< FlowsData< double >, 3 > & getFloresn() const
Definition: FlowsContainer.hpp:130
bool hasBlockVelocityValue(const unsigned globalDofIdx, const int dir, const int comp_idx) const
Definition: FlowsContainer.hpp:142
unsigned blockFlowsIds(const unsigned globalDofIdx, const int dir, const int comp_idx) const
Definition: FlowsContainer.hpp:109
bool hasFlowsn() const
Definition: FlowsContainer.hpp:97
Scalar getFlow(const unsigned globalDofIdx, const FaceDir::DirEnum dir, const int comp_idx) const
Definition: FlowsContainer.hpp:163
bool hasFloresn() const
Definition: FlowsContainer.hpp:133
bool hasFlows() const
Definition: FlowsContainer.hpp:100
bool hasBlockFlowValue(const unsigned globalDofIdx, const int dir, const int comp_idx) const
Definition: FlowsContainer.hpp:150
const std::vector< int > blockVelocity() const
Definition: FlowsContainer.hpp:103
unsigned blockVelocityIds(const unsigned globalDofIdx, const int dir, const int comp_idx) const
Definition: FlowsContainer.hpp:118
const std::array< FlowsData< double >, 3 > & getFlowsn() const
Definition: FlowsContainer.hpp:94
bool anyFlows() const
Definition: FlowsContainer.hpp:127
void assignFlores(const unsigned globalDofIdx, const int faceId, const unsigned nncId, const Scalar gas, const Scalar oil, const Scalar water)
Scalar getVelocity(const unsigned globalDofIdx, const FaceDir::DirEnum dir, const int comp_idx) const
Definition: FlowsContainer.hpp:158
void assignFlows(const unsigned globalDofIdx, const int faceId, const unsigned nncId, const Scalar gas, const Scalar oil, const Scalar water)
Definition: blackoilbioeffectsmodules.hh:45