All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
wells.h
Go to the documentation of this file.
1 /*
2  Copyright 2012 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_H_INCLUDED
21 #define OPM_WELLS_H_INCLUDED
22 
23 #include <stdbool.h>
24 #include <opm/core/well_controls.h>
25 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 enum WellType {
44 };
45 
46 
50 struct Wells
51 {
58  enum WellType *type;
59 
63  double *depth_ref;
64 
73  double *comp_frac;
74 
82 
87  int *well_cells;
88 
92  double *WI;
93 
98 
102  struct WellControls **ctrls;
103 
107  char **name;
108 
113  int *allow_cf;
114 
118  void *data;
119 
120 };
121 
122 
137 {
141  double *wdp;
142 
146  double *A;
147 
152  double *phasemob;
153 };
154 
179 struct Wells *
180 create_wells(int nphases, int nwells, int nperf);
181 
182 
205 int
206 add_well(enum WellType type ,
207  double depth_ref,
208  int nperf ,
209  const double *comp_frac,
210  const int *cells ,
211  const double *WI ,
212  const int *sat_table_id,
213  const char *name ,
214  int allow_cf ,
215  struct Wells *W );
216 
217 
238 int
240  double target,
241  double alq,
242  int vfp,
243  const double *distr,
244  int well_index,
245  struct Wells *W);
246 
247 
264 void
265 set_current_control(int well_index, int current_control, struct Wells *W);
266 
267 
279 void
280 clear_well_controls(int well_index, struct Wells *W);
281 
282 
291 void
292 destroy_wells(struct Wells *W);
293 
294 
304 struct Wells *
305 clone_wells(const struct Wells *W);
306 
307 
344 bool
345 wells_equal(const struct Wells *W1, const struct Wells *W2 , bool verbose);
346 
347 
348 #ifdef __cplusplus
349 }
350 #endif
351 
352 #endif /* OPM_WELLS_H_INCLUDED */
API for managing sets of well controls.
char ** name
Well names.
Definition: wells.h:107
Controls for a single well.
Definition: well_controls.c:72
int append_well_controls(enum WellControlType type, double target, double alq, int vfp, const double *distr, int well_index, struct Wells *W)
Append operational constraint to an existing well.
Definition: wells.c:440
double * wdp
Gravity potentials.
Definition: wells.h:141
int * well_cells
Array of perforation cell indices.
Definition: wells.h:87
void set_current_control(int well_index, int current_control, struct Wells *W)
Set the current/active control for a single well.
double * depth_ref
Array of well reference depths.
Definition: wells.h:63
int number_of_wells
Number of wells.
Definition: wells.h:52
int * allow_cf
Array of flags indicating whether crossflow is allowed or not if allow_cf[w] == 0 (false) then crossf...
Definition: wells.h:113
double * A
Volumes to surface-components matrix, A = RB^{-1}.
Definition: wells.h:146
Data structure aggregating static information about all wells in a scenario.
Definition: wells.h:50
void clear_well_controls(int well_index, struct Wells *W)
Clear all controls from a single well.
bool wells_equal(const struct Wells *W1, const struct Wells *W2, bool verbose)
Compare well structures for equality.
Well is an injector.
Definition: wells.h:42
int * well_connpos
Array of indices into well_cells (and WI).
Definition: wells.h:81
struct Wells * create_wells(int nphases, int nwells, int nperf)
Construct a Wells object initially capable of managing a given number of wells and total number of we...
Data structure aggregating dynamic information about all wells in a scenario.
Definition: wells.h:136
double * comp_frac
Component fractions for each well.
Definition: wells.h:73
void * data
Internal management structure.
Definition: wells.h:118
int * sat_table_id
Saturation table number , same size and structure as well_cells.
Definition: wells.h:97
WellType
Well type indicates desired/expected well behaviour.
Definition: wells.h:41
enum WellType * type
Array of well types.
Definition: wells.h:58
int number_of_phases
Number of phases.
Definition: wells.h:53
WellControlType
Definition: well_controls.h:34
Well is a producer.
Definition: wells.h:43
double * phasemob
Phase mobilities for all perforations, stored consecutively with the phase index cycling the most rap...
Definition: wells.h:152
struct Wells * clone_wells(const struct Wells *W)
Create a deep-copy (i.e., clone) of an existing Wells object, including its controls.
void destroy_wells(struct Wells *W)
Wells object destructor.
struct WellControls ** ctrls
Well controls, one set of controls for each well.
Definition: wells.h:102
double * WI
Well productivity index, same size and structure as well_cells.
Definition: wells.h:92
int add_well(enum WellType type, double depth_ref, int nperf, const double *comp_frac, const int *cells, const double *WI, const int *sat_table_id, const char *name, int allow_cf, struct Wells *W)
Append a new well to an existing Wells object.
Definition: wells.c:365