Installing OpenFOAM

Fondamental

OpenFOAM is originally available and developed for Linux environment. However, since recently, some possibilities works well in a Windows environment. The following gives you two alternatives for using it in Windows and also directly on Linux Ubuntu.

Running OpenFOAM on Windows 10

The packaged distributions of OpenFOAM for Ubuntu can be installed directly on Microsoft Windows 10 using Bash on Ubuntu on Windows, a full compatibility layer for running Linux applications on Windows through the Windows Subsystem for Linux (WSL). Additional X server software is needed to run graphical applications, such as the version of ParaView that includes the official OpenFOAM reader module.

The updated guidelines from OpenFOAM fundation are here :

https://openfoam.org/download/windows/

MéthodeActivate Windows Subsystem for Linux

  1. Follow the Guide to Install the Windows Subsystem for Linux and install the Ubuntu Linux Distribution.

  2. Launch the Ubuntu distribution through WSL.

MéthodeInstalling OpenFOAM

Type the following command lines in the Ubuntu shell :

1
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
2
sudo add-apt-repository http://dl.openfoam.org/ubuntu
3
sudo apt-get update
4
sudo apt-get -y install openfoam7

One installed, you have to type some additional command lines to finish the configuration and make OpenFOAM commands recognizable by the system :

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

You can test if installation is working by typing :

1
simpleFoam -help

MéthodeEnabling graphical applications

In order to have access to some graphical applications (Paraview for post-processing, notepad...), you have to install a X server software :

  • Download the Xming installer.

  • Run the Xming installer using the default settings.

  • Launch Xming and it runs in the background, visible in the system tray, waiting for a graphical Linux application to be launched.

  • Type the following command to make your Xming installation works :

1
echo "export DISPLAY=:0" >> ${HOME}/.bashrc
2
. $HOME/.bashrc

Finally, you can install the gedit editor which can be useful :

1
sudo apt-get install gedit gedit-plugins

Running OpenFOAM using Linux (Ubuntu)