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;
36
37namespace GroupStateHelpers
38 {
39
42template<typename Scalar, typename IndexTraits>
44{
45public:
46 TargetCalculator(const Group::ProductionCMode cmode,
48 const std::vector<Scalar>& resv_coeff,
49 const Scalar group_grat_target_from_sales,
50 const std::string& group_name,
51 const GroupState<Scalar>& group_state,
52 const bool use_gpmaint);
53
54 template <typename RateType>
55 RateType calcModeRateFromRates(const std::vector<RateType>& rates) const
56 {
57 return calcModeRateFromRates(rates.data());
58 }
59
60 template <typename RateType>
61 RateType calcModeRateFromRates(const RateType* rates) const;
62
63 Scalar groupTarget(const std::optional<Group::ProductionControls>& ctrl,
64 DeferredLogger& deferred_logger) const;
65
66 GuideRateModel::Target guideTargetMode() const;
67
68private:
69 Group::ProductionCMode cmode_;
71 const std::vector<Scalar>& resv_coeff_;
72 const Scalar group_grat_target_from_sales_;
73 const std::string& group_name_;
74 const GroupState<Scalar>& group_state_;
75 bool use_gpmaint_;
76};
77
80template<typename Scalar, typename IndexTraits>
82{
83public:
84 InjectionTargetCalculator(const Group::InjectionCMode& cmode,
86 const std::vector<Scalar>& resv_coeff,
87 const std::string& group_name,
88 const Scalar sales_target,
89 const GroupState<Scalar>& group_state,
90 const Phase& injection_phase,
91 const bool use_gpmaint,
92 DeferredLogger& deferred_logger);
93
94 template <typename RateVec>
95 auto calcModeRateFromRates(const RateVec& rates) const
96 {
97 return rates[pos_];
98 }
99
100 Scalar groupTarget(const std::optional<Group::InjectionControls>& ctrl,
101 DeferredLogger& deferred_logger) const;
102
103 GuideRateModel::Target guideTargetMode() const;
104
105private:
106 Group::InjectionCMode cmode_;
108 const std::vector<Scalar>& resv_coeff_;
109 const std::string& group_name_;
110 Scalar sales_target_;
111 const GroupState<Scalar>& group_state_;
112 bool use_gpmaint_;
113 int pos_;
114 GuideRateModel::Target target_;
115};
116
117} // namespace GroupStateHelpers
118
119
120} // namespace Opm
121
122#endif
Definition: DeferredLogger.hpp:57
Definition: TargetCalculator.hpp:82
auto calcModeRateFromRates(const RateVec &rates) const
Definition: TargetCalculator.hpp:95
GuideRateModel::Target guideTargetMode() const
Scalar groupTarget(const std::optional< Group::InjectionControls > &ctrl, DeferredLogger &deferred_logger) const
InjectionTargetCalculator(const Group::InjectionCMode &cmode, const PhaseUsageInfo< IndexTraits > &pu, const std::vector< Scalar > &resv_coeff, const std::string &group_name, const Scalar sales_target, const GroupState< Scalar > &group_state, const Phase &injection_phase, const bool use_gpmaint, DeferredLogger &deferred_logger)
Definition: TargetCalculator.hpp:44
RateType calcModeRateFromRates(const RateType *rates) const
Scalar groupTarget(const std::optional< Group::ProductionControls > &ctrl, DeferredLogger &deferred_logger) const
TargetCalculator(const Group::ProductionCMode cmode, const PhaseUsageInfo< IndexTraits > &pu, const std::vector< Scalar > &resv_coeff, const Scalar group_grat_target_from_sales, const std::string &group_name, const GroupState< Scalar > &group_state, const bool use_gpmaint)
RateType calcModeRateFromRates(const std::vector< RateType > &rates) const
Definition: TargetCalculator.hpp:55
GuideRateModel::Target guideTargetMode() const
Definition: GroupState.hpp:41
Definition: GasLiftGroupInfo.hpp:37
Phase
Phase indices for reservoir coupling, we currently only support black-oil phases (oil,...
Definition: ReservoirCoupling.hpp:141
Definition: blackoilbioeffectsmodules.hh:43