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 2.4.x and related dependencies, such as ParaView:
For dedicated instructions (complete and/or partial) for each Linux Distribution:
|
Note: In case it doesn't exist for your Linux Distribution, check the ones listed at Installation/Linux/OpenFOAM-2.4.0 and compare the instructions for other distributions versus the ones available here.
2 About the bug fix version
In case you're wondering what is the difference between the versions 2.4.0 and 2.4.x:
- The version 2.4.0 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.
So in essence, the version bug fix version 2.4.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.
- For example, read: URGENT: Problem with dieselFoam and thermophysical properties
- 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 Releases - use 2.4.x for the version.
A few details to keep in mind:
- As already implied on the chapter About the bug fix version, there are only a few differences in building 2.4.x and 2.4.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-2.4.x.git
- You can also choose to download the ThirdParty-2.4.x folder from the respective repository:
git clone https://github.com/OpenFOAM/ThirdParty-2.4.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-2.4.x.
- You can also choose to download the ThirdParty-2.4.x folder from the respective repository:
- 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 2.2.0, the minimum required GCC version is 4.5.0. This implies one of the following situations:
- You should use a recent Linux Distribution, so that it can provide GCC 4.5 or any newer version.
- In case you have to use an older Linux Distribution and the GCC version provided is older than 4.5, then you'll have to build GCC from source code.
- When in doubt, 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: