BlackoilWellModelConstraints.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
3 Copyright 2016 - 2017 Statoil ASA.
4 Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
5 Copyright 2016 - 2018 IRIS AS
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#ifndef OPM_BLACKOILWELLMODEL_CONSTRAINTS_HEADER_INCLUDED
24#define OPM_BLACKOILWELLMODEL_CONSTRAINTS_HEADER_INCLUDED
25
26#include <opm/input/eclipse/Schedule/Group/Group.hpp>
27#include <optional>
28#include <utility>
29
30namespace Opm {
31
32template<typename Scalar, typename IndexTraits> class BlackoilWellModelGeneric;
33class DeferredLogger;
34template<class Scalar> class GroupState;
35class SummaryState;
36template<typename Scalar, typename IndexTraits> class WellState;
37template<typename Scalar, typename IndexTraits> class WellGroupHelpers;
38
40template<typename Scalar, typename IndexTraits>
42{
43public:
44
45 constexpr static int waterPhaseIdx = IndexTraits::waterPhaseIdx;
46 constexpr static int oilPhaseIdx = IndexTraits::oilPhaseIdx;
47 constexpr static int gasPhaseIdx = IndexTraits::gasPhaseIdx;
48
50
53 : wellModel_(wellModel)
54 {}
55
57 bool checkGroupConstraints(const Group& group,
58 const int reportStepIdx,
59 DeferredLogger& deferred_logger) const;
60
62 void actionOnBrokenConstraints(const Group& group,
63 const Group::InjectionCMode& newControl,
64 const Phase& controlPhase,
65 GroupState<Scalar>& group_state,
66 DeferredLogger& deferred_logger) const;
67
69 bool actionOnBrokenConstraints(const Group& group,
70 const int reportStepIdx,
71 const Group::GroupLimitAction group_limit_action,
72 const Group::ProductionCMode& newControl,
73 const WellState<Scalar, IndexTraits>& well_state,
74 std::optional<std::string>& worst_offending_well,
75 GroupState<Scalar>& group_state,
76 DeferredLogger& deferred_logger) const;
77
79 bool updateGroupIndividualControl(const Group& group,
80 const int reportStepIdx,
81 const int max_number_of_group_switch,
82 const bool update_group_switching_log,
83 std::map<std::string, std::array<std::vector<Group::InjectionCMode>, 3>>& switched_inj,
84 std::map<std::string, std::vector<Group::ProductionCMode>>& switched_prod,
85 std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
86 GroupState<Scalar>& group_state,
88 DeferredLogger& deferred_logger) const;
89
90private:
92 std::pair<Group::InjectionCMode, Scalar>
93 checkGroupInjectionConstraints(const Group& group,
94 const int reportStepIdx,
95 const Phase& phase) const;
96
98 std::pair<Group::ProductionCMode, Scalar>
99 checkGroupProductionConstraints(const Group& group,
100 const int reportStepIdx,
101 DeferredLogger& deferred_logger) const;
102
104};
105
106} // namespace Opm
107
108#endif
Class for handling constraints for the blackoil well model.
Definition: BlackoilWellModelConstraints.hpp:42
bool actionOnBrokenConstraints(const Group &group, const int reportStepIdx, const Group::GroupLimitAction group_limit_action, const Group::ProductionCMode &newControl, const WellState< Scalar, IndexTraits > &well_state, std::optional< std::string > &worst_offending_well, GroupState< Scalar > &group_state, DeferredLogger &deferred_logger) const
Execute action on broken constraint for a production well group. Return true if a group control is ch...
static constexpr int oilPhaseIdx
Definition: BlackoilWellModelConstraints.hpp:46
bool checkGroupConstraints(const Group &group, const int reportStepIdx, DeferredLogger &deferred_logger) const
Check the constraints of a well group.
BlackoilWellModelConstraints(const BlackoilWellModelGeneric< Scalar, IndexTraits > &wellModel)
Constructor initializes reference to the well model.
Definition: BlackoilWellModelConstraints.hpp:52
void actionOnBrokenConstraints(const Group &group, const Group::InjectionCMode &newControl, const Phase &controlPhase, GroupState< Scalar > &group_state, DeferredLogger &deferred_logger) const
Execute action for broken constraint for an injection well group.
static constexpr int gasPhaseIdx
Definition: BlackoilWellModelConstraints.hpp:47
static constexpr int waterPhaseIdx
Definition: BlackoilWellModelConstraints.hpp:45
bool updateGroupIndividualControl(const Group &group, const int reportStepIdx, const int max_number_of_group_switch, const bool update_group_switching_log, std::map< std::string, std::array< std::vector< Group::InjectionCMode >, 3 > > &switched_inj, std::map< std::string, std::vector< Group::ProductionCMode > > &switched_prod, std::map< std::string, std::pair< std::string, std::string > > &closed_offending_wells, GroupState< Scalar > &group_state, WellState< Scalar, IndexTraits > &well_state, DeferredLogger &deferred_logger) const
Update the individual controls for wells in a group. Return true if a group control is changed.
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:95
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:41
Definition: WellGroupHelpers.hpp:51
Definition: WellState.hpp:66
Definition: blackoilboundaryratevector.hh:39