OpenFOAM 4.0 on Raspberry pi 3
Raspbian GNU/Linux 8 (jessie)
To install OpenFOAM 4.0 in a
Raspberry pi 3 running Raspbian GNU/Linux 8 (jessie), follow these
steps:
- Download and extract
OpenFOAM in the directory $HOME/OpenFOAM or any directory of your preference (you can
follow the instructions given in
http://openfoam.org/download/4-0-source/)
- You will need to compile
OpenFOAM with 32 bits memory addressing. For this, you will need
to modify the file OpenFOAM-4.0/etc/bashrc and use the following
option:
WM_ARCH_OPTION=32
- In the directory $HOME/OpenFOAM/OpenFOAM-4.0/wmake/rules/linuxARM7Gcc,
modify the file cOpt as follows (we need to use the option -mfloat-abi=hard instead of -mfloat-abi=softfp):
cOPT = -O3 -floop-optimize
-falign-loops -falign-labels -falign-functions -falign-jumps
-fprefetch-loop-arrays -mcpu=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard
#cOPT = -O3 -floop-optimize -falign-loops
-falign-labels -falign-functions -falign-jumps -fprefetch-loop-arrays
-mcpu=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=softfp
- In the directory $HOME/OpenFOAM/OpenFOAM-4.0/wmake/rules/linuxARM7Gcc,
modify the file c++Opt as follows (we need to use the option -mfloat-abi=hard instead of -mfloat-abi=softfp):
c++OPT = -O3
-floop-optimize -falign-loops -falign-labels -falign-functions
-falign-jumps -fprefetch-loop-arrays -mcpu=cortex-a9 -mfpu=vfpv3-d16
-mfloat-abi=hard
#c++OPT = -O3 -floop-optimize -falign-loops
-falign-labels -falign-functions -falign-jumps -fprefetch-loop-arrays
-mcpu=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=softfp
- Now edit the file $HOME/OpenFOAM/ThirdParty-4.0/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-32Int32,
and delete all the occurences of the word m32 (there are three)
- You will need to install a few compulsory packages. Type in the terminal:
sudo apt-get
install build-essential flex bison cmake zlib1g-dev libboost-system-dev
libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev
libncurses-dev libxt-dev
sudo apt-get install qt4-dev-tools libqt4-dev
libqt4-opengl-dev freeglut3-dev libqtwebkit-dev
- If you do not want to
compile paraFoam/paraview, install the following optional package (by
the way this is highly recommended). Type in the terminal:
sudo apt-get install paraview
- Add the following line to
your .bashrc file (at the very end of the file):
source
$HOME/OpenFOAM/OpenFOAM-4.0/etc/bashrc
- Source the new environment variables. In the current terminal
window type:
source
$HOME/.bashrc
- You can also open a new
terminal (I prefer this option instead of sourcing the file .bashrc)
- At this point we are ready
to start the compilation process. In the terminal window type:
./Allwmake
- Please note that the
compilation process is quite long, about 16 hours. You can compile in
parallel but do not use more than 2 cores.
- If you installed paraview using apt-get, you do
not need to compile paraFoam/paraview.
If you do not want to do the compilation
on your own, you can download the Raspberry precompiled binaries here. Remember to install the compulsory packages and isntall paraview usign apt-get.
joel.guerrero@unige.it
Last
update: 30/JUL/2016