OPM Simulators Python Documentation

class opm.simulators.BlackOilSimulator

The SummaryState class - this is where the current summary results of the simulator are stored. The SummaryState class has methods to get hold of well, group and general variables.

opm.simulators.BlackOilSimulator.__init__(deck_filename: str) None

Constructor using a deck file name.

Parameters:

deck_filename (str) – The file name of the deck to be used for the simulation.

opm.simulators.BlackOilSimulator.__init__(deck: Deck, state: EclipseState, schedule: Schedule, summary_config: SummaryConfig) None

Constructor using Deck, EclipseState, Schedule, and SummaryConfig objects.

Parameters:
  • deck (Deck) – Deck object.

  • state (EclipseState) – EclipseState object.

  • schedule (Schedule) – Schedule object.

  • summary_config (SummaryConfig) – SummaryConfig object.

opm.simulators.BlackOilSimulator.advance(report_step: int) None

Advances the simulation to a specific report step.

Parameters:

report_step (int) – Target report step to advance to.

opm.simulators.BlackOilSimulator.check_simulation_finished() bool

Checks if the simulation has finished.

Returns:

True if the simulation is finished, False otherwise.

opm.simulators.BlackOilSimulator.current_step() int

Gets the current simulation step.

Returns:

The current step number.

opm.simulators.BlackOilSimulator.get_cell_volumes() NDArray[float]

Retrieves the cell volumes of the simulation grid.

Returns:

An array of cell volumes.

opm.simulators.BlackOilSimulator.get_dt() float

Gets the timestep size of the last completed step.

Returns:

Timestep size in days.

opm.simulators.BlackOilSimulator.get_fluid_state_variable(name: str) NDArray[float]

Retrieves a fluid state variable for the simulation grid.

Parameters:

name (str) – The name of the variable. Valid names are ‘pw’ (pressure water), ‘pg’ (pressure gas), ‘po’ (pressure oil), ‘rho_w’ (density water), ‘rho_g’ (density gas), ‘rho_o’ (density oil)’Rs’ (soultion gas-oil ratio), ‘Rv’ (volatile gas-oil ratio), ‘Sw’ (water saturation), ‘Sg’ (gas saturation), ‘So’ (oil saturation), and ‘T’ (temperature).

Returns:

An array of fluid state variables.

opm.simulators.BlackOilSimulator.get_porosity() NDArray[float]

Retrieves the porosity values of the simulation grid.

Returns:

An array of porosity values.

opm.simulators.BlackOilSimulator.get_primary_var_meaning(variable: str) NDArray[int]

Retrieves the primary variable meaning of the simulation grid.

Parameters:

variable (str) – The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’.

Returns:

An array of primary variable meanings. See get_primary_variable_meaning_map() for more information.

opm.simulators.BlackOilSimulator.get_primary_var_meaning_map(variable: str) dict[str, int]

Retrieves the primary variable meaning map for each primary variable.

Parameters:

variable (str) – The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’.

Returns:

A dictionary of primary variable meanings. The keys are the primary variable meanings and the values are the corresponding integer codes. The integer codes are used to represent the primary variable meanings in the simulation grid. For variable name ‘pressure’, the valid keys are: ‘Po’, ‘Pg’, and ‘Pw’, for variable name ‘water’, the valid keys are: ‘Sw’, ‘Rvw’, ‘Rsw’, and ‘Disabled’, for variable name ‘gas’, the valid keys are: ‘Sg’, ‘Rs’, ‘Rv’, and ‘Disabled’, for variable name ‘brine’, the valid keys are: ‘Cs’, ‘Sp’, and ‘Disabled’.

opm.simulators.BlackOilSimulator.get_primary_variable(variable: str) NDArray[float]

Retrieves the primary variable’s values for the simulation grid.

Parameters:

variable (str) – The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’.

Returns:

An array of primary variable values. See get_primary_variable_meaning() for more information.

opm.simulators.BlackOilSimulator.run() int

Runs the simulation to completion with the provided deck file or previously set deck.

Returns:

EXIT_SUCCESS if the simulation completes successfully.

opm.simulators.BlackOilSimulator.set_porosity(array: NDArray[float]) None

Sets the porosity values for the simulation grid.

Parameters:

array (NDArray[float]) – An array of porosity values to be set.

opm.simulators.BlackOilSimulator.set_primary_variable(variable: str, value: NDArray[float]) None

Sets the primary variable’s values for the simulation grid.

Parameters:
  • variable (str) – The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’.

  • value (NDArray[float]) – An array of primary variable values to be set. See get_primary_variable() for more information.

opm.simulators.BlackOilSimulator.mpi_init(init: bool, finalize: bool) None

Sets MPI up for parallel simulation. This method should be called before any other method. :param init: Whether to call MPI_Init() or not. :param finalize:Whether to call ``MPI_Finalize()```when the simulator object goes out of scope.

Returns:

None

opm.simulators.BlackOilSimulator.step() int

Executes the next simulation report step.

Returns:

Result of the simulation step.

opm.simulators.BlackOilSimulator.step_cleanup() int

Performs cleanup after the last simulation step.

Returns:

EXIT_SUCCESS if cleanup is successful.

opm.simulators.BlackOilSimulator.step_init() int

Initializes the simulation before taking the first report step. This method should be called before the first call to step()

Returns:

EXIT_SUCCESS if the initialization is successful.