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