Prerequisites

OPM uses various third-party libraries and frameworks, these include:

  • BLAS and LAPACK
  • Boost (1.44 or later)
  • SuperLU (3 or later, but not the latest version unfortunately, due to changes in SuperLU! Has been tested with 4.3.)
  • SuiteSparse with UMFPACK
  • The Dune core modules dune-common, dune-geometry, dune-grid and dune-istl. We currently support Dune 2.4, 2.5 and 2.6. There is some experimental support for the current master version of Dune which will become Dune 2.7, this is only partially tested. Dune can be installed from binary packages (see the ubuntu install page) or from source (see the Dune documentation).
  • Eigen version 3 (for legacy version of Flow in opm-simulators)
  • The Zoltan library from Trilinos (for grid partitioning and load balancing)
  • The libecl library (github repository)

Note that some parts of OPM (opm-parser) can be built without Dune. No part of OPM requires any optional Dune prerequisites, such as Alberta, ALUGrid, UG or psurface.

Installing libecl

Note that this library may change between releases, breaking compatibility with OPM (mostly because it was needed by something in OPM) so if you are going to work with bleeding-edge (not release) versions of OPM, you should use the latest github version of libecl as well. Otherwise binary packages should be sufficient.

To install the current github master version of libecl in the standard location (typically requires sudo access):

git clone https://github.com/Statoil/libecl.git
cd libecl
mkdir build ; cd build
cmake ..
make ; sudo make install

To install in a non-standard location /foo:

git clone https://github.com/Statoil/libecl.git
cd libecl
mkdir build ; cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/foo
make ; make install

When installing in a non-standard location you must pass the
-DCMAKE_PREFIX_PATH=/foo
option to cmake when configuring the downstream OPM build.

Required tools

In addition, you need some tools:

  • git (for cloning the repo)
  • a C++ compiler and cmake (for building the software),
  • doxygen and latex (for building the docs).

The easiest way to satisfy prerequisites is to install them from binary packages, we provide instructions for Ubuntu, OpenSUSE and Mac OS X. The developers use either the g++ (4.8 or later required) or clang++ (3.4 or later required) compiler. 

Ubuntu 16.04 LTS

# Make sure we have updated URLs to packages etc.
sudo apt-get update -y

# For server edition of Ubuntu add-apt-repository depends on
sudo apt-get install -y software-properties-common

# Add PPA for OPM packages
sudo add-apt-repository -y ppa:opm/ppa                 sudo apt-get update -y

# Packages necessary for building
sudo apt-get install -y build-essential gfortran pkg-config cmake

# Packages necessary for documentation
sudo apt-get install -y doxygen ghostscript texlive-latex-recommended pgf gnuplot

# Packages necessary for version control
sudo apt-get install -y git-core

# MPI for parallel programs
sudo apt-get install -y mpi-default-dev
# Prerequisite libraries
sudo apt-get install -y libblas-dev libboost-all-dev \
  libsuperlu-dev libsuitesparse-dev libtrilinos-zoltan-dev

# Parts of Dune needed
sudo apt-get install libdune-common-dev libdune-geometry-dev \
  libdune-istl-dev libdune-grid-dev

OpenSUSE

# libraries
sudo zypper in blas libblas3 lapack liblapack3 libboost umfpack

# tools
sudo zypper in gcc automake autoconf git doxygen

# DUNE libraries
sudo zypper ar \
http://download.opensuse.org/repositories/science/openSUSE_12.2/science.repo
sudo zypper in dune-common dune-istl

Mac OS X

There are only some binary packages available for Mac OS X for the prerequisites. The following steps should  install all needed utilities and libraries. The steps have been tested on Mac OS X 10.10 (Yosemite) and 10.11 (El Capitan).

  • Install XCode, make sure that you can run clang from the Terminal.
  • Install Homebrew. You can visit their home page for simple (one-line) install instructions and information.
  • Install various tools and libraries:
brew install git cmake pkg-config doxygen
brew tap homebrew/science
brew install boost suite-sparse eigen
  • Optional: install OpenMPI. For some reason this seems to install gcc, and therefore takes a long time. Can be skipped.
brew install open-mpi
  • Install SuperLU. There is a recipe for this in the homebrew-opm repository, but the process is a little brittle. We have also received reports that this does not work currently since it installs the latest SuperLU which is not yet compatible with OPM. In the meantime please follow the SuperLU install instructions from Dune to install SuperLU 4.3.
brew tap OPM/homebrew-opm
export HOMEBREW_MAKE_JOBS=1
brew install opm/opm/superlu  # Note double opm
  • Install Dune. This is documented on the Dune webpage, but you can use the following shell-script. Note that if you did not install openMPI you should change the --enable-parallel below to --disable-parallel. To run the script, copy it into a file (buildDune.bash for example) and run it with “bash buildDune.bash“.
#!/bin/bash
# this script downloads the necessary set of dune modules
# to run the opm-autodiff blackoil simulator
# change appropriately, i.e. 2.2, 2.3 or empty which refers to master
DUNEVERSION=2.4
FLAGS="-O3 -DNDEBUG"

# say yes if you want to use the dune-cornerpoint module
DUNECORNERPOINT=yes
DUNEMODULES="dune-common dune-istl"
if [ "$DUNECORNERPOINT" != "" ] ; then
  DUNEMODULES=$DUNEMODULES" dune-geometry dune-grid"
fi
# build flags for all DUNE and OPM modules
# change according to your needs
if ! test -f config.opts ; then
echo "MAKE_FLAGS=-j7 \\
USE_CMAKE=yes \\
CONFIGURE_FLAGS=\"CXXFLAGS=\\\"$FLAGS\\\" \\
  --cache-file=../cache.config \\
  --disable-documentation \\
  --disable-shared \\
  --enable-parallel \\
  --disable-expressiontemplates \\
  --enable-experimental-grid-extensions \\
  --enable-fieldvector-size-is-method\"" > config.opts
fi
DUNEBRANCH=
if [ "$DUNEVERSION" != "" ] ; then
  DUNEBRANCH="-b releases/$DUNEVERSION"
fi
# get all dune modules necessary
for MOD in $DUNEMODULES ; do
  git clone $DUNEBRANCH http://gitlab.dune-project.org/core/$MOD
done
# build all DUNE and OPM modules in the correct order
./dune-common/bin/dunecontrol --opts=config.opts all
  • Install libecl as described above.