OpenFOAM Installation - Linux OS

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 2212 is recommended version for use with SimFlow 5.0.

Methods of installing OpenFOAM on Linux:
  1. System Package Manager (recommended)
  2. Source Code Compilation
  3. 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://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/

Debian / Ubuntu

  1. Install the Client URL (Curl) for data transfer:
    sudo apt install curl
  2. Add the repository:
  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 2212 package:
    sudo apt-get install openfoam2212-default

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

OpenFOAM Integration with SimFlow

After OpenFOAM installation is complete, you need to integrate it with SimFlow. Please refer to the following instructions provided in the link below:
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 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:
  3. Extract the archives:
    tar -xzf OpenFOAM-v2212.tgz

    tar -xzf ThirdParty-v2212.tgz

OpenFOAM Compilation

  1. Load OpenFOAM configuration stored in environment variables:
    source OpenFOAM-v2212/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-v2212
  5. Run the compilation script:
    ./Allwmake

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

OpenFOAM Integration with SimFlow

After OpenFOAM installation is complete, you need to integrate it with SimFlow. Please refer to the following instructions provided in the link below:
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