1 Introduction
This page aims to explain how to install OpenFOAM on any Linux Distribution.
In the following chapters and sections is explained how to generally install OpenFOAM-dev (the development version released by the OpenFOAM Foundation) and related dependencies, such as ParaView:
Contents
For dedicated instructions (complete and/or partial) for each Linux Distribution:
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 the development version
In case you're wondering what is the difference between the repository OpenFOAM-dev that is provided by the OpenFOAM Foundation, versus all other versions:
- For example, starting with the version 2.4.0, this is considered to be a stable release that was launched for the main version 2.4. This specific version won't change over time.
- The version 2.4.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.
- In comparison with the previous two versions, the OpenFOAM-dev and ThirdParty-dev repositories provide the development for the next major version of OpenFOAM.
So in essence, the development version is the bleeding edge in the development of OpenFOAM, which allows one to contribute to the next version of OpenFOAM that is in development. This enables the following capabilities:
- Earlier access to new features, before the next major version is made.
- Higher probability of having bugs fixed.
- When there is a new feature in the development repository, it's just a matter of updating the local code repository.
- When reporting a bug, this is the version that is sometimes used as a reference, although not always. 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.
- For more details on how to contribute: OpenFOAM Development
Nonetheless, there are some downsides of using the bug fix version:
- Very early access to a higher probability of new bugs.
- Things can change a lot more than stable and bug fix versions.
- Advised only for those who truly need the bleeding edge and/or want to collaborate closer with the development version.
3 Installing from source code
Official instructions for this repository are provided here: OpenFOAM Source Repository
A few details to keep in mind:
- As already implied on the chapter About the development version, there are probably a lot of differences in building the development versions versus the bug fix version, but the work flow should still be the same. The main difference is that the repository for the source code is usually always the same, namely:
git clone https://github.com/OpenFOAM/OpenFOAM-dev.git
- You should also clone the repository for the ThirdParty-dev folder from the respective repository:
git clone https://github.com/OpenFOAM/ThirdParty-dev.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-dev. - 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.
- As of OpenFOAM 5.0 (in OpenFOAM-dev since August 2016), the minimum required GCC version is 4.8, but this can easily change in this repository as time passes by. This implies one of the following situations:
- You should use a recent Linux Distribution, so that it can provide a recent GCC version.
- Or you should get familiar with building GCC from source code.
- When in doubt, you can always check the Installation/Compatibility Matrix page for information on compatible compilers.
- 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-4.2.0/bin:$PATH
- If the previous command worked, you can add the following alias command in your ~/.bashrc file:
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:
- Start a new terminal and activate the respective OpenFOAM shell environment.
- Pull the latest changes for both repositories, by running the following commands:
cd $WM_THIRD_PARTY_DIR git pull foam git pull cd $WM_THIRD_PARTY_DIR
- Read the README.org file in the folder ThirdParty-dev and check if you need to download and install new source code packages, such a new ParaView, CGAL or Scotch source code version.
- Start a new terminal and activate the respective OpenFOAM environment again. You may need to check if your ParaView version is still correct, for example, by running:
paraview --version
since if a new version is expected, you might need to download and build the new version, as indicated in the previous step.
- Finally, once the 3rd party folder is sorted out, you can update the build by running:
foam ./Allwmake -update -j > log.make 2>&1