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;
30struct PhaseUsage;
31class Schedule;
32template<class Scalar> class WellState;
33}
34
35namespace Opm::WGHelpers {
36
37template<class Scalar>
39{
40public:
41 FractionCalculator(const Schedule& schedule,
42 const WellState<Scalar>& well_state,
43 const GroupState<Scalar>& group_state,
44 const SummaryState& summary_state,
45 const int report_step,
46 const GuideRate* guide_rate,
47 const GuideRateModel::Target target,
48 const PhaseUsage& pu,
49 const bool is_producer,
50 const Phase injection_phase);
51 Scalar fraction(const std::string& name,
52 const std::string& control_group_name,
53 const bool always_include_this);
54 Scalar localFraction(const std::string& name,
55 const std::string& always_included_child);
56
57private:
58 std::string parent(const std::string& name);
59
60 // returns the sum of the guiderates of the given group
61 // and the number of sub-groups/wells that contributed to the sum
62 std::pair<Scalar,int> guideRateSum(const Group& group,
63 const std::string& always_included_child,
64 const bool always_use_potentials);
65 Scalar guideRate(const std::string& name,
66 const std::string& always_included_child,
67 const bool always_use_potentials);
68 int groupControlledWells(const std::string& group_name,
69 const std::string& always_included_child);
70 GuideRate::RateVector getGroupRateVector(const std::string& group_name);
71 const Schedule& schedule_;
72 const WellState<Scalar>& well_state_;
73 const GroupState<Scalar>& group_state_;
74 const SummaryState& summary_state_;
75 int report_step_;
76 const GuideRate* guide_rate_;
77 GuideRateModel::Target target_;
78 const PhaseUsage& pu_;
79 bool is_producer_;
80 Phase injection_phase_;
81};
82
83} // namespace Opm::WGHelpers
84
85#endif // OPM_FRACTION_CALCULATOR_HEADER_INCLUDED
Definition: GroupState.hpp:43
Definition: FractionCalculator.hpp:39
Scalar fraction(const std::string &name, const std::string &control_group_name, const bool always_include_this)
Scalar localFraction(const std::string &name, const std::string &always_included_child)
FractionCalculator(const Schedule &schedule, const WellState< Scalar > &well_state, const GroupState< Scalar > &group_state, const SummaryState &summary_state, const int report_step, const GuideRate *guide_rate, const GuideRateModel::Target target, const PhaseUsage &pu, const bool is_producer, const Phase injection_phase)
Definition: WellState.hpp:65
Definition: FractionCalculator.hpp:35
Definition: blackoilboundaryratevector.hh:39
Definition: BlackoilPhases.hpp:46