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.
- System Package Manager (recommended)
- Source Code Compilation
- 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.
- 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
- Install the Client URL (Curl) for data transfer:
sudo apt install curl
- Add the repository:
curl https://dl.openfoam.com/add-debian-repo.sh | sudo bash
- Update the repository information:
sudo apt-get update
- [Optional] Some older Ubuntu installations may require updating the signing certificates:
sudo apt-get install ca-certificates
sudo apt-get update
- 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:
- Prerequisites
- Download OpenFOAM Binaries
- 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
- Change the directory to where you want to store OpenFOAM:
cd /home/<user name>/<..custom path>/
- Download the OpenFOAM binaries from one of the official distributions:
- OpenFOAM+ 2212 (recommended)
- OpenFOAM+ 1812
- OpenFOAM 6 (Ubuntu)
- OpenFOAM 6 (Linux Generic)
You can use the
wget
command from the terminal to download e.g., OpenFOAM 2212:
- Extract the archives:
tar -xzf OpenFOAM-v2212.tgz
tar -xzf ThirdParty-v2212.tgz
OpenFOAM Compilation
- Load OpenFOAM configuration stored in environment variables:
source OpenFOAM-v2212/etc/bashrc
- Check if OpenFOAM has access to all necessary libraries:
foamSystemCheck
- (Optional) Set the number of processors to use during compilation:
export WM_NCOMPPROCS=10
- Change directory to the OpenFOAM root:
cd OpenFOAM-v2212
- 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