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