Documentation for the opm-core library.

The following are the main library features:

Grid handling

The library defines a simple grid interface through the struct UnstructuredGrid. This can be used both from C and C++ code, and has a structure that is similar to MRST grids.

Cells can have arbitrary shapes, and arbitrary numbers of neighbours. This flexibility allows us to handle complex grids such as faulted corner-point grids or PEBI grids. The structure is suited for computation with (for example) finite volume methods or mimetic finite differences. It is less ideal for finite element computations, as it does not provide any reference element mappings.

There are multiple construction functions for UnstructuredGrid, for example create_grid_cart2d(), create_grid_hexa3d(), read_grid() and create_grid_cornerpoint(). The function destroy_grid() frees the resources used by a grid.

For C++ users, the Opm::GridManager class can be used to encapsulate creation and destruction of an UnstructuredGrid. The method Opm::GridManager::c_grid() provides access to the underlying UnstructuredGrid structure. This class also provides an easy way to initialize a grid from an ECLIPSE-format input deck, via the constructor taking an Opm::DeckConstPtr.

Well handling

A well in opm-core can have an arbitrary number of perforations connecting it to the reservoir. Wells can be open or closed, and they can be controlled by bottom hole pressure (BHP), volumetric (reservoir) rates or surface rates. Multiple controls can be specified, then one control will be the active control and the others will be interpreted as constraints.

A small collection of structs is used to communicate well information, the most important ones being the Wells struct and its contained WellControls structs. A set of C functions to manipulate these are provided, the most important ones are create_wells(), add_well(), append_well_controls() and destroy_wells().

The C++ class Opm::WellsManager encapsulates creation and management of well objects, making the underlying Wells struct available in the method Opm::WellsManager::c_wells(). It goes beyond this, however, and also provides methods such as Opm::WellsManager::conditionsMet() that checks if all well constraints are met, and switches controls if not.

Pressure solvers

The currently recommended pressure solvers available in opm-core are the C++ classes

Transport solvers

There are three transport solvers available in opm-core for two-phase flow. All of these solvers use an implicit Euler time discretization, upstream mobility weighting and a TPFA discretization for gravity:

Time-of-flight solvers

The time-of-flight equation can be solved by grid-based methods as an alternative to the more traditional streamline methods. We provide two solvers for this:

Simulators

There are two simulator programs for two-phase immiscible flow in opm-core:

  • sim_2p_incomp (incompressible fluid)
  • sim_2p_comp_reorder (compressible fluid)

Various utilities

Utilities contained in opm-core include: