opm-simulators
Loading...
Searching...
No Matches
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
26#include <vector>
27
28namespace Opm {
29
30template<typename Scalar, typename IndexTraits> class GroupStateHelper;
31
32namespace GroupStateHelpers
33 {
34
37template<typename Scalar, typename IndexTraits>
38class TargetCalculator
39{
40public:
41 using GroupStateHelperType = Opm::GroupStateHelper<Scalar, IndexTraits>;
42
43 TargetCalculator(const GroupStateHelperType& groupStateHelper,
44 const std::vector<Scalar>& resv_coeff,
45 const Group& group);
46
49 TargetCalculator(const GroupStateHelperType& groupStateHelper,
50 const std::vector<Scalar>& resv_coeff,
51 Group::ProductionCMode cmode);
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
62private:
63 Group::ProductionCMode cmode_;
64 const GroupStateHelperType& groupStateHelper_;
65 const std::vector<Scalar>& resv_coeff_;
66};
67
70template<typename Scalar, typename IndexTraits>
71class InjectionTargetCalculator
72{
73public:
74 using GroupStateHelperType = GroupStateHelper<Scalar, IndexTraits>;
75
76 InjectionTargetCalculator(const GroupStateHelperType& groupStateHelper,
77 const Phase& injection_phase);
78
79 template <typename RateVec>
80 auto calcModeRateFromRates(const RateVec& rates) const
81 {
82 return rates[pos_];
83 }
84
85private:
86 int pos_;
87};
88
89} // namespace GroupStateHelpers
90
91
92} // namespace Opm
93
94#endif
Definition GroupStateHelper.hpp:57
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45