In this tutorial we will compile OpenFoam from Source on a Mac with M1 Silicon Chip (ARM64) and get a complete CFD environment with OpenFOAM and Paraview in a virtualized Debian 11 ARM Container with Parallels Desktop. (You need to have a fresh Debian 11 with xfce4 Desktop in Parallels Desktop already set up!)
1. Requirements
First we need to install some requirements on a blank Debian 11 System with xfce4 Desktop:
https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Requirements.md
sudo apt-get update
sudo apt-get install build-essential autoconf autotools-dev cmake gawk gnuplot
sudo apt-get install flex libfl-dev libreadline-dev zlib1g-dev openmpi-bin libopenmpi-dev mpi-default-bin mpi-default-dev
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev
apt-get install libfftw3-dev libscotch-dev libptscotch-dev libboost-system-dev libboost-thread-dev libcgal-dev
If you install the Parkview-Dev Package some more Dependencies will be installed automatically
sudo apt install paraview-dev
2. Compile OpenFOAM from Source
Now we need to download the zip or tgz package for OpenFOAM and the „Third Party“ package:
https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
Source: https://dl.openfoam.com/source/v2112/OpenFOAM-v2112.tgz
ThirdParty: https://dl.openfoam.com/source/v2112/ThirdParty-v2112.tgz
Now we create a new „openfoam“ (small letters) folder in the users-folder (root in this example) and extract both files inside the new created folder.
If you installed in the folder /root/openfoam/OpenFOAM you need to „Source“ the bash file, so that the Terminal will „understand“ the OpenFOAM commands:
source ~/openfoam/OpenFOAM-v2112/etc/bashrc
Now you can use the following commands to check the installation, jump into the proper directory and start the Compiling Prozess:
foamSystemCheck
foam
./Allwmake -s -l
(This can now take about 3 hours, be patient!)
Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip
If you get an error while compiling, increase the RAM of your VM (I had to increase from 4 to 8GB)
3. Test with a Tutorial case
After some hours you can test your installation with a Tutorial case. If you used the same folders that I used before, then you can just copy&paste the following to get the case „pitzDaily“ running:
# Create the user "run" directory:
mkdir -p "$FOAM_RUN"
# Change to the user "run" directory:
run
# Copy tutorial
cp -r "$FOAM_TUTORIALS"/incompressible/simpleFoam/pitzDaily ./
# Run the tutorial
( cd pitzDaily && blockMesh && simpleFoam )
I would suggest to create some Shortcuts on your Desktop for the most used folders, because the file structure of OpenFOAM can be difficult to remember for beginners:
Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip Install OpenFOAM and Paraview from Source on virtualized Debian 11 ARM64 on a M1 Silicon Chip
Remember:
Every time you start OpenFOAM you need to „source“ the bash file first, to make commands like blockMesh, simpleFoam or paraFoam work!
(Tipp: I created a Textfile where I have my most used commands for later work)
source ~/openfoam/OpenFOAM-v2112/etc/bashrc