flownet.network_model._generate_connections module

flownet.network_model._generate_connections.__get_entity_str(df_coordinates: pandas.core.frame.DataFrame, coordinate: Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]) str

Helper function to find the name of the entity, if any, that is located at the specified coordinates.

Parameters
  • df_coordinates – Dataframe with entity coordinates

  • coordinate – Coordinate to look-up

Returns

Name of the entity or an empty string if no name is connected to the specified coordinates.

flownet.network_model._generate_connections._check_for_none_connectivity_amongst_entities(conn_matrix: numpy.ndarray)

Prints the number of flow nodes that are not connected to the FlowNet (rows or columns in conn_matrix with all zeros), and the total number of connections in the FlowNet (how many ones on either side of the diagonal).

Parameters

conn_matrix – matrix containing 0s and 1s explaining which nodes should be connected in FlowNet

Returns

Nothing

flownet.network_model._generate_connections._create_entity_connection_matrix(df_coordinates: pandas.core.frame.DataFrame, starts: List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], ends: List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], aquifer_starts: List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], aquifer_ends: List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], max_distance_fraction: float, max_distance: float, concave_hull_list: Optional[List[numpy.ndarray]] = None, n_non_reservoir_evaluation: Optional[int] = 10) pandas.core.frame.DataFrame

Converts the the coordinates given for starts and ends to the desired DataFrame format for simulation input.

Parameters
  • df_coordinates – original DataFrame version of coordinates

  • starts – List of coordinates for all the starting entities

  • ends – List of coordinates of all the end entities

  • aquifer_starts – List of coordinates for all aquifer starts

  • aquifer_ends – List of coordinates of all aquifer ends

  • max_distance_fraction – Fraction of longest connection distance to be removed

  • max_distance – Maximum distance between nodes, removed otherwise

  • concave_hull_list – List of boundingboxes per layer, i.e., numpy array with x, y, z min/max boundingboxes for each grid block

  • n_non_reservoir_evaluation – Number of equally spaced points along a connection to check fornon-reservoir.

Returns

Connection coordinate DataFrame on Flow desired format.

flownet.network_model._generate_connections._create_record(connection_pairs: numpy.ndarray, dist_matrix: numpy.ndarray, angle_threshold: float) List[Tuple[Any, ...]]

Creates a record of every connection_pairs triangle for which one of the angles is too small/large

Parameters
  • connection_pairs – All connection_pairs created through Delaunay triangulation

  • dist_matrix – Euclidean distance between coordinate pairs

  • angle_threshold – angle in Delaunay triangles for which to ignore connections

Returns

A record of undesirable connection_pairs.

flownet.network_model._generate_connections._generate_aquifer_connections(starts: List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], ends: List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], scheme: str, fraction: float = 0.1, delta_depth: float = 200) Tuple[List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]]]

Helper function to create aquifer connections

Parameters
  • starts – Flowtube starting coordinates

  • ends – Flowtube ending coordinates

  • scheme – Aquifer scheme to use (‘global’ or ‘individual’)

  • fraction – Fraction of deepest nodes to connection to an aquifer

  • delta_depth – depth difference between aquifer and connected node

Returns

lists of aquifer starting and ending coordinates.

flownet.network_model._generate_connections._generate_connections(df_coordinates: pandas.core.frame.DataFrame, configuration: Any, additional_flow_nodes: int, concave_hull_bounding_boxes: Optional[numpy.ndarray] = None) Tuple[List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]], List[Union[Tuple[float, float, float], List[float], Tuple[Any, ...]]]]

Uses MitchellBestCandidate and Delaunay triangulation to populate the reservoir with extra flow nodes and returns the start and end coordinates of all connections between wells and extra flow nodes.

Parameters
  • df_coordinates – coordinates on original DataFrame format

  • configuration – Flownet configuration yaml,

  • additional_flow_nodes – Number of additional flow nodes to generate

  • concave_hull_bounding_boxes – Numpy array with x, y, z min/max boundingboxes for each grid block

Returns

The tuple consisting of the start_coords and end_coords for connections.

flownet.network_model._generate_connections._is_angle_too_large(angle_threshold: float, side_a: float, side_b: float, side_c: float) bool

Function checks if there is an angle larger than a specified angle in degrees for a triangle with given side lengths

Parameters
  • angle_threshold – threshold angle in degrees

  • side_a – Length of side a

  • side_b – Length of side b

  • side_c – Length of side c

Returns

True if an angle larger than the specified angle

flownet.network_model._generate_connections._remove_long_connections(df_connections: pandas.core.frame.DataFrame, max_distance_fraction: float = 0, max_distance: float = 1000000000000.0) pandas.core.frame.DataFrame

Helper function to remove long connections.

Parameters
  • df_connections – Pandas dataframe with start point, end point and entity type

  • max_distance_fraction – Fraction of longest connections to drop. I.e., 0.1 will drop the 10% longest connections.

  • max_distance – Maximum length of a connection; connections longer than this value will be dropped.

Returns

Input DataFrame without long connections

flownet.network_model._generate_connections._remove_recorded_connections(record: List[Tuple[Any, ...]], conn_matrix: numpy.ndarray) numpy.ndarray

This function will take in a list of (i,j)/(j,i) addresses that should be removed = set to zero in a given Numpy array.

Parameters
  • record – List containing the addresses of elements in conn_matrix that should be removed

  • conn_matrix – matrix containing 0s and 1s explaining which nodes should be connected in FlowNet

Returns

Numpy array with recorded elements set to zero.

flownet.network_model._generate_connections._split_additional_flow_nodes(total_additional_nodes: int, concave_hull_list: List[numpy.ndarray]) List[int]

This function splits the additional_flow_nodes defined in the config over the layers. The division is based on the sum of the volume of the boundingboxes in the layer.

Parameters
  • total_additional_nodes – The total number of additional nodes to add to the model

  • concave_hull_list – List of boundingboxes per layer, i.e., numpy array with x, y, z min/max boundingboxes for each grid block

Returns

List of additional nodes per layer (len of list, same as number of layers)

flownet.network_model._generate_connections.create_connections(df_coordinates: pandas.core.frame.DataFrame, configuration: Any, concave_hull_list: Optional[List[numpy.ndarray]] = None) pandas.core.frame.DataFrame

Creates additional flow nodes to increase complexity of field simulation structure so that history-matching can be performed.

Takes in field-entity-coordinates and desired added complexity arguments and returns Flow format coordinate DataFrame.

Parameters
  • df_coordinates – Original structure of entity and X, Y, Z coords

  • configuration – FlowNet configuration yaml as dictionary

  • concave_hull_list – List of boundingboxes per layer, i.e., numpy array with x, y, z min/max boundingboxes for each grid block

Returns

Desired restructuring of start-end coordinates into separate columns, as per Flow needs.