OPM Simulators Python Documentation

Note on Import Paths

In this documentation, the BlackOilSimulator class is referenced with its full import path, i.e., opm.simulators.BlackOilSimulator. This reflects how the BlackOilSimulator class can be imported:

from opm.simulators import BlackOilSimulator

Documentation

class opm.simulators.BlackOilSimulator

The BlackOilSimulator class to run simulations using a given Deck.

__init__(deck_filename: str) BlackOilSimulator

Constructor using a deck file name. :param deck_filename: The file name of the deck to be used for the simulation. :type deck_filename: str :return: The BlackOilSimulator. :type return: BlackOilSimulator

__init__(deck: Deck, state: EclipseState, schedule: Schedule, summary_config: SummaryConfig) BlackOilSimulator

Constructor using Deck, EclipseState, Schedule, and SummaryConfig objects. :param deck: Deck object. :type deck: Deck :param state: EclipseState object. :type state: EclipseState :param schedule: Schedule object. :type schedule: Schedule :param summary_config: SummaryConfig object. :type summary_config: SummaryConfig :return: The BlackOilSimulator. :type return: BlackOilSimulator

advance(report_step: int) None

Advances the simulation to a specific report step. :param report_step: Target report step to advance to. :type report_step: int

check_simulation_finished() bool

Checks if the simulation has finished. :return: True if the simulation is finished, False otherwise. :type return: bool

current_step() int

Gets the current simulation step. :return: The current step number.

get_cell_volumes() NDArray[float]

Retrieves the cell volumes of the simulation grid. :return: An array of cell volumes. :type return: NDArray[float]

get_dt() float

Gets the timestep size of the last completed step. :return: Timestep size in days. :type return: float

get_fluid_state_variable(name: str) NDArray[float]

Retrieves a fluid state variable for the simulation grid. :param name: 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). :type name: str :return: An array of fluid state variables. :type return: NDArray[float]

get_porosity() NDArray[float]

Retrieves the porosity values of the simulation grid. :return: An array of porosity values. :type return: numpy.ndarray

get_primary_var_meaning(variable: str) NDArray[int]

Retrieves the primary variable meaning of the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: An array of primary variable meanings. See get_primary_variable_meaning_map() for more information. :type return: NDArray[int]

get_primary_var_meaning_map(variable: str) dict[str, int]

Retrieves the primary variable meaning map for each primary variable. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: 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’. :type return: dict[str, int]

get_primary_variable(variable: str) NDArray[float]

Retrieves the primary variable’s values for the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: An array of primary variable values. See get_primary_variable_meaning() for more information. :type return: NDArray[float]

run() int

Runs the simulation to completion with the provided deck file or previously set deck. :return: EXIT_SUCCESS if the simulation completes successfully.

set_porosity(array: NDArray[float]) None

Sets the porosity values for the simulation grid. :param array: An array of porosity values to be set. :type array: NDArray[float]

set_primary_variable(variable: str, value: NDArray[float]) None

Sets the primary variable’s values for the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :param value: An array of primary variable values to be set. See get_primary_variable() for more information. :type value: NDArray[float]

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. :return: None

step() int

Executes the next simulation report step. :return: Result of the simulation step.

step_cleanup() int

Performs cleanup after the last simulation step. :return: EXIT_SUCCESS if cleanup is successful.

step_init() int

Initializes the simulation before taking the first report step. This method should be called before the first call to step() :return: EXIT_SUCCESS if the initialization is successful.

class opm.simulators.GasWaterSimulator

The GasWaterSimulator class to run simulations using a given Deck.

__init__(deck_filename: str) GasWaterSimulator

Constructor using a deck file name. :param deck_filename: The file name of the deck to be used for the simulation. :type deck_filename: str :return: The GasWaterSimulator. :type return: GasWaterSimulator

__init__(deck: Deck, state: EclipseState, schedule: Schedule, summary_config: SummaryConfig) GasWaterSimulator

Constructor using Deck, EclipseState, Schedule, and SummaryConfig objects. :param deck: Deck object. :type deck: Deck :param state: EclipseState object. :type state: EclipseState :param schedule: Schedule object. :type schedule: Schedule :param summary_config: SummaryConfig object. :type summary_config: SummaryConfig :return: The GasWaterSimulator. :type return: GasWaterSimulator

advance(report_step: int) None

Advances the simulation to a specific report step. :param report_step: Target report step to advance to. :type report_step: int

check_simulation_finished() bool

Checks if the simulation has finished. :return: True if the simulation is finished, False otherwise. :type return: bool

current_step() int

Gets the current simulation step. :return: The current step number.

get_cell_volumes() NDArray[float]

Retrieves the cell volumes of the simulation grid. :return: An array of cell volumes. :type return: NDArray[float]

get_dt() float

Gets the timestep size of the last completed step. :return: Timestep size in days. :type return: float

get_fluid_state_variable(name: str) NDArray[float]

Retrieves a fluid state variable for the simulation grid. :param name: 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). :type name: str :return: An array of fluid state variables. :type return: NDArray[float]

get_porosity() NDArray[float]

Retrieves the porosity values of the simulation grid. :return: An array of porosity values. :type return: numpy.ndarray

get_primary_var_meaning(variable: str) NDArray[int]

Retrieves the primary variable meaning of the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: An array of primary variable meanings. See get_primary_variable_meaning_map() for more information. :type return: NDArray[int]

get_primary_var_meaning_map(variable: str) dict[str, int]

Retrieves the primary variable meaning map for each primary variable. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: 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’. :type return: dict[str, int]

get_primary_variable(variable: str) NDArray[float]

Retrieves the primary variable’s values for the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: An array of primary variable values. See get_primary_variable_meaning() for more information. :type return: NDArray[float]

run() int

Runs the simulation to completion with the provided deck file or previously set deck. :return: EXIT_SUCCESS if the simulation completes successfully.

set_porosity(array: NDArray[float]) None

Sets the porosity values for the simulation grid. :param array: An array of porosity values to be set. :type array: NDArray[float]

set_primary_variable(variable: str, value: NDArray[float]) None

Sets the primary variable’s values for the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :param value: An array of primary variable values to be set. See get_primary_variable() for more information. :type value: NDArray[float]

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. :return: None

step() int

Executes the next simulation report step. :return: Result of the simulation step.

step_cleanup() int

Performs cleanup after the last simulation step. :return: EXIT_SUCCESS if cleanup is successful.

step_init() int

Initializes the simulation before taking the first report step. This method should be called before the first call to step() :return: EXIT_SUCCESS if the initialization is successful.

class opm.simulators.OnePhaseSimulator

The OnePhaseSimulator class to run simulations using a given Deck.

__init__(deck_filename: str) OnePhaseSimulator

Constructor using a deck file name. :param deck_filename: The file name of the deck to be used for the simulation. :type deck_filename: str :return: The OnePhaseSimulator. :type return: OnePhaseSimulator

__init__(deck: Deck, state: EclipseState, schedule: Schedule, summary_config: SummaryConfig) OnePhaseSimulator

Constructor using Deck, EclipseState, Schedule, and SummaryConfig objects. :param deck: Deck object. :type deck: Deck :param state: EclipseState object. :type state: EclipseState :param schedule: Schedule object. :type schedule: Schedule :param summary_config: SummaryConfig object. :type summary_config: SummaryConfig :return: The OnePhaseSimulator. :type return: OnePhaseSimulator

advance(report_step: int) None

Advances the simulation to a specific report step. :param report_step: Target report step to advance to. :type report_step: int

check_simulation_finished() bool

Checks if the simulation has finished. :return: True if the simulation is finished, False otherwise. :type return: bool

current_step() int

Gets the current simulation step. :return: The current step number.

get_cell_volumes() NDArray[float]

Retrieves the cell volumes of the simulation grid. :return: An array of cell volumes. :type return: NDArray[float]

get_dt() float

Gets the timestep size of the last completed step. :return: Timestep size in days. :type return: float

get_fluid_state_variable(name: str) NDArray[float]

Retrieves a fluid state variable for the simulation grid. :param name: 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). :type name: str :return: An array of fluid state variables. :type return: NDArray[float]

get_porosity() NDArray[float]

Retrieves the porosity values of the simulation grid. :return: An array of porosity values. :type return: numpy.ndarray

get_primary_var_meaning(variable: str) NDArray[int]

Retrieves the primary variable meaning of the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: An array of primary variable meanings. See get_primary_variable_meaning_map() for more information. :type return: NDArray[int]

get_primary_var_meaning_map(variable: str) dict[str, int]

Retrieves the primary variable meaning map for each primary variable. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: 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’. :type return: dict[str, int]

get_primary_variable(variable: str) NDArray[float]

Retrieves the primary variable’s values for the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :return: An array of primary variable values. See get_primary_variable_meaning() for more information. :type return: NDArray[float]

run() int

Runs the simulation to completion with the provided deck file or previously set deck. :return: EXIT_SUCCESS if the simulation completes successfully.

set_porosity(array: NDArray[float]) None

Sets the porosity values for the simulation grid. :param array: An array of porosity values to be set. :type array: NDArray[float]

set_primary_variable(variable: str, value: NDArray[float]) None

Sets the primary variable’s values for the simulation grid. :param variable: The name of the variable. Valid names are ‘pressure’, ‘water’, ‘gas’, and ‘brine’. :type variable: str :param value: An array of primary variable values to be set. See get_primary_variable() for more information. :type value: NDArray[float]

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. :return: None

step() int

Executes the next simulation report step. :return: Result of the simulation step.

step_cleanup() int

Performs cleanup after the last simulation step. :return: EXIT_SUCCESS if cleanup is successful.

step_init() int

Initializes the simulation before taking the first report step. This method should be called before the first call to step() :return: EXIT_SUCCESS if the initialization is successful.