opm-simulators
WellConstraints.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_CONSTRAINTS_HEADER_INCLUDED
25 #define OPM_WELL_CONSTRAINTS_HEADER_INCLUDED
26 
27 #include <opm/input/eclipse/Schedule/Well/Well.hpp>
28 
29 #include <cstdint>
30 #include <functional>
31 #include <vector>
32 #include <optional>
33 
34 namespace Opm
35 {
36 
37 class DeferredLogger;
38 using RegionId = int;
39 class Rates;
40 template<typename Scalar, typename IndexTraits> class SingleWellState;
41 class SummaryState;
42 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
43 enum class WellInjectorCMode : std::uint16_t;
44 enum class WellProducerCMode : std::uint16_t;
45 
47 template<typename Scalar, typename IndexTraits>
49 public:
51  explicit WellConstraints(const WellInterfaceGeneric<Scalar, IndexTraits>& well) : well_(well) {}
52 
53  using RateConvFunc = std::function<void(const RegionId, const int,
54  const std::vector<Scalar>&,
55  std::vector<Scalar>&)>;
56 
57  bool
58  checkIndividualConstraints(SingleWellState<Scalar, IndexTraits>& ws,
59  const SummaryState& summaryState,
60  const RateConvFunc& calcReservoirVoidageRates,
61  bool& thp_limit_violated_but_not_switched,
62  DeferredLogger& deferred_logger,
63  const std::optional<Well::InjectionControls>& inj_controls = std::nullopt,
64  const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
65 
66 private:
67  WellInjectorCMode
68  activeInjectionConstraint(const SingleWellState<Scalar, IndexTraits>& ws,
69  const SummaryState& summaryState,
70  bool& thp_limit_violated_but_not_switched,
71  DeferredLogger& deferred_logger,
72  const std::optional<Well::InjectionControls>& inj_controls = std::nullopt) const;
73 
74  WellProducerCMode
75  activeProductionConstraint(const SingleWellState<Scalar, IndexTraits>& ws,
76  const SummaryState& summaryState,
77  const RateConvFunc& calcReservoirVoidageRates,
78  bool& thp_limit_violated_but_not_switched,
79  DeferredLogger& deferred_logger,
80  const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
81 
83 };
84 
85 }
86 
87 #endif // OPM_WELL_CONSTRAINTS_HEADER_INCLUDED
WellConstraints(const WellInterfaceGeneric< Scalar, IndexTraits > &well)
Constructor sets reference to well.
Definition: WellConstraints.hpp:51
Class for computing well group constraints.
Definition: WellConstraints.hpp:48
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