Hydrocarbon Simulator Tutorial Series in Windows

Run Hydrocarbon Flow Simulator in Windows (Ubuntu 18.04) — Part I

Roderick Perez
8 min readApr 2, 2021

Download and set-up Ubuntu 18.04 on Windows using WSL

As a Geophysical Engineer, dedicated primarily to seismic interpretation, I have always been fascinated by the impact of my work in the world of energy. However, this fascination has been accompanied by the technical inability to integrate my knowledge and expertise in a project in a comprehensive way. Until some years, in the world of geosciences (where I include geophysicists, geologists, petrophysicists, etc.) and petroleum engineers have remained on the sidelines and separated in their silos.

Many of this inability to interact was due to the lack of commercial (low-cost?) software that would allow teams and workgroups to interact in a more interdisciplinary way. Today, with the rise of free software (or open-source), these silos are breaking down, and the interaction of work teams can be made more dynamic, up to the limit that the same individual can perform from seismic processing. , interpretation, attribute generation, calibration with well logs, petrophysical interpretation, and analysis, up to the generation of a 3D model of the reservoir, and its subsequent dynamic reservoir simulation from the comfort of your home and without the need to have access to a workstation.

In this series of posts, I have prepared a tutorial that will allow you to install Ubuntu under Windows using the Windows Subsystem for Linux (Part I), and later, download and install Flow in Ubuntu to be able to generate reservoir simulations, which can be viewed from ResInsight.

Introduction

Over the years as a geophysical engineer (specialized in seismic interpretation) I have always been fascinated with the possibility able to integrate and visualize all the data collected from a reservoir in a 3D model, which allows me to evaluate the impact of my interpretation in the hydrocarbon potential of the assets. However, until recently, many of these disciplines (as well as their tools and software) have been isolated, keeping each discipline and specialty in silos.

Recently, following the new trend of open-source software, I discovered FLOW, which is part of the the Open Porous Media project (https://opm-project.org/). Flow is a black-oil reservoir simulator that “encourages open innovation and reproducible research for modeling and simulation of porous media processes”.

Install Ubuntu 18.04 using WSL

So far, one of the biggest challenges was installing the Flow simulator on the system, which is only available for Linux. However, using the Windows Subsystem for Linux (WSL), it is possible to install a Linux distribution, preferably Ubuntu 18.04, and be able to install and run the simulation on a Linux environment and then be able to visualize the simulation results in a post-processing reservoir simulation visualization tool, such as ResInsight, which can access it on a Windows environment.

The first step is to download the Windows Terminal, which is a terminal application, from the Microsoft Store (very similar to the default installed Command Prompt, or PowerShell). However, I highly suggest installing Windows Terminal since it offers some benefits, as we will see in the next steps.

Inside the Microsoft Store, look for the Ubuntu 18.04 LTS version, and click on the Download button. It is important to note that there are currently different versions of Ubuntu available in the Microsoft Store (Ubuntu, or Ubuntu 20.04), as well as other Linux distributions (Kali, Debian, etc). But, we are going to work exclusively with rhe Ubuntu 18.04 version. To date, I do not know if it is possible to effectively install Flow in the other versions of Ubuntu.

After downloading Ubuntu 18.04 it is important to verify an important option since, by default, the folder is compressed, and it is necessary to change some properties so that we can install Ubuntu effectively on our machine.

For this, you must find the location where the “CanonicalGroupLimited.UbuntuonWindows_XXXXXX” folder was installed. In my case, it is under the “Packages” folder (see image).

By clicking the right mouse button, we select the Properties of said folder and the following window opens. In this, we must click on the “Advanced …” button.

Inside the “Advanced Attributes” window we must verify that the “Compress contents to save disk space” option is disabled. Then we can simply click on the OK button.

Now, we can install Ubuntu on our machines following the instructions and commands that the system suggests, where we must assign a UNIX username, as well as a system password.

Next, we can open Windows Terminal, and a screen opens with a tab with the title “Windows PowerShell”, in which we can view the working directory in which we are.

It is important to note that this password is the one that must be entered each time we add the sudo command (which means SuperUser DO) and is used to access restricted files and operations.

To verify that Ubuntu was installed correctly on our machines, we can enter the following command:

wsl --list --verbose

If the result looks like the one shown in the following image, everything is fine. In my case, I have two versions of Ubuntu on my machine (Ubuntu 18.04 and Ubuntu 20.04, which is simply displayed as Ubuntu).

The version associated with both is 1, which refers to the associated WSL 1 or WSL2 version. As mentioned in the Microsoft documentation, the difference between working with WSL1 and WSL2 is that whereas WSL 1 used a translation layer that was built by the WSL team, WSL 2 includes its own Linux kernel with full system call compatibility. In my case, I prefer to work with the WSL1 version, and for this tutorial, and the Flow installation there is no major difference.

There are two ways to start an Ubuntu session. To activate our Ubuntu, it is necessary to write the following command, in which the version that you want to start is specified (in our case it is the Ubuntu 18.04 version):

wsl -d Ubuntu-18.04

The second option is to click on tab (1) of the Windows Terminal, and as can be seen in the image, all the options available to us are shown. We selected Ubuntu 18.04 (2).

In both cases, we get the same result. As we can see, the machine is pointing to a specific directory (in my case it is /mnt/c/Users/RODERICK). This is one of the advantages of working in this way since the Ubuntu operating system is configured to access our C: disk in Windows, and we can navigate within the system from Ubuntu, without friction or problems.

A recommendation is always that when starting the Ubuntu session we can make the necessary package and library updates through the command:

sudo apt-get update

This process should be done routinely, at the beginning of each session, or after installing new packages and libraries (as we will do during this tutorial).

This command makes a scan of all the libraries and packages installed (or those that are necessary to install) in our system. Then, we indicate that we want to update these packages and libraries, through the command:

sudo apt-get upgrade

If there are pending updates, the system will ask us if we want to continue with said installations, which we will indicate yes, simply by typing the letter Y on our keyboard.

Generate directory/folder and visualize it on Windows

I understand that for many people working on Linux (Ubuntu) can be challenging. However, before finishing this tutorial, I want to share with you the advantages of using it in WSL.

In Linux, we can perform the functions in a Windows environment, but through commands. There is an infinity of commands that will be useful to have on hand from now on, but before finishing I would like us to visualize how to create a folder/directory from Ubuntu, and view the results from Windows Explorer.

Within Linux, the cd command refers to changing the directory. In my case, I am going to change from my base directory (/mnt/c/Users/RODERICK/) to my Documents directory (remember we are working on our hard drive C:) through the command:

cd Documents/

Now, inside the Documents folder, we can create a new directory called “Ubuntu” using the command mkdir (make directory) followed by the desired folder name that we would like to assign into it:

mkdir Ubuntu

and then we can access said new folder, using the cd command as we did previously.

Finally, within Windows Explorer, we can navigate within our C: disk and indeed we can verify that a new folder has been created within Documents, called Ubuntu.

Summary

In this tutorial, we downloaded and installed Windows Terminal, as well as Ubuntu version 18.04, and we learned how to start a Linux (Ubuntu) session from Windows. Then we used two very important commands within Linux, to change the directory (cd) and to generate a new folder/directory (mkdir), which allowed us to create a folder called Ubuntu, and which we verified was created within Windows Explorer.

In the next tutorial, we will install Flow in Ubuntu, and we will view the results of our simulation in ResInsight from Windows.

--

--

Roderick Perez
Roderick Perez

Written by Roderick Perez

Full Time M.Sc. Data Science @ UniWien, Geophysical Engineer, Master in Geology, Doctorate in Geophysics, and MBA.