# OpenFOAM Installation

Source: https://help.sim-flow.com/installation/linux/openfoam-installation
Last updated: 2026-10-14

## Introduction

**What is OpenFOAM?**
OpenFOAM is a well-known open-source code for CFD (computational fluid dynamics) simulations. It provides a comprehensive set of tools and solvers for modeling and analyzing various fluid flow phenomena. SimFlow utilizes OpenFOAM as its core CFD engine.

**OpenFOAM Installation**
SimFlow requires OpenFOAM as its computational engine to run CFD simulations. OpenFOAM 2512 is the recommended version for use with SimFlow 5.1.

Methods of installing OpenFOAM on Linux:

1. [System Package Manager](https://help.sim-flow.com/installation/linux/openfoam-installation#_openfoam_installation_system_package_manager) (recommended)
2. [Source Code Compilation](https://help.sim-flow.com/installation/linux/openfoam-installation#_openfoam_installation_source_code_compilation)
3. [Docker](https://help.sim-flow.com/installation/linux/openfoam-installation#_openfoam_installation_docker)

## OpenFOAM Installation - System Package Manager

This method simplifies the OpenFOAM installation process by eliminating the need for manual compilation.
With this approach, a pre-compiled version of OpenFOAM is downloaded via the system’s package manager. Pre-compiled binaries are executable files that have already been converted from source code into machine-readable instructions. These binaries are ready for use on a specific platform or architecture without requiring further compilation.

Pre-compiled binaries are currently available for the following systems:

- Debian
- Ubuntu
- openSUSE
- RedHat derivatives

### openSUSE / RedHat

For installation instructions on openSUSE and RedHat systems, please refer to the official OpenFOAM website: [https://gitlab.com/openfoam/core/openfoam/-/wikis/precompiled](https://gitlab.com/openfoam/core/openfoam/-/wikis/precompiled)

### Debian / Ubuntu

1. Install the Client URL (Curl) for data transfer:
   `sudo apt install curl`
2. Add the repository:
   `curl https://dl.openfoam.com/add-debian-repo.sh | sudo bash`
3. Update the repository information:
   `sudo apt-get update`
4. [Optional] Some older Ubuntu installations may require updating the signing certificates:
   `sudo apt-get install ca-certificates`
   `sudo apt-get update`
5. Install the OpenFOAM 2512 package:
   `sudo apt-get install openfoam2512-default`

The default installation path for OpenFOAM is:
/usr/lib/openfoam/openfoam2512/

### OpenFOAM Integration with SimFlow

After the OpenFOAM installation is complete, you need to integrate it with SimFlow. Please refer to the following instructions provided in the link below:
[OpenFOAM Integration](https://help.sim-flow.com/installation/configuration/integrations#_openfoam_integration)

## OpenFOAM Installation - Source Code Compilation

OpenFOAM offers users the flexibility to compile the software from its source code. The compilation process translates the source code into machine-executable binary files, which can be run as applications. By compiling OpenFOAM from source, users gain control over compilation options, optimization settings, and compatibility with specific hardware or software environments.

The source code is available on the official OpenFOAM developers' website. The compilation process is largely automated and requires relatively little effort from the user.

Below, you can find an example procedure of the OpenFOAM compilation process on Ubuntu OS in three steps:

1. Prerequisites
2. Download OpenFOAM Binaries
3. OpenFOAM Compilation

### Prerequisites

Before you start compiling, you need to install dependent libraries first.

`sudo apt install gcc`

`sudo apt install libopenmpi-dev`

`sudo apt install zlib1g-dev`

`sudo apt install flex`

Verify access to the MPI library:

`mpicc --version`

### Download OpenFOAM Binaries

1. Change the directory to where you want to store OpenFOAM:
   `cd /home/<user name>/<..custom path>/`
2. Download the OpenFOAM binaries from one of the official distributions:
   - [OpenFOAM+ 2512](https://www.openfoam.com/download/release-history#v2512) (recommended)
   - [OpenFOAM+ 2506](https://www.openfoam.com/download/release-history#v2506)
   - [OpenFOAM+ 2212](https://www.openfoam.com/download/release-history#v2212)
   - [OpenFOAM+ 1812](https://www.openfoam.com/download/release-history#v1812)
   - [OpenFOAM 6 (Ubuntu)](https://openfoam.org/download/6-ubuntu/)
   - [OpenFOAM 6 (Linux Generic)](https://openfoam.org/download/6-linux/)
     You can use the `wget` command from the terminal to download e.g., OpenFOAM 2512:
     `wget https://sourceforge.net/projects/openfoam/files/v2512/OpenFOAM-v2512.tgz`
     `wget https://sourceforge.net/projects/openfoam/files/v2512/ThirdParty-v2512.tar.gz`
3. Extract the archives:
   `tar -xzf OpenFOAM-v2512.tgz`
   `tar -xzf ThirdParty-v2512.tar.gz`

### OpenFOAM Compilation

1. Load the OpenFOAM configuration stored in environment variables:
   `source OpenFOAM-v2512/etc/bashrc`
2. Check if OpenFOAM has access to all necessary libraries:
   `foamSystemCheck`
3. (Optional) Set the number of processors to use during compilation:
   `export WM_NCOMPPROCS=10`
4. Change directory to the OpenFOAM root:
   `cd OpenFOAM-v2512`
5. Run the compilation script:
   `./Allwmake`

By default, OpenFOAM will be installed in the indicated directory.

### OpenFOAM Integration with SimFlow

After the OpenFOAM installation is complete, you need to integrate it with SimFlow. Please refer to the following instructions provided in the link below:
[OpenFOAM Integration](https://help.sim-flow.com/installation/configuration/integrations#_openfoam_integration)

## OpenFOAM Installation - Docker

OpenFOAM installation via Docker is quite simple. If Docker is installed on your computer, OpenFOAM will be downloaded and installed automatically when adding it to SimFlow.

To install OpenFOAM via Docker, please refer to the following instructions:
[OpenFOAM Integration with SimFlow via Docker](https://help.sim-flow.com/installation/configuration/integrations#_docker)
