How to install OpenFOAM 7 directly on Window 10 - Tutorial

openFoam.jpg

OpenFoam is a great open source software for the numerical simulation of water, air, heat and any other physical fluid. Unfortunately OpenFOAM is Linux native and options to run it on Windows are limited with restrictions on tools, versions and available computational resources. With the latest developments on Windows 10 is is posible to install OpenFoam directly in Windows with something called a Windows Subsystem for Linux (WSL) and installing Ubuntu inside Windows.

This tutorial covers all the step required to install OpenFOAM in Windows 10 and its the base for coming modeling tutorials on OpenFOAM.

Video

Instructions

To install the Ubuntu kernel, first, open the “POWER SHELL” of windows, just search “PowerShell” in windows, open it as an administrator .

In the “PowerShell” type the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Open the “Microsoft Store”, after opening this, search for “Ubuntu 20.04 LTS”, and click on “Obtain”.

Once it finishes you can open the “Ubuntu” kernel from windows or clicking on “Start” .

After installing, it asks you for a username, choose one of your preference, but in the later sessions, your username will be referred to “USERNAME” .

Then, it asks you for a password .

Update your operating system, in the kernel, write the following lines:

sudo apt-get update

sudo apt-get upgrade

Uninstall the “gpg” package, which may be corrupted:

sudo apt remove gpg

And install another version:

sudo apt install gnupg1

Now, you can add the public key of OpenFOAM:

sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"

Install additional packages:

sudo apt-get install software-properties-common

Then, add the repository:

sudo add-apt-repository http://dl.openfoam.org/ubuntu

Update again:

sudo apt-get update

And, install OpenFOAM:

sudo apt-get -y install openfoam7

Some extra features are installed with this command:

sudo apt-get install build-essential

To add the OpenFOAM solvers to the kernel do the following:

echo ". /opt/openfoam7/etc/bashrc" >> $HOME/.bashrc

Then register the changes:

. $HOME/.bashrc

Now, if we run the solver help “simpleFoam -help”, we get the information of the solver

9 Comments

Saul Montoya

Saul Montoya es Ingeniero Civil graduado de la Pontificia Universidad Católica del Perú en Lima con estudios de postgrado en Manejo e Ingeniería de Recursos Hídricos (Programa WAREM) de la Universidad de Stuttgart con mención en Ingeniería de Aguas Subterráneas y Hidroinformática.

 

Suscribe to our online newsletter

Subscribe for free newsletter, receive news, interesting facts and dates of our courses in water resources.