GroupEconomicLimitsChecker.hpp
Go to the documentation of this file.
1/*
2 Copyright 2023 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#ifndef OPM_GROUP_ECONOMIC_LIMITS_CHECKER_HEADER_INCLUDED
21#define OPM_GROUP_ECONOMIC_LIMITS_CHECKER_HEADER_INCLUDED
22
23#include <opm/input/eclipse/Schedule/Group/GroupEconProductionLimits.hpp>
24#include <opm/input/eclipse/Units/UnitSystem.hpp>
25
26#include <array>
27#include <map>
28#include <string>
29
30namespace Opm
31{
32
33template<typename Scalar, typename IndexTraits> class BlackoilWellModelGeneric;
34class DeferredLogger;
35class Group;
36template<typename Scalar, typename IndexTraits> class WellState;
37class WellTestState;
38
39template<typename Scalar, typename IndexTraits>
41{
42public:
44 WellTestState& well_test_state,
45 const Group& group,
46 const double simulation_time,
47 const int report_step_idx,
48 DeferredLogger& deferred_logger);
49 void closeWells();
50 bool minGasRate();
51 bool minOilRate();
52 bool waterCut();
53 bool GOR();
54 bool WGR();
55 void doWorkOver();
56 bool endRun();
60 std::string message_separator(const char sep_char = '*',
61 const size_t sep_length = 110) const
62 { return std::string(sep_length, sep_char); }
63
64 static constexpr int NUM_PHASES = 3;
65
66private:
67 void displayDebugMessage(const std::string& msg) const;
68 void addPrintMessage(const std::string& msg,
69 const Scalar value,
70 const Scalar limit,
71 const UnitSystem::measure measure);
72 bool closeWellsRecursive(const Group& group, int level = 0);
73 void throwNotImplementedError(const std::string& error) const;
74
76 const Group& group_;
77 const double simulation_time_;
78 const int report_step_idx_;
79 DeferredLogger& deferred_logger_;
80 const std::string date_string_;
81 const UnitSystem& unit_system_;
82 const WellState<Scalar, IndexTraits>& well_state_;
83 WellTestState& well_test_state_;
84 const Schedule& schedule_;
85 GroupEconProductionLimits::GEconGroupProp gecon_props_;
86 bool debug_ = true;
87 std::array<Scalar,NUM_PHASES> production_rates_;
88 std::map<int, unsigned> phase_idx_map_ = {
89 {0, IndexTraits::oilPhaseIdx},
90 {1, IndexTraits::gasPhaseIdx},
91 {2, IndexTraits::waterPhaseIdx}
92 };
93 std::map<unsigned, int> phase_idx_reverse_map_;
94 std::string message_;
95};
96
97} // namespace Opm
98
99#endif // OPM_GROUP_ECONOMIC_LIMITS_CHECKER_HEADER_INCLUDED
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:95
Definition: DeferredLogger.hpp:57
Definition: GroupEconomicLimitsChecker.hpp:41
GroupEconomicLimitsChecker(const BlackoilWellModelGeneric< Scalar, IndexTraits > &well_model, WellTestState &well_test_state, const Group &group, const double simulation_time, const int report_step_idx, DeferredLogger &deferred_logger)
std::string message_separator(const char sep_char=' *', const size_t sep_length=110) const
Definition: GroupEconomicLimitsChecker.hpp:60
static constexpr int NUM_PHASES
Definition: GroupEconomicLimitsChecker.hpp:64
Definition: WellState.hpp:66
Definition: blackoilboundaryratevector.hh:39