Linux serverNETWORK ADMINISTRATIONS

Install OpenFOAM on CentOS 7

# install wget to download packages
yum search wget
yum list wget
yum info wget
sudo yum -y install wget

# vim useful to look at log files in case something goes wrong
sudo yum -y install vim

# work in a project folder
mkdir projects
cd projects

# download OpenFOAM source code and third party libraries
wget https://sourceforge.net/projects/openfoam/files/v2212/OpenFOAM-v2212.tgz
tar zxvf OpenFOAM-v2212.tgz
rm -f OpenFOAM-v2212.tgz
wget https://sourceforge.net/projects/openfoam/files/v2212/ThirdParty-v2212.tgz
tar zxvf ThirdParty-v2212.tgz
rm -f ThirdParty-v2212.tgz

# install a basic gcc compiler
sudo yum -y install gcc
gcc –version

# gcc 5.4 or higher is required for OpenFOAM, therefore install gcc 7
sudo yum install -y centos-release-scl
sudo yum install -y devtoolset-7
scl enable devtoolset-7 bash

# scl enable command must be executed
# every time you want to compile code

# install flex
sudo yum makecache
sudo yum -y install flex

# install cmake
sudo yum install cmake

# install QT
sudo yum install mesa-libGL-devel mesa-libGLU-devel
sudo yum install qt
sudo yum install qt-creator

# install git
sudo yum install git

# install OpenMPI
sudo yum install openmpi-devel
module load mpi

# module load mpi
# every time you want to compile and
# every time you want to run parallel simulations

# install zlib
sudo yum -y install zlib-devel

# compile third party software and openfoam
source ~/projects/OpenFOAM-v2212/etc/bashrc

# source ~/projects/OpenFOAM-v2212/etc/bashrc
# every time you want to run a simulation
# or compile code

cd projects/ThirdParty-v2212/
./Allwmake -j 8
./makeParaView
wmRefresh
cd ~/projects/OpenFOAM-v2212
./Allwmake -j 8

# run tutorial
mkdir -p $FOAM_RUN
cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
cd pitzDaily
blockMesh
simpleFoam

# run tutorial

# useful links:
# https://openfoam.org/download/10-source/
# https://openfoam.org/download/source/software-for-compilation/
# https://openfoam.org/download/source/third-party-software/
# https://www.openfoam.com/download/release-history

source

centos 7

2 thoughts on “Install OpenFOAM on CentOS 7

  • Than you sir for the nice tutorial. are more openFoam related lectures expected?

Comments are closed.