$sudo yum groupinstall -y 'Development Tools'
$sudo yum install zlib-devel libXext-devel libGLU-devel libXt-devel libXrender-devel libXinerama-devel libpng-devel libXrandr-devel libXi-devel libXft-devel libjpeg-turbo-devel libXcursor-devel readline-devel ncurses-devel python python-devel cmake qt-devel qt-assistant mpfr-devel gmp gmp-devel
$cd ~
$mkdir OpenFOAM
$cd OpenFOAM
$git clone https://github.com/OpenFOAM/OpenFOAM-5.x.git
$git clone https://github.com/OpenFOAM/ThirdParty-5.x.git
$cd ThirdParty-5.x
$mkdir download
$wget -P download https://www.cmake.org/files/v3.9/cmake-3.9.0.tar.gz
$wget -P download \
https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.10/CGAL-4.10.tar.xz
$wget -P download https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2
$wget -P download https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.bz2
$wget -P download http://www.paraview.org/files/v5.4/ParaView-v5.4.0.tar.gz
$tar -xzf download/cmake-3.9.0.tar.gz
$tar -xJf download/CGAL-4.10.tar.xz
$tar -xjf download/boost_1_55_0.tar.bz2
$tar -xjf download/openmpi-2.1.1.tar.bz2
$tar -xzf download/ParaView-v5.4.0.tar.gz --transform='s/ParaView-v5.4.0/ParaView-5.4.0/'
$cd ..
$sed -i -e 's/\(boost_version=\)boost-system/\1boost_1_55_0/' OpenFOAM-5.x/etc/config.sh/CGAL
$sed -i -e 's/\(cgal_version=\)cgal-system/\1CGAL-4.10/' OpenFOAM-5.x/etc/config.sh/CGAL
$source $HOME/OpenFOAM/OpenFOAM-5.x/etc/bashrc WM_LABEL_SIZE=64 WM_MPLIB=OPENMPI FOAMY_HEX_MESH=yes
CentOS 7.5附带CMake 2.8.,但ParaView 5.4.0需要最近的CMake 3.x系列中的一个版本,而CGAL也需要CMake。因此,我们需要自定义构建Cmake
$cd $WM_THIRD_PARTY_DIR
$./makeCmake > log.makeCmake 2>&1
$wmRefresh
$cd $WM_THIRD_PARTY_DIR
$./Allwmake > log.make 2>&1
$wmRefresh
$cd $WM_THIRD_PARTY_DIR
$./makeParaView -mpi -python -qmake $(which qmake-qt4) > log.makePV 2>&1
$wmRefresh
$cd $WM_PROJECT_DIR
$./Allwmake -j > log.make 2>&1
$icoFoam -help
$vim ~/.bashrc
#### OPENMPI #####
export PATH=$PATH:~/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/openmpi-2.1.1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/OpenFOAM/ThirdParty-5.x/platforms/ linux64Gcc /openmpi-2.1.1/lib
#### PARAVIEW #####
export PATH=$PATH:~/OpenFOAM/ThirdParty-5.x/platforms/linux64Gcc/ParaView-5.4.0/bin
#### OpenFOAM #####
source ~/OpenFOAM/OpenFOAM-5.x/etc/bashrc
$source ~/.bashrc