wells.h File Reference
#include <stdbool.h>
#include <opm/core/well_controls.h>
Include dependency graph for wells.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Wells
 
struct  CompletionData
 

Enumerations

enum  WellType { INJECTOR, PRODUCER }
 

Functions

struct Wellscreate_wells (int nphases, int nwells, int nperf)
 
int add_well (enum WellType type, double depth_ref, int nperf, const double *comp_frac, const int *cells, const double *WI, const char *name, int allow_cf, struct Wells *W)
 
int append_well_controls (enum WellControlType type, double target, double alq, int vfp, const double *distr, int well_index, struct Wells *W)
 
void set_current_control (int well_index, int current_control, struct Wells *W)
 
void clear_well_controls (int well_index, struct Wells *W)
 
void destroy_wells (struct Wells *W)
 
struct Wellsclone_wells (const struct Wells *W)
 
bool wells_equal (const struct Wells *W1, const struct Wells *W2, bool verbose)
 

Detailed Description

Main OPM-Core well data structure along with functions to create, populate and destroy it.

Enumeration Type Documentation

enum WellType

Well type indicates desired/expected well behaviour.

Enumerator
INJECTOR 

Well is an injector

PRODUCER 

Well is a producer

Function Documentation

int add_well ( enum WellType  type,
double  depth_ref,
int  nperf,
const double *  comp_frac,
const int *  cells,
const double *  WI,
const char *  name,
int  allow_cf,
struct Wells W 
)

Append a new well to an existing Wells object.

Increments W->number_of_wells by one if successful. The new well does not include operational constraints. Such information is specified using function append_well_controls(). The current control index is set to -1 (invalid).

Parameters
[in]typeType of well.
[in]depth_refReference depth for well's BHP.
[in]nperfNumber of perforations.
[in]comp_fracInjection fraction array (size equal to W->number_of_phases) or NULL.
[in]cellsGrid cells in which well is perforated. Should ideally be track ordered.
[in]WIWell production index per perforation, or NULL.
[in]nameName of new well. NULL if no name.
[in]allow_cfFlag to determine whether crossflow is allowed or not.
[in,out]WExisting set of wells to which new well will be added.
Returns
Non-zero (true) if successful and zero otherwise.
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.

Increments ctrl->num by one if successful. Introducing a new operational constraint does not affect the well's notion of the currently active constraint represented by ctrl->current. Note that *_RATE controls now require a phase distribution array to be associated with the control, see WellControls.

Parameters
[in]typeControl type.
[in]targetTarget value for the control.
[in]alqArtificial lift quantity for control (for THP type only)
[in]vfpVFP table number for control (for THP type only)
[in]distrArray of size W->number_of_phases or NULL.
[in]well_indexIndex of well to receive additional control.
[in,out]WExisting set of well controls.
Returns
Non-zero (true) if successful and zero (false) otherwise.
void clear_well_controls ( int  well_index,
struct Wells W 
)

Clear all controls from a single well.

Does not affect the control set capacity.

Parameters
[in]well_indexIdentity of particular well. Must be in
1 [0 .. number_of_wells - 1]
.
[in,out]WExisting set of wells.
struct Wells* clone_wells ( const struct Wells W)

Create a deep-copy (i.e., clone) of an existing Wells object, including its controls.

Parameters
[in]WExisting Wells object.
Returns
Complete clone of the input object. Dispose of resources using function destroy_wells() when no longer needed. Returns NULL in case of allocation failure.
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 well connections (perforations).

Function add_well() is used to populate the Wells object. No reallocation occurs in function add_well() as long as the initially indicated capacities are sufficient. Call function destroy_wells() to dispose of the Wells object and its allocated memory resources.

Parameters
[in]nphasesNumber of active phases in simulation scenario.
[in]nwellsExpected number of wells in simulation scenario. Pass zero if the total number of wells is unknown.
[in]nperfExpected total number of well connections (perforations) for all wells in simulation scenario. Pass zero if the total number of well connections is unknown.
Returns
A valid Wells object with no wells if successful, and NULL otherwise.
void destroy_wells ( struct Wells W)

Wells object destructor.

Disposes of all resources managed by the Wells object.

The Wells object must be built using function create_wells() and subsequently populated using function add_well().

void set_current_control ( int  well_index,
int  current_control,
struct Wells W 
)

Set the current/active control for a single well.

The new control ID must refer to a previously defined control mode. Total number of defined control modes available through function well_controls_get_num().

Parameters
[in]well_indexIdentity of particular well. Must be in
1 [0 .. number_of_wells - 1]
.
[in]current_controlIndex of new control mode.
[in,out]WExisting set of wells.
bool wells_equal ( const struct Wells W1,
const struct Wells W2,
bool  verbose 
)

Compare well structures for equality.

Two sets of wells are equal if all of the following conditions hold

  • They have the same number of wells
  • They have the same number of completions/connections
  • They specify the same number of phases
  • Individual wells with corresponding well IDs have the same names (including both being NULL).
  • Individual wells with corresponding well IDs have the same completions
  • Individual wells with corresponding well IDs have the same well types
  • Individual wells with corresponding well IDs specify the same reference depths
  • Individual wells with corresponding well IDs have the same set of defined and active operational constraints as determined by function well_controls_equal()
Parameters
[in]W1Existing set of wells.
[in]W2Existing set of wells.
[in]verboseFlag for whether or not to report which conditions do not hold. Use
1 verbose =
2  true
to print transcript to stdout.
Returns
Whether or not well structures W1 and W2 represent the same set of wells.