opm-simulators
WellTest.hpp
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 
30 namespace Opm
31 {
32 
33 class DeferredLogger;
34 template<typename Scalar, typename IndexTraits> class SingleWellState;
35 class WellEconProductionLimits;
36 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
37 class WellTestState;
38 
40 template<typename Scalar, typename IndexTraits>
41 class WellTest {
42 public:
44  explicit WellTest(const WellInterfaceGeneric<Scalar, IndexTraits>& well) : well_(well) {}
45 
46  void updateWellTestStateEconomic(const SingleWellState<Scalar, IndexTraits>& ws,
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 
58 private:
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,
67  const SingleWellState<Scalar, IndexTraits>& ws,
68  RatioLimitCheckReport& report) const;
69 
70  void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
71  const SingleWellState<Scalar, IndexTraits>& ws,
72  RatioLimitCheckReport& report) const;
73 
74  void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
75  const SingleWellState<Scalar, IndexTraits>& ws,
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,
95  const SingleWellState<Scalar, IndexTraits>& ws,
96  DeferredLogger& deferred_logger) const;
97 
98 
99  const WellInterfaceGeneric<Scalar, IndexTraits>& well_;
100 };
101 
102 }
103 
104 #endif // OPM_WELL_TEST_HEADER_INCLUDED
WellTest(const WellInterfaceGeneric< Scalar, IndexTraits > &well)
Constructor sets reference to well.
Definition: WellTest.hpp:44
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: DeferredLogger.hpp:56
Definition: BlackoilWellModelRestart.hpp:42
Definition: BlackoilWellModelGeneric.hpp:75
Class for performing well tests.
Definition: WellTest.hpp:41