Hydrocarbon Simulator Tutorial Series in Windows
Run Hydrocarbon Flow Simulator in Windows (Ubuntu 18.04) — Part II
Download OPM — Flow and open SPE1 dataset in ResInsight
In the previous article (Part I) we downloaded and installed Ubuntu within Windows, using Windows Subsystem for Linux (WSL). In this post we will download the black-oil Flow simulator in Ubuntu, and then download a dataset with various simulation cases, generate our own simulation, and visualize the results in ResInsight under Windows.
OPM Project
The Open Porous Media Initiative (OPM) is a joint effort of several companies, such as SINTEF, NORCE, and OPM-OP, which since 2015 formed a consortium that offers commercial support and maintenance services for the tools offered, like:
- Upscalling
- Black-oil reservoir | Flow
- Enhanced Oil Recovery
- CO2 sequestration
Flow
OPM Flow is a fully-implicit, black-oil simulator capable of running industry-standard simulation models. According to the documentation, the simulator is implemented using automatic differentiation to enable rapid development of new fluid models. It is importnat to highlight tha the program is in active development and new features are added in each bi-annual release.
To download Flow, it is necessary to go to the Download tab in the upper right corner of the home page and click on Download.
This link takes us to a new page, which offers us several download options, among which Ubuntu (16.04 or 18.04), RedHat, or Windows (using Virtualbox).
Until a few years ago, the only way to have Linux on a PC was through creating a disk partition or installing a virtual machine (such as VirtualBox or VMWare). However, virtual machines consume the resources (mainly RAM) in the machine, many times this operation becomes very inefficient. Therefore, since Windows opened the opportunity to integrate Linux with Windows through the Windows Subsystem for Linux (WSL), it is an opportunity to compile processes in Linux simply and lightly and be able to have access through (for example ) old known as Windows File Explorer.
Of course, this is not the definitive solution, but it is a very interesting alternative to fulfill the objective of being able to carry out simulations of geological models and to be able to visualize the results in Windows, without the complications of resource consumption (RAM) virtual machine installations, etc.
It is important to note that this tutorial is inspired by the instructions that he shared on his YouTube channel, which I suggest you visit to complement this post. Additionally, the OPM Flow team makes this tutorial available for the case of the SPE1 model.
Install Flow en Ubuntu 18.04
In the previous post (Part I), we managed to install Ubuntu 18.04 on our Windows machine, through WSL. Now, we start our Linux session (Ubuntu), and follow the instructions on the Flow page, which we can access through the Windows Terminal.
As good practice, every time we start a new Ubuntu session, we should check if there are updates available in the packages installed in our seismic, for which we must enter the command:
sudo apt-get update
if some updates are available, we can use the following command to upgrade:
sudo apt-get upgrade
Initially, it is necessary to install the “software-properties-common” package, through the command (1):
sudo apt-get install software-properties-common
Then we add the OPM repository (2), and run the update command again (3):
sudo apt-add-repository ppa:opm/ppa
sudo apt-get update
To verify that everything was installed correctly, we can use the following command line so that the system lists all the libraries and dependencies installed, and that they are associated with OPM:
apt-cache seacrh opm
In the same way, we can list the modules and packages related to opm-simulators available to install (2), through the command:
apt-cache seacrh opm-simulators
Then, to install the opm-simulators programs (including Flow) and their dependencies (3), we add the following command:
sudo apt-get install mpi-default-bin
sudo apt-get install libopm-simulators-bin
After finishing the installation process, it is suggested to do an update and upgrade of the libraries again, using the commands used previously:
sudo apt-get update
sudo apt-get upgrade
Download test data from OPM’s Github
With Flow installed in our Ubuntu session, it is necessary to download the dataset that the OPM team has prepared, for which it is necessary to create a folder in which we will store them, and after downloading git, we will clone the repository of opm-data.
After entering your Github account, we must go to the OPM / opm-data repository, and click on the Code button, and copy the link that is shown, which we will use to clone the data.
We return to our Ubuntu session, and first, we are going to create a new folder called data in the location of your preference, using the command:
mkdir data
Then, we will access that folder, through the command:
cd data
and we will proceed to install Git, using the command:
sudo apt install git
To verify that everything has been installed correctly, we can verify the version of Git that has been installed through the command:
git --version
Finally, we can clone the OPM repository with the data, using the following command:
git clone https://github.com/OPM/opm-data.git
Now, inside the created folder (in my case I call it data), we can call the ll command to list the files inside the folder (1).
Within Linux there are two methods for listing the elements within a directory: ls and ll. ls is the command used for listing directory contents, while ll (or ls -l) is used for listing directory contents in a long listing format.
We can see that inside our data folder there is another folder called opm-data, which we will access, and then we will list the elements within it (2). Then, inside the opm-data folder, there is a series of subfolders with the different reference cases used in the oil industry (SPE1, SPE2, SPE5, etc). We now proceed to enter the folder called spe1, and we will list the files that are inside it (3).
Now, we can call our Flow simulator and run the file with the .DATA ending, through the following command line:
flow SPE1CASE1.DATA
We will immediately see how Flow begins to perform the reservoir simulations following the instructions within the SPE1CASE1.DATA file.
In this case, 120 time-steps were generated, where after each simulation the system displays the results of interest on the simulation on the screen. After finishing, the system shows us a summary of the simulation with the information about the execution time, etc.
Visualize results in ResInsight
Finally, we can now go to our simulation viewer, ResInsight, and import the results by selecting “Import Eclipse Case”.
Because WSL allows us to integrate Ubuntu and Windows, we can navigate within our files in Windows, find where we create and store the data downloaded from the OPM repository, and look for the SPE1 folder.
We can see that the result that among the many files generated during the simulation, a file with an .EGRID extension was generated, which contains the 3D grid of our model.
After selecting the file SPE1CASE1.EGRID we can visualize the result of the model as a 3D grid within ResInsight.
Finally, now we can click on the Play button, and view the animation of our simulation.
Summary
Throughout this series of posts, we were able to install Ubuntu on Windows, using the Windows Subsystem for Linus (WSL) on which we installed the black-oil simulator Flow (belonging to the Open Porous Media Project). Next, we clone the sample dataset from the OPM repository on Github and then run the simulation using the data from the SPE1 case. Finally, we visualize the results of the simulation in Windows, through the ResInsight program.