Close

26th July 2017

Download v5.0 | Ubuntu

Ubuntu Versions

OpenFOAM 5.0 is a major new release of OpenFOAM provided by the openfoam5 pack.  It is accompanied by ParaView 5.4.0, compiled with the official OpenFOAM reader module, provided by the paraviewopenfoam54 pack.  Both packs are available for the following versions of Ubuntu, 64 bit only:

  • 14.04 LTS, codename trusty
  • 16.04 LTS, codename xenial
  • 17.04, codename zesty
  • 17.10, codename artful (from 30 Oct 2017)
  • 18.04 LTS, codename bionic (from 1 Jun 2018)

Installation

OpenFOAM and ParaView can be simply installed for the first time using the apt package management tool. The user will need to provide superuser password authentication when executing the following commands with sudo

  1. Copy and paste the following in a terminal prompt (ApplicationsAccessoriesTerminal) to add dl.openfoam.org to the list of software repositories for apt to search, and to add the public key (gpg.key) for the repository to enable package signatures to be verified.
    sudo sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -"
    sudo add-apt-repository http://dl.openfoam.org/ubuntu

    **Note: This only needs to be done once for a given system

  2. Update the apt package list to account for the new download repository location
    sudo apt-get update
    
  3. Install OpenFOAM (5 in the name refers to version 5.0) which also installs paraviewopenfoam54 as a dependency.
    sudo apt-get -y install openfoam5
    

OpenFOAM 5.0 and ParaView 5.4.0 are now installed in the /opt directory.

Patching OpenFOAM 5.0

OpenFOAM-5.x is periodically recompiled into a new openfoam-5 pack. The package will be upgraded automatically whenever repository package files are updated and the software is upgraded, e.g. by typing

sudo apt-get update
sudo apt-get upgrade

Users can also specifically upgrade openfoam5 only by the following option:

sudo apt-get update
sudo apt-get install --only-upgrade openfoam5

Installation Problems

1. Networking must be enabled in order to be able to install software packages in Ubuntu. Installation failure due to networking problems usually results in an error message that reports failures in fetching archives and ends with a line like the following:

E: Unable to fetch some archives...

2. If ParaView shows a blank screen when Ubuntu is installed on a Virtual Machine, try using an alternative desktop such as Gnome Classic or MATE.  To install Gnome Classic, type the following in a terminal window, then reboot and login using the Classic window manager:

sudo apt-get install gnome-panel gnome-flashback gnome-session-flashback indicator-applet-appmenu

3. A few users have encountered an error message similar to the following during installation (step 3)

Some packages could not be installed. This may mean that you
have requested an impossible situation...

The following information may help to resolve the situation:

The following packages have unmet dependencies: openfoam5 :
Depends: csh but it is not installable...

The most likely cause of this error message is that the universe repositories are not enabled. To enable them, type the following in a terminal window:

sudo apt-add-repository universe
sudo apt-get update

4. If MPICH is installed on the system, then during user configuration (below), the following error message might occur when sourcing the etc/bashrc file in the OpenFOAM installation:

gcc: error: unrecognized command line option '--showme:link'

The user can check whether MPICH is installed by typing the following:

sudo update-alternatives --list mpi

which returns /usr/mpich/include if MPICH is installed. This error is caused when the default mpicc is MPICH, rather than OpenMPI. The simplest way to fix the problem is to set mpicc to OpenMPI is by running the following command in a terminal prompt:

sudo update-alternatives --set mpi /usr/lib/openmpi/include

The .deb files for different versions of Ubuntu supplied can be downloaded directly from the OpenFOAM Download Repository.

User Configuration

In order to use the installed OpenFOAM package, complete the following

  1. Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot)
    gedit ~/.bashrc
    
  2. At the bottom of that file, add the following line (see Note 1 below) and save the file
    source /opt/openfoam5/etc/bashrc
    
  3. Open a new terminal window (see Note 2 below) and test that the simpleFoam application, from the OpenFOAM package, is working by typing
    simpleFoam -help
    
  4. A “Usage” message should appear. Your installation and user configuration is complete.

Note 1: If a similar line has already been added to the user’s .bashrc file, e.g. for a previous version of OpenFOAM, then the line should be deleted or, alternatively, commented out by inserting a # at the beginning of the line.
Note 2: If a user wishes to execute simpleFoam in the same terminal window, they must first register the change to the .bashrc file by typing at the terminal prompt (note the dots): source $HOME/.bashrc

Getting Started

Create a project directory within the $HOME/OpenFOAM directory named <USER>-5.0 (e.g. chris-5.0 for user chris and OpenFOAM version 5.0) and create a directory named run within it, e.g. by typing:

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.

Reporting Bugs in OpenFOAM

We appreciate that bugs in OpenFOAM are reported so we can fix them. Please refer to the OpenFOAM bugs pages to report bugs.