FractionCalculator.hpp
Go to the documentation of this file.
1/*
2 Copyright 2019 Norce.
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_FRACTION_CALCULATOR_HEADER_INCLUDED
22#define OPM_FRACTION_CALCULATOR_HEADER_INCLUDED
23
24#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
25
26#include <string>
27
28namespace Opm {
29template<class Scalar> class GroupState;
30class Schedule;
31template<typename Scalar, typename IndexTraits> class GroupStateHelper;
32template<typename Scalar, typename IndexTraits> class WellState;
33}
34
36 {
37
38template<typename Scalar, typename IndexTraits>
40{
41public:
43
58 FractionCalculator(const Schedule& schedule,
59 const GroupStateHelperType& groupStateHelper,
60 const SummaryState& summary_state,
61 const int report_step,
62 const GuideRate* guide_rate,
63 const GuideRateModel::Target target,
64 const bool is_producer,
65 const Phase injection_phase,
66 const std::string& assumed_fld_group = "");
67 Scalar fraction(const std::string& name,
68 const std::string& control_group_name,
69 const bool always_include_this);
70 Scalar localFraction(const std::string& name,
71 const std::string& always_included_child);
72 Scalar guideRate(const std::string& name,
73 const std::string& always_included_child,
74 const bool always_use_potentials);
75
76private:
77 std::string parent(const std::string& name);
78
79 // returns the sum of the guiderates of the given group
80 // and the number of sub-groups/wells that contributed to the sum
81 std::pair<Scalar,int> guideRateSum(const Group& group,
82 const std::string& always_included_child,
83 const bool always_use_potentials);
84 int groupControlledWells(const std::string& group_name,
85 const std::string& always_included_child);
86 bool hasFieldOrNoneControl(const std::string& group_name) const;
87 bool isAssumedFldGroupMember(const std::string& name);
88 bool isAssumedFldGroupOrAncestor(const std::string& group_name);
89 int assumedFldGroupControlledWells(const std::string& group_name);
90 GuideRate::RateVector getGroupRateVector(const std::string& group_name);
91 const GroupStateHelperType& groupStateHelper() const { return groupStateHelper_; }
92
93 const Schedule& schedule_;
94 const GroupStateHelperType& groupStateHelper_;
95 const SummaryState& summary_state_;
96 int report_step_;
97 const GuideRate* guide_rate_;
98 GuideRateModel::Target target_;
99 bool is_producer_;
100 Phase injection_phase_;
101 std::string assumed_fld_group_;
102};
103
104} // namespace Opm::GroupStateHelpers
105
106
107#endif // OPM_FRACTION_CALCULATOR_HEADER_INCLUDED
Definition: GroupStateHelper.hpp:57
Definition: FractionCalculator.hpp:40
Scalar fraction(const std::string &name, const std::string &control_group_name, const bool always_include_this)
FractionCalculator(const Schedule &schedule, const GroupStateHelperType &groupStateHelper, const SummaryState &summary_state, const int report_step, const GuideRate *guide_rate, const GuideRateModel::Target target, const bool is_producer, const Phase injection_phase, const std::string &assumed_fld_group="")
Construct a calculator of guide rate fractions of group targets.
Scalar guideRate(const std::string &name, const std::string &always_included_child, const bool always_use_potentials)
GroupStateHelper< Scalar, IndexTraits > GroupStateHelperType
Definition: FractionCalculator.hpp:42
Scalar localFraction(const std::string &name, const std::string &always_included_child)
Definition: FractionCalculator.hpp:36
Phase
Phase indices for reservoir coupling, we currently only support black-oil phases (oil,...
Definition: ReservoirCoupling.hpp:184
Definition: blackoilbioeffectsmodules.hh:45