FlowDiagnostics#

class pyflowdiagnostics.flow_diagnostics.FlowDiagnostics(file_path: str)[source]#

Bases: object

Computes and analyzes flow diagnostics from reservoir simulation results.

This class reads simulation outputs, calculates time-of-flight (TOF), tracer concentrations, flow allocation factors, and other diagnostic parameters.

input_file_path#

Path to the simulation input file.

Type:

str

output_dir#

Directory where output files are saved.

Type:

str

grid#

Grid object representing the reservoir grid.

Type:

Grid

time_step_id#

Current time step ID being processed.

Type:

Optional[int]

wells#

Dictionary of Well objects, keyed by well name.

Type:

dict[str, Well]

injectors#

List of injector Well objects.

Type:

list[Well]

producers#

List of producer Well objects.

Type:

list[Well]

binary_reader#

Instance of the Eclipse or CMG binary file reader.

Type:

EclReader | CmgReader

Methods Summary

compute_F_and_Phi(pv, tof)

Computes the flow-capacity/storage-capacity diagram (F, Phi).

compute_Lorenz(F, Phi)

Computes the Lorenz coefficient, a measure of heterogeneity.

compute_partition(C)

Computes the partition of grid cells based on tracer concentrations.

compute_sweep(F, Phi)

Computes sweep efficiency versus dimensionless time (PVI).

compute_well_pair_ids(partI, partP)

Computes the partition of grid cells based on tracer concentrations.

execute(time_step_id)

Executes the flow diagnostics analysis for a given time step.

Methods Documentation

static compute_F_and_Phi(pv: ndarray, tof: ndarray) tuple[ndarray, ndarray][source]#

Computes the flow-capacity/storage-capacity diagram (F, Phi).

Parameters:
  • pv (np.ndarray) – A 1D NumPy array of pore volumes for each grid cell.

  • tof (np.ndarray) – A 2D NumPy array of time-of-flight values from injector and producer, per cell. Should have two columns.

Returns:

A tuple containing:
  • F (np.ndarray): Flow capacity (cumulative flux).

  • Phi (np.ndarray): Storage capacity (cumulative pore volume).

Return type:

tuple[np.ndarray, np.ndarray]

static compute_Lorenz(F, Phi)[source]#

Computes the Lorenz coefficient, a measure of heterogeneity.

Parameters:
  • F (np.ndarray) – Flow capacity.

  • Phi (np.ndarray) – Storage capacity.

Returns:

The Lorenz coefficient.

Return type:

float

static compute_partition(C)[source]#

Computes the partition of grid cells based on tracer concentrations.

This static method determines which source well (injector, or producer with a reversed flux field)

has the highest tracer concentration in each grid cell.

Parameters:

C (np.ndarray) – A 2D NumPy array of tracer concentrations. The shape should be (number of grid cells, number of injectors).

Returns:

A 1D NumPy array representing the partition. Each element

corresponds to a grid cell and indicates the index (1-based) of the source well with the maximum absolute tracer concentration. NaN values are assigned where the maximum concentration is 0 or NaN.

Return type:

np.ndarray

static compute_sweep(F: ndarray, Phi: ndarray) tuple[ndarray, ndarray][source]#

Computes sweep efficiency versus dimensionless time (PVI).

Parameters:
  • F (np.ndarray) – Flow capacity.

  • Phi (np.ndarray) – Storage capacity.

Returns:

A tuple containing:
  • Ev (np.ndarray): Sweep efficiency.

  • tD (np.ndarray): Dimensionless time (PVI).

Return type:

tuple[np.ndarray, np.ndarray]

static compute_well_pair_ids(partI, partP)[source]#

Computes the partition of grid cells based on tracer concentrations.

This static method determines well pair ids at each cell, based on injector and producer partitions.

Parameters:
  • partI (np.ndarray) – A 2D NumPy array of partition ids (injectors).

  • partP (np.ndarray) – A 2D NumPy array of partition ids (producers).

Returns:

A 1D NumPy array representing the well pair ids.

Return type:

np.ndarray

execute(time_step_id: int) None[source]#

Executes the flow diagnostics analysis for a given time step.

Parameters:

time_step_id (int) – The time step ID to process.