Installation/Linux/OpenFOAM-7

From OpenFOAMWiki
Maintainer
The current maintainer of this page is Wyldckat (talk).


1 Introduction

This page aims to explain how to install OpenFOAM OF Version 7.png on any Linux Distribution.

In the following chapters and sections is explained how to generally install OpenFOAM-7 (released by the OpenFOAM Foundation) and related dependencies, such as ParaView:

For dedicated instructions (complete and/or partial) for each Linux Distribution:

Installation/Linux/OpenFOAM-7/UbuntuInstallation/Linux/OpenFOAM-7/Ubuntu/16.04Installation/Linux/OpenFOAM-7/Ubuntu/18.04
Installation/Linux/OpenFOAM-7/openSUSEInstallation/Linux/OpenFOAM-7/openSUSE/Leap 15.1

Note: This repository is in constant development, therefore these instructions need to be revised more often than with the stable and bug fix versions.


2 About version 7

Starting with OpenFOAM 6, a single version number is used for the whole lifetime of said version. This keeps things a bit simpler from the perspective of bug fixes are already available here, along with periodic updates of the Deb packages for it.

So in essence, the versions 6 and newer incentivize one to stay up-to-date as possible to OpenFOAM's latest stable release bug fixes. This enables the following capabilities:

  • Higher probability of having bugs fixed.
  • When a bug is fixed, it's just a matter of updating the local code repository.
  • When reporting a bug, this is the version that is used as a reference. More specifically, the commit hash is used for keeping track of where in time is your code snapshot (for more, read the chapter Installing from source code).
  • Makes it easier to learn how one can keep track of his/her own changes to the OpenFOAM source code.


3 Installing from source code

The official instructions are made available here: OpenFOAM Source Repository

A few details to keep in mind:

  1. When you need to update your local clone, for getting the latest source code updates, you can follow the instructions provided in the page Installation/Working with git repositories.
  2. As of OpenFOAM 5.0, the minimum required GCC version is 4.8.0. This implies one of the following situations:
    1. You should use a recent Linux Distribution, so that it can provide GCC 4.8 or any newer version.
    2. In case you have to use an older Linux Distribution and the GCC version provided is older than 4.8, then you'll have to build GCC from source code.
    3. When in doubt, check the Installation/Compatibility Matrix page for information on compatible compilers.
  3. When it comes to ParaView, it's possible to avoid the need to build it from source code. If your Linux Distribution provides ParaView 3.12.0 or newer, you don't need to build ParaView from source code. Simply run:
    paraFoam -builtin
    and it will open the case in ParaView.
    • If the previous command worked, you can add the following alias command in your ~/.bashrc file:
        alias paraFoam='paraFoam -builtin'
    • In case you have an old Linux Distribution and still don't want to build ParaView from source code, get the latest binary version for Linux from ParaView's official website. Then add to your ~/.bashrc file the following line (adapt accordingly):
        export PATH=$HOME/Downloads/ParaView-5.4.1/bin:$PATH


4 Steps for updating

In the bug reports #1941 and #2091, a new (relatively) easy way to update your development build to the latest code can be done by following the next steps, although keep in mind that these steps try to catch all possible scenarios:

  1. Start a new terminal and activate the respective OpenFOAM shell environment.
  2. Pull the latest changes for both repositories, by running the following commands:
    cd $WM_THIRD_PARTY_DIR
    git pull
    foam
    git pull
  3. You can update the build by running:
    foam
    ./Allwmake -update -j > log.make 2>&1