My Project
TargetCalculator.hpp
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 <string>
28#include <vector>
29
30namespace Opm
31{
32
33class DeferredLogger;
34class GroupState;
35struct PhaseUsage;
36
37namespace WellGroupHelpers
38{
39
43 {
44 public:
45 TargetCalculator(const Group::ProductionCMode cmode,
46 const PhaseUsage& pu,
47 const std::vector<double>& resv_coeff,
48 const double group_grat_target_from_sales,
49 const std::string& group_name,
50 const GroupState& group_state,
51 const bool use_gpmaint);
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 double groupTarget(const Group::ProductionControls ctrl) const;
63
64 GuideRateModel::Target guideTargetMode() const;
65
66 private:
67 Group::ProductionCMode cmode_;
68 const PhaseUsage& pu_;
69 const std::vector<double>& resv_coeff_;
70 const double group_grat_target_from_sales_;
71 const std::string& group_name_;
72 const GroupState& group_state_;
73 bool use_gpmaint_;
74 };
75
79 {
80 public:
81 InjectionTargetCalculator(const Group::InjectionCMode& cmode,
82 const PhaseUsage& pu,
83 const std::vector<double>& resv_coeff,
84 const std::string& group_name,
85 const double sales_target,
86 const GroupState& group_state,
87 const Phase& injection_phase,
88 const bool use_gpmaint,
89 DeferredLogger& deferred_logger);
90
91 template <typename RateVec>
92 auto calcModeRateFromRates(const RateVec& rates) const
93 {
94 return rates[pos_];
95 }
96
97 double groupTarget(const Group::InjectionControls& ctrl, Opm::DeferredLogger& deferred_logger) const;
98
99 GuideRateModel::Target guideTargetMode() const;
100
101 private:
102 Group::InjectionCMode cmode_;
103 const PhaseUsage& pu_;
104 const std::vector<double>& resv_coeff_;
105 const std::string& group_name_;
106 double sales_target_;
107 const GroupState& group_state_;
108 bool use_gpmaint_;
109 int pos_;
110 GuideRateModel::Target target_;
111 };
112} // namespace WellGroupHelpers
113
114} // namespace Opm
115
116#endif
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:34
Based on a group control mode, extract or calculate rates, and provide other conveniences.
Definition: TargetCalculator.hpp:79
Based on a group control mode, extract or calculate rates, and provide other conveniences.
Definition: TargetCalculator.hpp:43
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27
Definition: BlackoilPhases.hpp:46