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 <limits>
28#include <vector>
29
30namespace Opm
31{
32
33class DeferredLogger;
34template<typename Scalar, typename IndexTraits> class SingleWellState;
35class WellEconProductionLimits;
36template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
37class WellTestState;
38
40template<typename Scalar, typename IndexTraits>
41class WellTest {
42public:
44 explicit WellTest(const WellInterfaceGeneric<Scalar, IndexTraits>& well) : well_(well) {}
45
47 const double simulation_time,
48 const bool write_message_to_opmlog,
49 WellTestState& well_test_state,
50 bool zero_group_target,
51 DeferredLogger& deferred_logger) const;
52
53 void updateWellTestStatePhysical(const double simulation_time,
54 const bool write_message_to_opmlog,
55 WellTestState& well_test_state,
56 DeferredLogger& deferred_logger) const;
57
58private:
59 struct RatioLimitCheckReport {
60 static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
61 bool ratio_limit_violated = false;
62 int worst_offending_completion = INVALIDCOMPLETION;
63 Scalar violation_extent = 0.0;
64 };
65
66 void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
68 RatioLimitCheckReport& report) const;
69
70 void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
72 RatioLimitCheckReport& report) const;
73
74 void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
76 RatioLimitCheckReport& report) const;
77
78 template<class RatioFunc>
79 bool checkMaxRatioLimitWell(const SingleWellState<Scalar, IndexTraits>& ws,
80 const Scalar max_ratio_limit,
81 const RatioFunc& ratioFunc) const;
82
83 template<class RatioFunc>
84 void checkMaxRatioLimitCompletions(const SingleWellState<Scalar, IndexTraits>& ws,
85 const Scalar max_ratio_limit,
86 const RatioFunc& ratioFunc,
87 RatioLimitCheckReport& report) const;
88
89 bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
90 const std::vector<Scalar>& rates_or_potentials,
91 DeferredLogger& deferred_logger) const;
92
93 RatioLimitCheckReport
94 checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
96 DeferredLogger& deferred_logger) const;
97
98
100};
101
102}
103
104#endif // OPM_WELL_TEST_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: SingleWellState.hpp:43
Definition: WellInterfaceGeneric.hpp:53
Class for performing well tests.
Definition: WellTest.hpp:41
void updateWellTestStateEconomic(const SingleWellState< Scalar, IndexTraits > &ws, const double simulation_time, const bool write_message_to_opmlog, WellTestState &well_test_state, bool zero_group_target, DeferredLogger &deferred_logger) const
WellTest(const WellInterfaceGeneric< Scalar, IndexTraits > &well)
Constructor sets reference to well.
Definition: WellTest.hpp:44
void updateWellTestStatePhysical(const double simulation_time, const bool write_message_to_opmlog, WellTestState &well_test_state, DeferredLogger &deferred_logger) const
Definition: blackoilboundaryratevector.hh:39