#include <stdbool.h>
#include <opm/core/well_controls.h>
 
Go to the source code of this file. 
 |  
| struct Wells *  | create_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 int *sat_table_id, 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 Wells *  | clone_wells (const struct Wells *W) |  
|   |  
| bool  | wells_equal (const struct Wells *W1, const struct Wells *W2, bool verbose) |  
|   |  
 
Main OPM-Core well data structure along with functions to create, populate and destroy it.  
 
◆ WellType
Well type indicates desired/expected well behaviour.  
| Enumerator | 
|---|
 | INJECTOR  | Well is an injector  
 |  
| PRODUCER  | Well is a producer  
 |  
 
 
 
◆ add_well()
      
        
          | 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. 
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] | type | Type of well.  |  
    | [in] | depth_ref | Reference depth for well's BHP.  |  
    | [in] | nperf | Number of perforations.  |  
    | [in] | comp_frac | Injection fraction array (size equal to W->number_of_phases) or NULL.  |  
    | [in] | cells | Grid cells in which well is perforated. Should ideally be track ordered.  |  
    | [in] | WI | Well production index per perforation, or NULL.  |  
    | [in] | name | Name of new well. NULL if no name.  |  
    | [in] | allow_cf | Flag to determine whether crossflow is allowed or not.  |  
    | [in,out] | W | Existing set of wells to which new well will be added. |  
   
   
 
- Returns
 - Non-zero (true) if successful and zero otherwise. 
  
 
 
◆ append_well_controls()
      
        
          | 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] | type | Control type.  |  
    | [in] | target | Target value for the control.  |  
    | [in] | alq | Artificial lift quantity for control (for THP type only)  |  
    | [in] | vfp | VFP table number for control (for THP type only)  |  
    | [in] | distr | Array of size W->number_of_phases or NULL.  |  
    | [in] | well_index | Index of well to receive additional control.  |  
    | [in,out] | W | Existing set of well controls.  |  
   
   
 
- Returns
 - Non-zero (true) if successful and zero (false) otherwise. 
  
 
 
◆ clear_well_controls()
      
        
          | 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_index | Identity of particular well. Must be in [0 .. number_of_wells - 1]  
 . |  
    | [in,out] | W | Existing set of wells.  |  
   
   
 
 
 
◆ clone_wells()
      
        
          | struct Wells * clone_wells  | 
          ( | 
          const struct Wells *  | 
          W | ) | 
           | 
         
       
 
 
◆ create_wells()
      
        
          | 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] | nphases | Number of active phases in simulation scenario. |  
    | [in] | nwells | Expected number of wells in simulation scenario. Pass zero if the total number of wells is unknown. |  
    | [in] | nperf | Expected 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. 
  
 
 
◆ destroy_wells()
      
        
          | void destroy_wells  | 
          ( | 
          struct Wells *  | 
          W | ) | 
           | 
         
       
 
 
◆ set_current_control()
      
        
          | 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_index | Identity of particular well. Must be in [0 .. number_of_wells - 1]  
 . |  
    | [in] | current_control | Index of new control mode. |  
    | [in,out] | W | Existing set of wells.  |  
   
   
 
 
 
◆ wells_equal()
      
        
          | 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] | W1 | Existing set of wells.  |  
    | [in] | W2 | Existing set of wells. |  
    | [in] | verbose | Flag for whether or not to report which conditions do not hold. Use  to print transcript to stdout. |  
   
   
 
- Returns
 - Whether or not well structures 
W1 and W2 represent the same set of wells.   
 
 
 
  
 
    
     |