Field

class Field(path=None, config=None, logfile=None, encoding='auto', loglevel='INFO')[source]

Reservoir model.

Contains components of the reservoir model and preprocessing tools.

Parameters:
  • path (str, optional) – Path to source model files.

  • config (dict, optional) – Components and attributes to load.

  • logfile (str, optional) – Path to log file.

  • encoding (str, optional) – Files encoding. Set ‘auto’ to infer encoding from initial file block. Sometimes it might help to specify block size, e.g. ‘auto:3000’ will read first 3000 bytes to infer encoding.

  • loglevel (str, optional) – Log level to be printed while loading. Default to ‘INFO’.

property aquifers

Aquifers component.

property basename

Model filename without extention.

calculate_rates(wellnames=None, cf_aggregation='sum', multiprocessing=True, verbose=True)[source]

Calculate oil/water/gas rates for each well segment. NOTE: Rate calculation is supported only for three phase fluid with dissolved gas (

OIL, WATER, GAS, DISGAS). Eclipse style control is not supported.

Parameters:
  • wellnames (list of str) – Wellnames for rates calculation. If None, all wells are included. Default None.

  • cf_aggregation (str, 'sum' or 'eucl') – The way of aggregating cf projection (‘sum’ - sum, ‘eucl’ - Euclid norm).

  • multiprocessing (bool) – Use multiprocessing for rates calculation. Default True.

  • verbose (bool) – Print a number of currently processed wells (if multiprocessing=False). Default True.

Returns:

model – Reservoir model with computed rates.

Return type:

Field

property components

Model components.

copy()[source]

Returns a deepcopy of Field.

dump(path=None, mode='a', data=True, results=True, title=None, **kwargs)[source]

Dump model components.

Parameters:
  • path (str) – Common path for output files. If None path will be inherited from model path.

  • mode (str) – Mode to open file. Affects only HDF5 dump. ‘w’: write, a new file is created (an existing file with the same name would be deleted). ‘a’: append, an existing file is opened for reading and writing, and if the file does not exist it is created. Default to ‘a’.

  • data (bool) – Dump initial model data. No effect for HDF5 or VTU output. Default True.

  • results (bool) – Dump calculated results. No effect for HDF5 or VTU output. Default True.

  • title (str) – Model name. No effect for HDF5 or VTU output.

  • kwargs (misc) – Any additional named arguments to dump.

Returns:

out – Field unchanged.

Return type:

Field

property faults

Faults component.

get_vtk_dataset()[source]

Create vtk dataset with data from rock and states components. Grid is represented in unstructured form.

Returns:

vtk dataset with states and rock data.

Return type:

vtk.vtkUnstructuredGrid

property grid

Grid component.

history_to_results()[source]

Convert history to results.

items()[source]

Returns pairs of components’s names and instance.

load(raise_errors=False, include_binary=True, spatial=True, fill_na=0.0)[source]

Load model components.

Parameters:
  • raise_errors (bool) – Error handling mode. If True, errors will be raised and stop loading. If False, errors will be printed but do not stop loading.

  • include_binary (bool) – Read data from binary files in RESULTS folder. Default to True.

  • spatial (bool) – Return Field components is spatial state.

  • fill_na (float) – Value to fill at non-active cells. Default to 0.

Returns:

out – Field with loaded components.

Return type:

Field

property meta

“Model meta data.

property path

Path to original model.

ravel(only_active=True)[source]

Ravel data in spatial components.

Parameters:

only_active (bool) – Strip non-active cells fron state vectors. Default is True.

Returns:

out – Field with reshaped spatial components.

Return type:

Field

property result_dates

Result dates, actual if present, target otherwise.

property rock

Rock component.

set_state(**kwargs)[source]

State setter.

show(attr=None, thresholding=False, slicing=False, timestamp=None, use_only_active=True, cell_size=None, scaling=True, cmap=None, notebook=False, theme='default', show_edges=True, faults_color='red', show_labels=True)[source]

Field visualization.

Parameters:
  • attr (str or None) – Attribute of the grid to show. If None, ACTNUM will be shown.

  • thresholding (bool) – Show slider for thresholding. Cells with attribute value less than threshold will not be shown. Default False.

  • slicing (bool) – Show by slices. Default False.

  • timestamp (int or None) – The timestamp to show. Meaningful only for sequential attributes (States). Has no effect given non-sequential attributes.

  • use_only_active (bool) – Corner point grid creation using only active cells. Default to True.

  • cell_size (int) – Cell size for orthogonal uniform grid.

  • scaling (bool, list or tuple) – The ratio of the axes in case of iterable, if True then it’s (1, 1, 1), if False then no scaling is applied. Default True.

  • cmap (object) – Matplotlib, Colorcet, cmocean, or custom colormap

  • notebook (bool) – When True, the resulting plot is placed inline a jupyter notebook. Assumes a jupyter console is active. Automatically enables off_screen.

  • theme (str) – PyVista theme, e.g. ‘default’, ‘dark’, ‘document’, ‘ParaView’. See https://docs.pyvista.org/examples/02-plot/themes.html for more options.

  • show_edges (bool) – Shows the edges of a mesh. Default True.

  • faults_color (str) – Corol to show faults. Default ‘red’.

  • show_labels (bool) – Show x, y, z axis labels. Default True.

spatial_cf_and_perf(date_range=None, mode=None)[source]

Get model’s connection factors and perforation ratios in a spatial form.

Parameters:
  • date_range (tuple) – Minimal and maximal dates for events.

  • mode (str, None) – If not None, pick the blocks only with specified mode.

Returns:

  • connection_factors (np.array)

  • perf_ratio (np.array)

spatial_well_control(attrs, date_range=None, fill_shut=0.0, fill_outside=0.0)[source]

Get the model’s control in a spatial form.

Parameters:
  • attrs (tuple or list) – Conrol attributes to get data from.

  • date_range (tuple) – Minimal and maximal dates for control events.

  • fill_shut (float) – Value to fill shutted perforations.

  • fill_outside – Value to fill non-perforated cells.

Returns:

control

Return type:

np.array

property start

Model start time in a datetime format.

property state

“Field state.

property states

States component.

property tables

Tables component.

to_spatial(fill_na=0.0)[source]

Bring data to spatial state.

Parameters:

fill_na (float) – Value to fill at non-active cells. Default to 0.

Returns:

out – Field in spatial representation.

Return type:

Field

well_mask

Get the model’s well mask in a spatial form.

Returns:

well_mask – Array with well-names in cells which are registered as well-blocks and empty strings everywhere else.

Return type:

np.array

property wells

Wells component.