TargetCalculator.hpp
Go to the documentation of this file.
1/*
2 Copyright 2020 Equinor 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
21#ifndef OPM_TARGETCALCULATOR_HEADER_INCLUDED
22#define OPM_TARGETCALCULATOR_HEADER_INCLUDED
23
24#include <opm/input/eclipse/Schedule/Group/Group.hpp>
25#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
26
27#include <optional>
28#include <string>
29#include <vector>
30
31namespace Opm {
32
33class DeferredLogger;
34template<class Scalar> class GroupState;
35template<typename IndexTraits> class PhaseUsageInfo;
36template<typename Scalar, typename IndexTraits> class GroupStateHelper;
37
38namespace GroupStateHelpers
39 {
40
43template<typename Scalar, typename IndexTraits>
45{
46public:
48
49 TargetCalculator(const GroupStateHelperType& groupStateHelper,
50 const std::vector<Scalar>& resv_coeff,
51 const Group& group);
52
53 template <typename RateType>
54 RateType calcModeRateFromRates(const std::vector<RateType>& rates) const
55 {
56 return calcModeRateFromRates(rates.data());
57 }
58
59 template <typename RateType>
60 RateType calcModeRateFromRates(const RateType* rates) const;
61
62 Scalar groupTarget() const;
63
64 GuideRateModel::Target guideTargetMode() const;
65
67 {
68 return this->groupStateHelper_.deferredLogger();
69 }
70
71private:
72 Group::ProductionCMode cmode_;
73 const GroupStateHelperType& groupStateHelper_;
74 const std::vector<Scalar>& resv_coeff_;
75 const Group& group_;
76};
77
80template<typename Scalar, typename IndexTraits>
82{
83public:
85
87 const std::vector<Scalar>& resv_coeff,
88 const Group& group,
89 const Phase& injection_phase);
90
91 template <typename RateVec>
92 auto calcModeRateFromRates(const RateVec& rates) const
93 {
94 return rates[pos_];
95 }
96
97 Scalar groupTarget() const;
98
99 GuideRateModel::Target guideTargetMode() const;
100
102 {
103 return this->groupStateHelper_.deferredLogger();
104 }
105
106private:
107 const GroupStateHelperType& groupStateHelper_;
108 const std::vector<Scalar>& resv_coeff_;
109 const Group& group_;
110 const Phase injection_phase_;
111 Group::InjectionCMode cmode_;
112 int pos_;
113 GuideRateModel::Target target_;
114};
115
116} // namespace GroupStateHelpers
117
118
119} // namespace Opm
120
121#endif
Definition: DeferredLogger.hpp:57
Definition: GroupStateHelper.hpp:54
DeferredLogger & deferredLogger() const
Get the deferred logger.
Definition: GroupStateHelper.hpp:226
Definition: TargetCalculator.hpp:82
auto calcModeRateFromRates(const RateVec &rates) const
Definition: TargetCalculator.hpp:92
InjectionTargetCalculator(const GroupStateHelperType &groupStateHelper, const std::vector< Scalar > &resv_coeff, const Group &group, const Phase &injection_phase)
GuideRateModel::Target guideTargetMode() const
GroupStateHelper< Scalar, IndexTraits > GroupStateHelperType
Definition: TargetCalculator.hpp:84
DeferredLogger & deferredLogger() const
Definition: TargetCalculator.hpp:101
Definition: TargetCalculator.hpp:45
TargetCalculator(const GroupStateHelperType &groupStateHelper, const std::vector< Scalar > &resv_coeff, const Group &group)
RateType calcModeRateFromRates(const RateType *rates) const
Opm::GroupStateHelper< Scalar, IndexTraits > GroupStateHelperType
Definition: TargetCalculator.hpp:47
RateType calcModeRateFromRates(const std::vector< RateType > &rates) const
Definition: TargetCalculator.hpp:54
GuideRateModel::Target guideTargetMode() const
DeferredLogger & deferredLogger() const
Definition: TargetCalculator.hpp:66
Phase
Phase indices for reservoir coupling, we currently only support black-oil phases (oil,...
Definition: ReservoirCoupling.hpp:152
Definition: blackoilbioeffectsmodules.hh:43