opm-simulators
Loading...
Searching...
No Matches
FractionCalculator.hpp
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
35namespace Opm::GroupStateHelpers
36 {
37
38template<typename Scalar, typename IndexTraits>
39class FractionCalculator
40{
41public:
42 using GroupStateHelperType = GroupStateHelper<Scalar, IndexTraits>;
43
44 FractionCalculator(const Schedule& schedule,
45 const GroupStateHelperType& groupStateHelper,
46 const SummaryState& summary_state,
47 const int report_step,
48 const GuideRate* guide_rate,
49 const GuideRateModel::Target target,
50 const bool is_producer,
51 const Phase injection_phase);
52 Scalar fraction(const std::string& name,
53 const std::string& control_group_name,
54 const bool always_include_this);
55 Scalar localFraction(const std::string& name,
56 const std::string& always_included_child);
57
58private:
59 std::string parent(const std::string& name);
60
61 // returns the sum of the guiderates of the given group
62 // and the number of sub-groups/wells that contributed to the sum
63 std::pair<Scalar,int> guideRateSum(const Group& group,
64 const std::string& always_included_child,
65 const bool always_use_potentials);
66 Scalar guideRate(const std::string& name,
67 const std::string& always_included_child,
68 const bool always_use_potentials);
69 int groupControlledWells(const std::string& group_name,
70 const std::string& always_included_child);
71 GuideRate::RateVector getGroupRateVector(const std::string& group_name);
72 const GroupStateHelperType& groupStateHelper() const { return groupStateHelper_; }
73
74 const Schedule& schedule_;
75 const GroupStateHelperType& groupStateHelper_;
76 const SummaryState& summary_state_;
77 int report_step_;
78 const GuideRate* guide_rate_;
79 GuideRateModel::Target target_;
80 bool is_producer_;
81 Phase injection_phase_;
82};
83
84} // namespace Opm::GroupStateHelpers
85
86
87#endif // OPM_FRACTION_CALCULATOR_HEADER_INCLUDED
Definition GroupStateHelper.hpp:57
Definition GroupState.hpp:41
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:66
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45