Installation of OpenFOAM-v2406 on Ubuntu 24.04 LTS and Windows 11.
In this post, I will go through OpenFOAM-v2406 installation process on Ubuntu 24.04 LTS and Windows 11.
First of all, what is OpenFOAM? OpenFOAM stands for Open Source Field Operation and Manipulation and it is free
At the beginning, we will face the question of which version of OpenFOAM to begin with. Simply put, we have two main options. One is from OpenCFD Ltd, which is part of the ESI Group and whose distribution can be found at openfoam.com. The other option is from the OpenFOAM Foundation at openfoam.org.
Regarding this dilemma of which version of OpenFOAM to start with, a good summary can be found on the CFD-Online forum
It is possible to immediately tell if the version of OpenFOAM is from ESI-OpenCFD (openfoam.com) or from the OpenFOAM Foundation (openfoam.org) because they use different versioning identifiers.
ESI-OpenCFD (openfoam.com) uses for OpenFOAM versioning a date-of-release identifier. The format is OpenFOAM-vYYMM, where:
For example, OpenFOAM-v2406:
Previous release was OpenFOAM v2312. Every half year is expected new release distributed via openfoam.com.
Foundation OpenFOAM (openfoam.org) uses for OpenFOAM versioning a sequence based identifier
For example, OpenFOAM 2.3.1:
Since the 2017 there are realised every year only major versions. For example current realise is from 9th July 2024 OpenFOAM 12, previous was OpenFOAM 11 realised in 11th July 2023.
One of the convenient ways to install OpenFOAM on Windows 11 is WSL (Windows Subsystem for Linux).
Edition Windows 11 Home
Version 23H2
Installed 31/07/2024
OS build 22631.3880
Experience Windows Feature Experience Pack 1000.22700.1020.0
We are going to install everything needed for WSL using a PowerShell command, as suggested by the WSL documentation
wsl --install
This will, by default, install Ubuntu (in my case, Ubuntu 22.04.4 LTS). You will be asked to restart your system.
After restarting, a new window will pop up, and you will be asked to create a UNIX user account for Ubuntu. Your username should follow certain rules. For example, capital letters are not allowed. When you are typing your password, it is normal not to see what you are typing.
And that’s it. You have successfully installed Ubuntu. You can also install another GNU/Linux distribution. Already installed distributions can be listed with the command:
wsl -l -v
and available distributions:
wsl -l -o
The chosen distribution can be simply installed by specifying its name:
wsl --install -d <Distro>
You can then easily find your installed distribution in your Windows Apps.
Now, we will finally install OpenFOAM. We can simply follow the quick-start steps from the OpenFOAM wiki for installing precompiled packages on Ubuntu
# Add the repository
curl https://dl.openfoam.com/add-debian-repo.sh | sudo bash
# Update the repository information
sudo apt-get update
# Install preferred package. Eg,
sudo apt-get install openfoam2406-default
# Use the openfoam shell session. Eg,
openfoam2406
Curl is used to download a file (script) from https://dl.openfoam.com/add-debian-repo.sh, and then it is ‘passed’ to bash for execution using pipe. This script adds the OpenFOAM repository to our Ubuntu system, so we can then simply update and install it. Running scripts from untrusted sources can be dangerous, and we should check what we are actually executing. Since sudo is used, you will be asked for your password.
After running the apt-get install command, you will need to confirm that you want to continue by typing ‘Y’ when prompted. When it is finished, you can use OpenFOAM by:
openfoam2406
With that, we have successfully installed OpenFOAM-v2406.