WellCollection.hpp
Go to the documentation of this file.
1/*
2 Copyright 2011 SINTEF ICT, Applied Mathematics.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef OPM_WELLCOLLECTION_HPP
20#define OPM_WELLCOLLECTION_HPP
21
22#include <vector>
23#include <memory>
24
26#include <opm/core/grid.h>
28
29#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
30#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
31
32namespace Opm
33{
34
36 {
37 public:
38
39 void addField(const Group& fieldGroup, size_t timeStep, const PhaseUsage& phaseUsage);
40
41 void addWell(const Well* wellChild, size_t timeStep, const PhaseUsage& phaseUsage);
42
43 void addGroup(const Group& groupChild, std::string parent_name,
44 size_t timeStep, const PhaseUsage& phaseUsage);
45
50 void addChild(std::shared_ptr<WellsGroupInterface>& child_node,
51 const std::string& parent);
52
54 void addChild(std::shared_ptr<WellsGroupInterface>& child_node);
55
78 bool conditionsMet(const std::vector<double>& well_bhp,
79 const std::vector<double>& well_reservoirrates_phase,
80 const std::vector<double>& well_surfacerates_phase);
81
83 void setWellsPointer(Wells* wells);
84
86 const std::vector<WellNode*>& getLeafNodes() const;
87
91 WellsGroupInterface* findNode(const std::string& name);
92
96 const WellsGroupInterface* findNode(const std::string& name) const;
97
98
99 WellNode& findWellNode(const std::string& name) const;
100
101
104
114 void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
115 const std::vector<double>& well_surfacerates_phase);
116
117
119 void applyVREPGroupControls(const std::vector<double>& well_voidage_rates,
120 const std::vector<double>& conversion_coeffs);
121
126
129
132
134 void updateWellTargets(const std::vector<double>& well_rates);
135
137 bool havingVREPGroups() const;
138
140 bool groupControlActive() const;
141
144
146 // It is considered converged if eitehr the group targets are matched or the group targets are not matched while the wells are
147 // running under their own limits so that they can not produce more
148 // It is considered not converged if the group targets are not matched while some of the wells are still running under group control
149 // The strategy may need to be adjusted when more complicated multi-layered group control situation applied, not sure about thatyet.
150 bool groupTargetConverged(const std::vector<double>& well_rates) const;
151
152
155 const PhaseUsage& phase_usage,
156 const std::vector<double>& well_potentials) const;
157
158
160
161 private:
162 // To account for the possibility of a forest
163 std::vector<std::shared_ptr<WellsGroupInterface> > roots_;
164
165 // This will be used to traverse the bottom nodes.
166 std::vector<WellNode*> leaf_nodes_;
167
168 bool having_vrep_groups_ = false;
169
170 bool group_control_active_ = false;
171
172 // This is used to mark whether apply or update the group control
173 bool group_control_applied_ = false;
174 };
175
176} // namespace Opm
177
178#endif /* OPM_WELLCOLLECTION_HPP */
179
Definition: WellCollection.hpp:36
WellNode & findWellNode(const std::string &name) const
void addChild(std::shared_ptr< WellsGroupInterface > &child_node)
Adds the node to the collection (as a root node)
void addChild(std::shared_ptr< WellsGroupInterface > &child_node, const std::string &parent)
WellsGroupInterface * findNode(const std::string &name)
void addGroup(const Group &groupChild, std::string parent_name, size_t timeStep, const PhaseUsage &phaseUsage)
const std::vector< WellNode * > & getLeafNodes() const
void applyGroupControls()
Applies all group controls (injection and production)
const WellsGroupInterface * findNode(const std::string &name) const
bool groupTargetConverged(const std::vector< double > &well_rates) const
Whether the group target is converged.
void setWellsPointer(Wells *wells)
Adds the well pointer to each leaf node (does not take ownership).
bool groupControlApplied() const
Whether we have applied the group control.
void updateWellTargets(const std::vector< double > &well_rates)
Updating the well targets based on the well rates.
void setGuideRatesWithPotentials(const Wells *wells, const PhaseUsage &phase_usage, const std::vector< double > &well_potentials) const
Setting the guide rates with well potentials.
void addField(const Group &fieldGroup, size_t timeStep, const PhaseUsage &phaseUsage)
bool requireWellPotentials() const
void applyExplicitReinjectionControls(const std::vector< double > &well_reservoirrates_phase, const std::vector< double > &well_surfacerates_phase)
void applyVREPGroupControls(const std::vector< double > &well_voidage_rates, const std::vector< double > &conversion_coeffs)
applying VREP group control based on calculated voidage rates
bool havingVREPGroups() const
When we have VREP group, we need to update the targets based on the updated production voidage rates ...
bool needUpdateProductionTargets() const
Checking whehter need to update the targets for the production wells.
bool conditionsMet(const std::vector< double > &well_bhp, const std::vector< double > &well_reservoirrates_phase, const std::vector< double > &well_surfacerates_phase)
bool needUpdateInjectionTargets() const
Checking whether need to update the targets for the injection wells.
bool needUpdateWellTargets() const
void addWell(const Well *wellChild, size_t timeStep, const PhaseUsage &phaseUsage)
bool groupControlActive() const
Whether we have active group control.
Definition: WellsGroup.hpp:397
Definition: WellsGroup.hpp:55
Definition: AnisotropicEikonal.hpp:44
Definition: BlackoilPhases.hpp:44
Definition: wells.h:51