WellTest.hpp
Go to the documentation of this file.
1/*
2 Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3 Copyright 2017 Statoil ASA.
4 Copyright 2017 IRIS
5 Copyright 2019 Norce
6
7 This file is part of the Open Porous Media project (OPM).
8
9 OPM is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OPM is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OPM. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23
24#ifndef OPM_WELL_TEST_HEADER_INCLUDED
25#define OPM_WELL_TEST_HEADER_INCLUDED
26
27#include <opm/input/eclipse/Units/UnitSystem.hpp>
28
29#include <cstddef>
30#include <ctime>
31#include <limits>
32#include <string>
33#include <unordered_set>
34#include <vector>
35
36namespace Opm
37{
38
39class DeferredLogger;
40template<typename Scalar, typename IndexTraits> class SingleWellState;
41class WellEconProductionLimits;
42template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
43class WellTestState;
44
46template<typename Scalar, typename IndexTraits>
47class WellTest {
48public:
50 explicit WellTest(const WellInterfaceGeneric<Scalar, IndexTraits>& well) : well_(well) {}
51
60 const double simulation_time,
61 const bool write_message_to_opmlog,
62 const bool during_well_test,
63 WellTestState& well_test_state,
64 bool zero_group_target,
65 const UnitSystem& unit_system,
66 const std::time_t start_time,
67 DeferredLogger& deferred_logger) const;
68
69 void updateWellTestStatePhysical(const double simulation_time,
70 const bool write_message_to_opmlog,
71 WellTestState& well_test_state,
72 DeferredLogger& deferred_logger) const;
73
74private:
75 struct RatioLimitCheckReport {
76 static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
81 static constexpr Scalar INFINITE_RATIO = 1.0e30;
82 bool ratio_limit_violated = false;
83 int worst_offending_completion = INVALIDCOMPLETION;
84 Scalar violation_extent = 0.0;
87 std::string ratio_name{};
88 UnitSystem::measure ratio_measure = UnitSystem::measure::identity;
89 Scalar ratio_value = 0.0;
90 Scalar ratio_limit = 0.0;
91 };
92
97 template<class RatioFunc>
98 void checkMaxRatioLimit(const SingleWellState<Scalar, IndexTraits>& ws,
99 const Scalar max_ratio_limit,
100 const RatioFunc& ratioFunc,
101 const std::unordered_set<int>& excluded_completions,
102 const std::string& ratio_name,
103 const UnitSystem::measure ratio_measure,
104 RatioLimitCheckReport& report) const;
105
123 template<class RatioFunc>
124 bool checkMaxRatioLimitWell(const SingleWellState<Scalar, IndexTraits>& ws,
125 const Scalar max_ratio_limit,
126 const RatioFunc& ratioFunc,
127 const std::unordered_set<int>& excluded_completions,
128 Scalar& well_ratio_value) const;
129
130 template<class RatioFunc>
131 void checkMaxRatioLimitCompletions(const SingleWellState<Scalar, IndexTraits>& ws,
132 const Scalar max_ratio_limit,
133 const Scalar well_ratio_value,
134 const RatioFunc& ratioFunc,
135 const std::unordered_set<int>& excluded_completions,
136 const std::string& ratio_name,
137 const UnitSystem::measure ratio_measure,
138 RatioLimitCheckReport& report) const;
139
140 bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
141 const std::vector<Scalar>& rates_or_potentials,
142 DeferredLogger& deferred_logger) const;
143
146 RatioLimitCheckReport
147 checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
148 const SingleWellState<Scalar, IndexTraits>& ws,
149 const std::unordered_set<int>& excluded_completions,
150 DeferredLogger& deferred_logger) const;
151
155 std::string completionDescriptor(int complnum) const;
156
164 bool closeOffendingCompletion(int offending_completion,
165 bool close_connections_below,
166 double simulation_time,
167 bool write_message_to_opmlog,
168 WellTestState& well_test_state,
169 const std::string& when,
170 const std::string& reason,
171 std::unordered_set<int>& closed_this_event,
172 DeferredLogger& deferred_logger) const;
173
174 const WellInterfaceGeneric<Scalar, IndexTraits>& well_;
175};
176
177}
178
179#endif // OPM_WELL_TEST_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: SingleWellState.hpp:44
Definition: WellInterfaceGeneric.hpp:55
Class for performing well tests.
Definition: WellTest.hpp:47
void updateWellTestStateEconomic(const SingleWellState< Scalar, IndexTraits > &ws, const double simulation_time, const bool write_message_to_opmlog, const bool during_well_test, WellTestState &well_test_state, bool zero_group_target, const UnitSystem &unit_system, const std::time_t start_time, DeferredLogger &deferred_logger) const
WellTest(const WellInterfaceGeneric< Scalar, IndexTraits > &well)
Constructor sets reference to well.
Definition: WellTest.hpp:50
void updateWellTestStatePhysical(const double simulation_time, const bool write_message_to_opmlog, WellTestState &well_test_state, DeferredLogger &deferred_logger) const
Definition: blackoilbioeffectsmodules.hh:45