My Project
Loading...
Searching...
No Matches
FlowsContainer.hpp
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*/
22#ifndef OPM_FLOWS_CONTAINER_HPP
23#define OPM_FLOWS_CONTAINER_HPP
24
25#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
26#include <opm/simulators/flow/FlowsData.hpp>
27
28#include <array>
29#include <cstddef>
30#include <map>
31#include <string>
32#include <vector>
33
34namespace Opm {
35
36namespace data { class Solution; }
37class Schedule;
38class SummaryConfig;
39
40template<class FluidSystem>
42{
43 using Scalar = typename FluidSystem::Scalar;
44 using ScalarBuffer = std::vector<Scalar>;
45
46 static constexpr auto numPhases = FluidSystem::numPhases;
47 static constexpr auto gasPhaseIdx = FluidSystem::gasPhaseIdx;
48 static constexpr auto oilPhaseIdx = FluidSystem::oilPhaseIdx;
49 static constexpr auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
50
51 static constexpr auto gasCompIdx = FluidSystem::gasCompIdx;
52 static constexpr auto oilCompIdx = FluidSystem::oilCompIdx;
53 static constexpr auto waterCompIdx = FluidSystem::waterCompIdx;
54
55public:
56 FlowsContainer(const Schedule& schedule,
57 const SummaryConfig& summaryConfig);
58
59 void allocate(const std::size_t bufferSize,
60 const unsigned numOutputNnc,
61 const bool allocRestart,
62 std::map<std::string, int>& rstKeywords);
63
64 void assignFlores(const unsigned globalDofIdx,
65 const int faceId,
66 const unsigned nncId,
67 const Scalar gas,
68 const Scalar oil,
69 const Scalar water);
70
71 void assignFlows(const unsigned globalDofIdx,
72 const int faceId,
73 const unsigned nncId,
74 const Scalar gas,
75 const Scalar oil,
76 const Scalar water);
77
78 void outputRestart(data::Solution& sol);
79
80 const std::array<FlowsData<double>, 3>& getFlowsn() const
81 { return this->flowsn_; }
82
83 bool hasFlowsn() const
84 { return enableFlowsn_; }
85
86 bool hasFlows() const
87 { return enableFlows_; }
88
89 bool hasBlockFlows() const
90 { return blockFlows_; }
91
92 bool anyFlows() const
93 { return anyFlows_; }
94
95 const std::array<FlowsData<double>, 3>& getFloresn() const
96 { return this->floresn_; }
97
98 bool hasFloresn() const
99 { return enableFloresn_; }
100
101 bool hasFlores() const
102 { return enableFlores_; }
103
104 bool anyFlores() const
105 { return anyFlores_; }
106
107 Scalar getFlow(const unsigned globalDofIdx,
108 const FaceDir::DirEnum dir,
109 const int comp_idx) const
110 { return flows_[comp_idx][FaceDir::ToIntersectionIndex(dir)][globalDofIdx]; }
111
112private:
113 bool anyFlows_{false};
114 bool anyFlores_{false};
115 bool blockFlows_{false};
116 bool enableFlows_{false};
117 bool enableFlores_{false};
118 bool enableFlowsn_{false};
119 bool enableFloresn_{false};
120
121 std::array<std::array<ScalarBuffer, 6>, numPhases> flows_;
122 std::array<std::array<ScalarBuffer, 6>, numPhases> flores_;
123
124 std::array<FlowsData<double>, 3> floresn_;
125 std::array<FlowsData<double>, 3> flowsn_;
126};
127
128} // namespace Opm
129
130#endif // OPM_FLOWS_CONTAINER_HPP
Definition FlowsContainer.hpp:42
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