Close

20th July 2021

Download v9 | Linux

Linux Distributions

OpenFOAM 9 is a major new release of OpenFOAM, accompanied by ParaView 5.6.3, compiled with the official OpenFOAM reader module.  It is packaged for Ubuntu 18.04, 20.04 and 21.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 18.04LTS, 20.04LTS and 21.04.

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 openfoam9-linux

OpenFOAM 9 is launched from a script named openfoam9-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/openfoam9-linux -O /usr/bin/openfoam9-linux"
sudo chmod 755 /usr/bin/openfoam9-linux

Step 5: Launching openfoam9-linux

The Docker container mounts the user’s file system so that case files are stored permanently. The container mounts the directory from where openfoam9-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}-9 by default.  We therefore recommend creating that directory on the host machine and launching openfoam9-linux there by:

mkdir -p $HOME/OpenFOAM/${USER}-9
cd $HOME/OpenFOAM/${USER}-9
openfoam9-linux

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

Step 5a: Problem with containerd.io 1.4.6

June 2021: a recent release of containerd.io v1.4.6, used by Docker, can cause the launch to fail with a message

... mount destination [...] not absolute: unknown

The problem can be resolved by downgrading containerd.io to v1.4.4.

On Fedora, CentOS and Red Hat, the available versions can be listed with

yum --showduplicates list containerd.io

Once confirmed that the current version is 1.4.6 and the previous version is 1.4.4, downgrade the version with:

sudo yum downgrade containerd.io

On Debian, the available versions can be listed with

sudo apt-cache show containerd.io

Once confirmed that the current version is 1.4.6 and the previous version is 1.4.4, downgrade by reinstalling with the specified version number, e.g.:

sudo apt-get install containerd.io=1.4.4-1

Once downgraded, rerun openfoam9-linux

Step 6: Testing openfoam9-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.