OpenFoam 9 Compilation from Source Code on CentOs7

These steps are for ACE cluster. But can be run on any CentOs7 machine. Provided you have completed installing the prerequisites. If not do the 1st 4 steps from here – OpenFoamWiKi

Use default openmpi for openfoam on SOUMYA as the Intel Omnipath does not support any other version.

On ACE prerequisites are already installed, so you can continue from the below command. Connect to the internet before proceeding. If you are unaware of how to connect to the internet on a terminal, please follow the guide created by Computer Centre – “Internet without GUI

1. #OpenFOAM downloading and installation
cd ~
mkdir OpenFOAM
cd OpenFOAM
wget -O - ftp://ftp.aero.iitb.ac.in/ace/openfoam/o9.tar.gz | tar -xvz
wget -O - ftp://ftp.aero.iitb.ac.in/ace/openfoam/t9.tar.gz | tar -xvz
mv OpenFOAM-9-version-9 OpenFOAM-9
mv ThirdParty-9-version-9 ThirdParty-9

2. #Add source paths in your bashrc before proceeding with the installation 
Add in the end -
vi ~/.bashrc

#openfoam9
source /opt/rh/python27/enable
source /opt/rh/devtoolset-7/enable
source $HOME/OpenFOAM/OpenFOAM-9/etc/bashrc

3. #Source your bashrc
source ~/.bashrc

4.  Download required extra files before openfoam installation

cd ThirdParty-9
mkdir download
wget -P download https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-5.0.2/CGAL-5.0.2.tar.xz
wget -P download https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2

tar -xJf download/CGAL-5.0.2.tar.xz
tar -xjf download/boost_1_72_0.tar.bz2

cd ..

sed -i -e 's/\(boost_version=\)boost-system/\1boost_1_72_0/' OpenFOAM-9/etc/config.sh/CGAL
sed -i -e 's/\(cgal_version=\)cgal-system/\1CGAL-5.0.2/' OpenFOAM-9/etc/config.sh/CGAL

8. We can now start to install OpenFoam now. Navigate to OpenFoam directory

cd OpenFOAM-9

9. Run the command "export WM_NCOMPPROCS=ncpus" for multithreading compilation. Below command will set 12 Cores
export WM_NCOMPPROCS=16

10. Start installation
./Allwmake -j 

You can run it again just to verify -
./Allwmake -j 


11. If it is compiled without any errors, then it is done. You can check 

icoFoam -help

12. Install Paraview (Paraview still does not work in remote ssh connection. Below steps are just for your information.)
cd ../ThirdParty-9
wget -P download http://www.paraview.org/files/v5.6/ParaView-v5.6.3.tar.gz
wget -P download http://download.qt.io/archive/qt/5.9/5.9.6/single/qt-everywhere-opensource-src-5.9.6.tar.xz
wget -P download  https://www.cmake.org/files/v3.9/cmake-3.9.0.tar.gz


tar -xJf download/qt-everywhere-opensource-src-5.9.6.tar.xz --transform='s/qt-everywhere-opensource-src/qt-everywhere-src/'
tar -xzf download/ParaView-v5.6.3.tar.gz --transform='s/ParaView-v5.6.3/ParaView-5.6.3/'
tar -xzf download/cmake-3.9.0.tar.gz

cd $WM_THIRD_PARTY_DIR
./makeCmake > log.makeCmake 2>&1
wmRefresh

wget https://github.com/wyldckat/scripts4OpenFOAM3rdParty/raw/master/makeQt5
wget -P etc/tools/ https://github.com/OpenFOAM/ThirdParty-2.4.x/raw/master/etc/tools/QtFunctions
 
#make them executable
chmod +x makeQt5
 
./makeQt5 qt-5.9.6 > log.makeQt 2>&1


cd $WM_THIRD_PARTY_DIR
rm -r build
rm -r qt-everywhere-src-5.9.6

##Compile Paraview
export CMAKE_PREFIX_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-5.9.6/


./makeParaView -qt-5.9.6 -mpi -python -python-lib /opt/rh/python27/root/usr/lib64/libpython2.7.so -python-include /opt/rh/python27/root/usr/include/python2.7 > log.makePV 2>&1


You need to run Allwmake in OpenFoam-9 directory again after paraview compilation.

Now Source bashrc once.
source ~/.bashrc