Wells.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
20#ifndef OPM_WELLS_HEADER_INCLUDED
21#define OPM_WELLS_HEADER_INCLUDED
22
23#include <opm/common/ErrorMacros.hpp>
24#include <opm/core/utility/SparseTable.hpp>
25#include <opm/parser/eclipse/Deck/Deck.hpp>
26#include <dune/common/fvector.hh>
27
28#include <vector>
29
30namespace Opm
31{
32
33
34
37 class Wells
38 {
39 public:
40 void init(Opm::DeckConstPtr deck);
41
42 // Well-centric interface.
43 int numWells() const;
45 WellType type(int wellnum) const;
47 WellControl control(int wellnum) const;
48 double target(int wellnum) const;
49 double referenceDepth(int wellnum) const;
50 int numPerforations(int wellnum) const;
51 int wellCell(int wellnum, int perfnum) const;
52 double wellIndex(int wellnum, int perfnum) const;
53 double pressureDelta(int wellnum, int perfnum) const;
54
55 // Updating rates and pressures after pressure solve.
56 void update(int num_cells,
57 const std::vector<double>& well_pressures,
58 const std::vector<double>& well_fluxes);
59
60 // Cell-centric interface. Mostly used by transport solver.
61 double perforationPressure(int cell) const;
62 double wellToReservoirFlux(int cell) const;
63 Dune::FieldVector<double, 3> injectionMixture(int cell) const;
64
65 private:
66 struct WellData { WellType type; WellControl control; double target; double reference_bhp_depth; };
67 std::vector<WellData> well_data_;
68 struct PerfData { int cell; double well_index; double pdelta; };
69 Opm::SparseTable<PerfData> perf_data_;
70 };
71
72
73 // ------------ Method implementations --------------
74
75 inline void Wells::init(Opm::DeckConstPtr deck)
76 {
77 }
78
79 inline int Wells::numWells() const
80 {
81 return well_data_.size();
82 }
83
84 inline Wells::WellType Wells::type(int wellnum) const
85 {
86 return well_data_[wellnum].type;
87 }
88
89 inline Wells::WellControl Wells::control(int wellnum) const
90 {
91 return well_data_[wellnum].control;
92 }
93
94 inline double Wells::target(int wellnum) const
95 {
96 return well_data_[wellnum].target;
97 }
98
99 inline double Wells::referenceDepth(int wellnum) const
100 {
101 return well_data_[wellnum].reference_bhp_depth;
102 }
103
104 inline int Wells::numPerforations(int wellnum) const
105 {
106 return perf_data_[wellnum].size();
107 }
108
109 inline int Wells::wellCell(int wellnum, int perfnum) const
110 {
111 return perf_data_[wellnum][perfnum].cell;
112 }
113
114 inline double Wells::wellIndex(int wellnum, int perfnum) const
115 {
116 return perf_data_[wellnum][perfnum].well_index;
117 }
118
119 inline double Wells::pressureDelta(int wellnum, int perfnum) const
120 {
121 return perf_data_[wellnum][perfnum].pdelta;
122 }
123
124 inline void Wells::update(int /*num_cells*/,
125 const std::vector<double>& /*well_pressures*/,
126 const std::vector<double>& /*well_fluxes*/)
127 {
128 }
129
130 inline double Wells::perforationPressure(int cell) const
131 {
132 OPM_THROW(std::runtime_error, "Not implemented");
133 return 0.0;
134 }
135
136 inline double Wells::wellToReservoirFlux(int cell) const
137 {
138 return 0.0;
139 }
140
141 inline Dune::FieldVector<double, 3> Wells::injectionMixture(int cell) const
142 {
143 OPM_THROW(std::runtime_error, "Not implemented");
144 return Dune::FieldVector<double, 3>(0.0);
145 }
146
147
148} // namespace Opm
149
150
151#endif // OPM_WELLS_HEADER_INCLUDED
Definition: Wells.hpp:38
double wellIndex(int wellnum, int perfnum) const
Definition: Wells.hpp:114
double pressureDelta(int wellnum, int perfnum) const
Definition: Wells.hpp:119
WellType
Definition: Wells.hpp:44
@ Producer
Definition: Wells.hpp:44
@ Injector
Definition: Wells.hpp:44
double target(int wellnum) const
Definition: Wells.hpp:94
double referenceDepth(int wellnum) const
Definition: Wells.hpp:99
Dune::FieldVector< double, 3 > injectionMixture(int cell) const
Definition: Wells.hpp:141
WellType type(int wellnum) const
Definition: Wells.hpp:84
WellControl control(int wellnum) const
Definition: Wells.hpp:89
int numWells() const
Definition: Wells.hpp:79
void update(int num_cells, const std::vector< double > &well_pressures, const std::vector< double > &well_fluxes)
Definition: Wells.hpp:124
WellControl
Definition: Wells.hpp:46
@ Rate
Definition: Wells.hpp:46
@ Pressure
Definition: Wells.hpp:46
int numPerforations(int wellnum) const
Definition: Wells.hpp:104
void init(Opm::DeckConstPtr deck)
Definition: Wells.hpp:75
int wellCell(int wellnum, int perfnum) const
Definition: Wells.hpp:109
double perforationPressure(int cell) const
Definition: Wells.hpp:130
double wellToReservoirFlux(int cell) const
Definition: Wells.hpp:136
Definition: BlackoilFluid.hpp:32