Skip to content

OpenFOAM installation

Piet Jarmatz edited this page Oct 16, 2024 · 4 revisions

Installation for OpenFOAM Version 2206 (Oct '22)

  1. Download Source Code from https://dl.openfoam.com/source/v2206/OpenFOAM-v2206.tgz. Alternatively, for current version do git clone https://github.com/OpenFOAM/OpenFOAM-dev.git (see instructions here).
  2. Also download wget https://dl.openfoam.com/source/v2206/ThirdParty-v2206.tgz (or git clone https://github.com/OpenFOAM/ThirdParty-dev.git)
  3. Unzip OpenFOAM-v2206.tgz eg $ gunzip OpenFOAM-v2206.tgz or tar xzf OpenFOAM-v2206.tgz
  4. Create a folder for the build environment, e.g. in $HOME do $ mkdir openfoam and copy source code files into the new directory
  5. Use tar xzf ThirdParty-v2206.tgz to unpack and put files to ~/openfoam/OpenFOAM-v2206/ThirdParty
  6. Source the build environment, e.g. $ source ~/openfoam/OpenFOAM-v2206/etc/bashrc. You might want to add this to your personal ~/.bashrc.
  7. Check for system compatibility $ foamSystemCheck
  8. Move into the OpenFOAM-v2206 folder and do $ foam
  9. Start compilation process $ ./Allwmake -s -l (-s reduces output, -l records output into a log file) * This Process may take upwards of 4 hours to complete. You may chose to stop the compilation process and continue later with $ ./Allwmake. For faster compilation (parallel), use e.g. ./Allwmake -s -l -q -j 8.

Test validity of installation

  1. To check the installation move into the build folder and again source the build OpenFOAM environment like before
  2. let OpenFOAM run installation tests by $ foamInstallationTestand then $ foamTestTutorial -full incompressible/simpleFoam/pitzDaily

Test OpenFOAM compatibility with MaMiCo via the CouetteTest case

  1. create build folder in MaMiCo directory $ mkdir build$ and move into it $ cd build
  2. $ cmake ..
  3. $ ccmake .
  4. Move to the BUILD_WITH_OPENFOAM OFF option with the arrow keys and change it to ON via the enter key, then configure and generate via c g
  5. If error The OpenFOAM bashrc is not sourced or OpenFOAM is not installed is thrown, do $ source ~/openfoam/OpenFOAM-v2206/etc/bashrc again, the configuration files should now generate