Grid#

class pyflowdiagnostics.grid.Grid(dimens: tuple, porv: ndarray, dp_flag: int, dict_NNC: dict)[source]#

Bases: object

Manages grid properties and fluxes.

Stores grid dimensions, pore volume, active cell information, and handles flux calculations. Supports dual porosity and non-neighboring connections (NNCs).

nx#

Number of grid cells in the x-direction.

Type:

int

ny#

Number of grid cells in the y-direction.

Type:

int

nz#

Number of grid cells in the z-direction.

Type:

int

nn#

Total number of grid cells.

Type:

int

num_max_dims#

Maximum number of dimensions (typically 3).

Type:

int

num_max_phases#

Maximum number of fluid phases (typically 3).

Type:

int

single_layer#

True if the grid has only one layer (nz == 1 or nz==2 in DP).

Type:

bool

porv#

Pore volume array.

Type:

np.ndarray

actnum#

Active cell mask (1 for active cells, 0 otherwise).

Type:

np.ndarray

actnum_bool#

Boolean array indicating active cells.

Type:

np.ndarray

num_active_cells#

Number of active grid cells.

Type:

int

dual_poro#

True if dual porosity is enabled.

Type:

bool

NNC#

True if non-neighboring connections (NNCs) are enabled.

Type:

bool

_flux_keys#

List of flux keys for standard connections.

Type:

list

_NNC_flux_keys#

List of flux keys for NNC connections.

Type:

list

_q_xyz#

Array of phase fluxes in all directions.

Type:

np.ndarray

_Qx, _Qy, _Qz

Flux arrays in x, y, and z directions.

Type:

np.ndarray

_conx#

Connection matrix.

Type:

np.ndarray

_valid_conx_idx#

Boolean array indicating valid connections.

Type:

np.ndarray

_Qxyz_flattened#

Flattened array of all valid fluxes.

Type:

np.ndarray

Methods Summary

compute_flux_reservoir_cond(d_fluxes, d_inv_fvf)

Computes fluxes in reservoir condition using fluxes in surface condition and formation volume factors.

compute_outflow(I, J, K)

Computes outflow at a given grid cell (I, J, K).

compute_total_fluxes(d_fluxes[, d_NNC_fluxes])

Computes and stores total fluxes, including NNC fluxes.

get_NNC_flux_keys()

Returns the flux keys for NNC connections, if applicable.

get_connections()

Returns the connection matrix.

get_flux_keys()

Returns the flux keys for standard connections.

get_inv_fvf_keys()

Returns the inverse FVF keys.

get_total_flux_flattened()

Returns the total flux.

ijk_from_I_J_K(I, J, K)

Calculates the ijk index from I, J, K indices.

Methods Documentation

compute_flux_reservoir_cond(d_fluxes: dict, d_inv_fvf: dict) dict[source]#

Computes fluxes in reservoir condition using fluxes in surface condition and formation volume factors.

Parameters:
  • d_fluxes (dict) – Dictionary of flux data for standard connections.

  • d_inv_fvf (dict) – Dictionary of inverse formation volume factors

Returns:

fluxes in reservoir condition.

Return type:

dict

compute_outflow(I: int, J: int, K: int) float[source]#

Computes outflow at a given grid cell (I, J, K).

Parameters:
  • I (int) – I-index of the grid cell.

  • J (int) – J-index of the grid cell.

  • K (int) – K-index of the grid cell.

Returns:

Outflow at the grid cell. Positive: injection, negative: production.

Return type:

float

compute_total_fluxes(d_fluxes: dict, d_NNC_fluxes: dict = None) None[source]#

Computes and stores total fluxes, including NNC fluxes.

Parameters:
  • d_fluxes (dict) – Dictionary of flux data for reservoir connections.

  • d_NNC_fluxes (dict, optional) – Dictionary of flux data for NNC connections. Defaults to None.

get_NNC_flux_keys()[source]#

Returns the flux keys for NNC connections, if applicable.

Returns:

List of NNC flux keys, or None if NNCs are not enabled.

Return type:

list or None

get_connections()[source]#

Returns the connection matrix.

Returns:

The connection matrix.

Return type:

np.ndarray

get_flux_keys()[source]#

Returns the flux keys for standard connections.

Returns:

List of flux keys.

Return type:

list

get_inv_fvf_keys()[source]#

Returns the inverse FVF keys.

Returns:

List of inverse FVF keys.

Return type:

list

get_total_flux_flattened()[source]#

Returns the total flux.

Returns:

The flattened total flux.

Return type:

np.ndarray

ijk_from_I_J_K(I: int, J: int, K: int) int[source]#

Calculates the ijk index from I, J, K indices.

Parameters:
  • I (int) – I-index of the grid cell.

  • J (int) – J-index of the grid cell.

  • K (int) – K-index of the grid cell.

Returns:

ijk index of the grid cell.

Return type:

int