Installation/Linux/OpenFOAM-5.x

From OpenFOAMWiki
< Installation‎ | Linux
Revision as of 12:30, 11 August 2018 by Wyldckat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Maintainer
The current maintainer of this page is Wyldckat (talk).


1 Introduction

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

In the following chapters and sections is explained how to generally install OpenFOAM 5.x and related dependencies, such as ParaView:

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

Installation/Linux/OpenFOAM-5.x/CentOS SL RHELInstallation/Linux/OpenFOAM-5.x/Ubuntu



2 About the bug fix version

In case you're wondering what is the difference between the versions 5.0 and 5.x:

  • The version 5.0 is considered to be a stable release that was launched for the main version 5. This specific version won't change over time.
  • The version 5.x is the bug fix version, which is regularly updated overtime, at least until the next major release of OpenFOAM is released.
    • This version is also known as: the git version; the repository version.

So in essence, the version bug fix version 5.x allows one to stay the most up-to-date possible of OpenFOAM's latest source code. This enables the following capabilities:

  • Earlier access to new features, before the next stable release is made.
  • 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.

Nonetheless, there are some downsides of using the bug fix version:

  • Early access to new bugs.
    • Yes, some bug fixes can introduce new bugs.
  • Some features may be removed, since a bug might have been spotted that would indicate that said feature is incorrect.
  • Not advised for using in a cluster or shared machine environment, since global installations of the bug fix version can get a bit onerous over time!


3 Installing from source code

The official instructions are made available here: Repository Release - version 5.x

A few details to keep in mind:

  1. As already implied on the chapter About the bug fix version, there are only a few differences in building 5.x and 5.0. The main difference is how the source code is downloaded and how you can keep up with updates that are made to the changes made on OpenFOAM's git repository, namely:
    git clone https://github.com/OpenFOAM/OpenFOAM-5.x.git
    • You can also choose to download the ThirdParty-5.x folder from the respective repository:
        git clone https://github.com/OpenFOAM/ThirdParty-5.x.git
      In which case, you will need to also manually download the packages as listed in the README.html or README.org files in the downloaded folder ThirdParty-5.x.
  2. 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.
  3. 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.
  4. 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