Close

6th January 2017

Download v4.1 | Linux

Linux Distributions

OpenFOAM 4.1 is a version bug fix release of OpenFOAM, accompanied by ParaView 5.0.1, compiled with the official OpenFOAM reader module.  It is packaged for Ubuntu 14.04, 16.04, 16.10 and 17.04 but can be installed on 64 bit distributions of Linux using Docker to provide a self-contained environment that includes code, runtime, system tools and libraries, independent of the underlying operating system.  The following distributions have been tested, with instructions given below for installing Docker, but other Linux distributions should also work.

Note: simply install the native packaged version for Ubuntu 14.04LTS, 16.04LTS and 16.10.

Step 1: Before Installing Docker

  1. Ensure that your version of Linux operating system is sufficiently new.  A good test is to check the version of Linux kernel is 3.10 or higher by typing:
    uname -r
  2. The user requires superuser password authentication to execute the following commands with sudo. If in doubt, talk to your system administrator.
  3. Ensure you have a network connection to download packages via http(s).

Step 2: Installing Docker

Copy and paste the following commands in a terminal for the respective Linux distribution:

RHEL, CentOS and Fedora

On RHEL and CentOS only:

sudo yum -y update

On Fedora only:

sudo dnf -y update

Then on all distributions (RHEL, CentOS and Fedora):

curl -fsSL https://get.docker.com/ | sh
sudo systemctl enable docker.service
sudo systemctl start docker

SLES and openSuSE

On SLES only:

sudo SUSEConnect -p sle-module-containers/12/x86_64 -r ''

The on all distributions (SLES and openSuSE):

sudo zypper -n in docker
sudo systemctl start docker
sudo systemctl enable docker

Debian

sudo apt-get -y update
curl -fsSL https://get.docker.com/ | sh

Step 3: Docker Configuration

Docker runs as the root user by default.  To enable a (non-root) user to run Docker requires the user to be added to the docker group.  Log in to the account of the user to be added to the docker group and enter

sudo usermod -aG docker $(whoami)

(Alternatively the command above can be run from another user account, e.g. the system administrator, substituting $(whoami) with the name of the user to be added).

The user must log out and log in of their account for the change to take effect.

Step 4: Installing openfoam4-linux

OpenFOAM 4 is launched from a script named openfoam4-linux.  The script is available from the OpenFOAM Download Site and needs to be located somewhere on the user’s PATH for convenient execution.  We can download the file conveniently using wget, which can be installed if necessary by:

  • RHEL, CentOS: sudo yum -y install wget
  • Fedora: sudo dnf -y install wget
  • SLES and openSuSE: sudo zypper -n in wget

The following commands will then install in the system-wide /usr/bin directory and make the script executable:

sudo sh -c "wget http://dl.openfoam.org/docker/openfoam4-linux -O /usr/bin/openfoam4-linux"
sudo chmod 755 /usr/bin/openfoam4-linux

Step 5: Launching openfoam4-linux

The Docker container mounts the user’s file system so that case files are stored permanently. The container mounts the directory from where openfoam4-linux is launched by default, but the user can also specify the directory using the “-d” option.  Mounting the user’s $HOME directory is disallowed.  The mounted directory is represented in the container environment by the WM_PROJECT_USER_DIR environment variable, which is set to $HOME/OpenFOAM/${USER}-4.1 by default.  We therefore recommend creating that directory on the host machine and launching openfoam4-linux there by:

mkdir -p $HOME/OpenFOAM/${USER}-4.1
cd $HOME/OpenFOAM/${USER}-4.1
openfoam4-linux

The first time the container is launched, there is a short wait while the image downloads and unpacks.

Step 6: Testing openfoam4-linux

Follow the standard process to test the installation, first creating the run directory:

mkdir -p $FOAM_RUN

Copy across the backward facing step example, generate the mesh with blockMesh and run the steady flow, incompressible solver simpleFoam

cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
cd pitzDaily
blockMesh
simpleFoam
paraFoam

Refer to the OpenFOAM User Guide to get started.

Step 7: Exiting Docker

When finished using OpenFOAM in Docker exit the environment by typing:

exit

Reporting Issues

If you encounter an issue with this installation, please report it to the OpenFOAM Issue Tracking system.