Installation¶
A step-by-step walkthrough on installing OpenFOAM.
OpenFOAM Installation¶
OpenFOAM is available to install on MS-Windows, Linux and MacOS.
Windows¶
There are three different ways to run OpenFOAM on MS-Windows (10 or newer). In their order of preference:
-
WSL/WSL2: Windows Subsystem Linux
– Many OpenFOAM users prefer using WSL.
– Provides maximum flexibilty.
– The OpenFOAM Linux packages are kept more up-to-date than cross-compiled/Docker variants.
-
Native Windows: Cross-compiled Windows binaries (mingw)
– Quick way to use OpenFOAM on Windows.
– Does not currently include an OpenFOAM development environment.
-
Docker Containers: docker-windows
– Equivilant to the WSL/WSL2 approach.
– The entire OpenFOAM installation/workspace is managed as a container.
Pick only one method
- Install WSL/WSL2: The WSL information from Windows provides installation anf configuration information for WSL.
-
Choose and install a Linux Distro: Choose a distro such as Ubuntu or openSUSE that recieves regualar OpenFOAM updates.
For new users I recommend using Ubuntu here
-
Install OpenFOAM: Follow the regular installation/update instructions for Ubuntu or openSUSE
OpenFOAM requires a case sensitive file system to build. If you build OpenFOAM from a location outside of the WSL/WSL2 partition (eg. a mounted drive, /mnt/c/Users/some/path) this will cause issues. There are two possible solutions to deal with this.
– Build OpenFOAM within the WSL/WSL2 partition. This partition is case sensitive.
Create a case sensitive folder within the Windows Partition and build OpenFOAM there. As outlined below:
- Create a new folder within Windows (eg,
../Documents/OpenFOAM). Folder must be empty for the nest step. - Enable case sensitivity for this folder using
fsutil.exe. This is done by runningfsutil.exe file setCaseSensitiveInfo <path/to/folder> enablein an elevated PowerShell session. - From inside the WSL/WSL2 environment/terminal, unpack the OpenFOAM-vXXXX.tgz/ThirdParty-vXXXX.tgz files or clone the Git Repos within this folder.
- Build OpenFOAM.
Tested by [ Denis ]
-
Download the package of the latest OpenFOAM MinGW version:
– This package is an executable
– Run this to open the installation wizard, and follow the instructions.
-
If needed, install Microsoft MPI (MS-MPI)
-
Upon completion, an icon will be created on the Desktop:
– Click this icon to launch a terminal window.
– Running this will load the OpenFOAM Environment.
– Verify the contents of OpenFOAM in a terminal:
$ is the command prompt, indicating the terminal is ready to accept a command
- Install Docker: Follow the Docker manual
- Create the OpenFOAM container: Follow the OpenFOAM + Docker instructions
There is no need to use any of these methods to download Paraview, use the Windows version of ParaView
Linux¶
Linux is the recommended OS for OpenFOAM. There is a slightly steep learning curve, since nearly everything revolves around using a terminal.
When it comes to the distros, Ubuntu and openSUSE generally are updated first:
– Ubuntu is very popular and recommended by OpenFOAM users.
– openSUSE is the favoured development platform for OpenFOAM.
I recommend using Ubuntu
-
Use the precompiled packages:
# 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, OpenFOAM v2412 is the latest package at the time of writing. # Options other than -default are explained below sudo apt-get install openfoam2412-default # Use the openfoam shell session. Eg, openfoam2412User Group What to install Runtime Compilation Tutorials minimalist -baseyes no no traditional -base-dev (devel)yes yes no everything -defaultyes yes yes Note
- The system installation prefix
/usr/lib/openfoam/openfoamXXXXis where individual versions are located. - The OpenFOAM bash session wrapper is created under
/usr/bin/openfoamXXXX
- The system installation prefix
-
Use the precompiled packages:
# Add the science repository curl https://dl.openfoam.com/add-science-repo.sh | sudo bash # Refresh sudo zypper refresh # Install preferred package. Eg, OpenFOAM v2412 is the latest package at the time of writing. # Options other than -default are explained below sudo zypper install openfoam2412-default # Use the openfoam shell session. Eg, openfoam2412User Group What to install Runtime Compilation Tutorials minimalist -baseyes no no traditional -develyes yes no everything -defaultyes yes yes
ParaView will need to be installed seperately;
The -y option will auto-answer yes to any prompts asking for confirmation
MacOS¶
[Entry coming soon]