Install OpenFOAM-dev on CentOS 6.x from source

Download:

mkdir -p /opt/openfoam/dev
cd /opt/openfoam/dev

git clone git://github.com/OpenFOAM/OpenFOAM-dev.git
git clone git://github.com/OpenFOAM/ThirdParty-dev.git

Edit file OpenFOAM-dev/etc/bashrc

change FOAM_INST_DIR to
 FOAM_INST_DIR=/opt/openfoam/dev
and:
export WM_MPLIB=OPENMPI

Load modules

module load gcc/4.8.4            # installation Standalone gcc 4.8.4 with mpc, mpfr and gmp on CentOS 6.x
 module load mpfr/3.1.2 
 module load gmp/5.1.2
 module load mpc/1.0.1 
 module load cmake/2.8.12.2  # installation Standalone cmake 2.8 on CentOS

Source bashrc

. ../OpenFOAM-v1612+/etc/bashrc

Compile on many cores if you have

export MAKEFLAGS='-j 60'
export WM_NCOMPPROCS=60

Now compile ThirdParty essentials

first install boost 1.48
yum install boost148 boost148-devel
I have not been able to use the compiled versions of gmp and mpfr...
 yum install gmp-devel mpfr-devel
cd  ThirdParty-dev

download openmpi 2.0.2:
 wget https://www.open-mpi.org/software/ompi/v2.0/downloads/openmpi-2.0.2.tar.gz
unpack:
tar -czvf openmpi-2.0.2.tar.gz
./Allwmake

Compile ParaView

module load qt/4.8.6       # installation Standalone QT 4.8 installation on Centos
 ./makeParaView
wmRefresh
note: paraview need the path to gcc glibc: 
export LD_LIBRARY_PATH=/opt/gcc/4.8.4/lib64:$LD_LIBRARY_PATH

Compile OpenFOAM

cd ../OpenFOAM-dev
./Allwmake

Create module file

Create the file: /etc/modulefiles/openfoam/dev

put the following content in the file

/etc/modulefiles/openfoam/dev

#%Module1.0####################################################################
##
## openfoam/dev modulefile
##
## 
##
proc ModulesHelp { } {
 puts stderr "\tSet OpenFOAM-dev environment."
}

## Create a whatis file.
module-whatis "Adds OpenFOAM links, aliases and paths"

set home $env(HOME)
set user $env(USER)

set-alias app "cd \$FOAM_APP"
set-alias foam "cd \$WM_PROJECT_DIR"

set-alias foamSite "cd \$WM_PROJECT_INST_DIR/site"
set-alias lib "cd \$FOAM_LIBBIN"
set-alias run "cd \$FOAM_RUN"
set-alias sol "cd \$FOAM_SOLVERS"
set-alias src "cd \$FOAM_SRC"
set-alias tut "cd \$FOAM_TUTORIALS"
set-alias util "cd \$FOAM_UTILITIES"
set-alias wm32 "wmSet WM_ARCH_OPTION=32"
set-alias wm64 "wmSet WM_ARCH_OPTION=64"
set-alias wmDP "wmSet WM_PRECISION_OPTION=DP"
set-alias wmSchedOff "unset WM_SCHEDULER"
set-alias wmSchedOn "export WM_SCHEDULER=\$WM_PROJECT_DIR/wmake/wmakeScheduler"
set-alias wmSet ". \$WM_PROJECT_DIR/etc/bashrc"
set-alias wmSP "wmSet WM_PRECISION_OPTION=SP"
set-alias wmUnset ". \$WM_PROJECT_DIR/etc/config.sh/unset"

set-alias cc "/opt/gcc/4.8.4/bin/gcc"

prepend-path PATH "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/gperftools-svn/bin:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/ParaView-5.0.1/bin:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/openmpi-2.0.2/bin:$home/OpenFOAM/$user-dev/platforms/linux64GccDPInt32Opt/bin:/opt/openfoam/dev/site/dev/platforms/linux64GccDPInt32Opt/bin:/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/bin:/opt/openfoam/dev/OpenFOAM-dev/bin:/opt/openfoam/dev/OpenFOAM-dev/wmake:/opt/qt/4.8.6/bin:/opt/cmake/2.8.12.2/bin:/opt/gcc/4.8.4/bin"
prepend-path LD_LIBRARY_PATH "/opt/gcc/4.8.4/lib64:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/gperftools-svn/lib:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/ParaView-5.0.1/lib/paraview-5.0:/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/openmpi-2.0.2:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64GccDPInt32/lib/openmpi-2.0.2:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/openmpi-2.0.2/lib:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/openmpi-2.0.2/lib64:$home/OpenFOAM/$user-dev/platforms/linux64GccDPInt32Opt/lib:/opt/openfoam/dev/site/dev/platforms/linux64GccDPInt32Opt/lib:/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib:/opt/openfoam/dev/ThirdParty-dev/platforms/linux64GccDPInt32/lib:/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/dummy:/opt/qt/4.8.6/lib:/opt/mpc/1.0.1/lib:/opt/gmp/5.1.2/lib:/opt/mpfr/3.1.2/lib:/opt/gcc/4.8.4/lib"
setenv CMAKE_ROOT_DIR "/opt/cmake/2.8.12.2"
setenv CPLUS_INCLUDE_PATH "/opt/mpc/1.0.1/include:/opt/gmp/5.1.2/include:/opt/mpfr/3.1.2/include:/opt/gcc/4.8.4/include"
setenv CPPFLAGS "-I/opt/mpc/1.0.1/include:-I/opt/gmp/5.1.2/include:-I/opt/mpfr/3.1.2/include:-L/opt/gcc/4.8.4/lib:-I/opt/gcc/4.8.4/include"
setenv FOAM_APPBIN "/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/bin"
setenv FOAM_APP "/opt/openfoam/dev/OpenFOAM-dev/applications"
setenv FOAM_ETC "/opt/openfoam/dev/OpenFOAM-dev/etc"
setenv FOAM_EXT_LIBBIN "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64GccDPInt32/lib"
setenv FOAM_INST_DIR "/opt/openfoam/dev"
setenv FOAM_JOB_DIR "/opt/openfoam/dev/jobControl"
setenv FOAM_LIBBIN "/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib"
setenv FOAM_MPI "openmpi-2.0.2"
setenv FOAM_RUN "$home/OpenFOAM/$user-dev/run"
setenv FOAM_SETTINGS ""
setenv FOAM_SIGFPE ""
setenv FOAM_SITE_APPBIN "/opt/openfoam/dev/site/dev/platforms/linux64GccDPInt32Opt/bin"
setenv FOAM_SITE_LIBBIN "/opt/openfoam/dev/site/dev/platforms/linux64GccDPInt32Opt/lib"
setenv FOAM_SOLVERS "/opt/openfoam/dev/OpenFOAM-dev/applications/solvers"
setenv FOAM_SRC "/opt/openfoam/dev/OpenFOAM-dev/src"
setenv FOAM_TUTORIALS "/opt/openfoam/dev/OpenFOAM-dev/tutorials"
setenv FOAM_USER_APPBIN "$home/OpenFOAM/$user-dev/platforms/linux64GccDPInt32Opt/bin"
setenv FOAM_USER_LIBBIN "$home/OpenFOAM/$user-dev/platforms/linux64GccDPInt32Opt/lib"
setenv FOAM_UTILITIES "/opt/openfoam/dev/OpenFOAM-dev/applications/utilities"

setenv GMP_INCLUDE_DIR "/opt/gmp/5.1.2/include"
setenv GMP_LIBRARIES "/opt/gmp/5.1.2/lib"
setenv LIBS "-L/opt/mpc/1.0.1/lib:-L/opt/gmp/5.1.2/lib:-L/opt/mpfr/3.1.2/lib"
setenv MAKEFLAGS "-j 3"
setenv MANPATH "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/openmpi-2.0.2/share/man:/opt/gcc/4.8.4/share/man:"
setenv MPFR_INCLUDE_DIR "/opt/mpfr/3.1.2/include"
setenv MPFR_LIBRARIES "/opt/mpfr/3.1.2/lib"
setenv MPI_ARCH_PATH "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/openmpi-2.0.2"
setenv MPI_BUFFER_SIZE "20000000"
setenv OPAL_PREFIX "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/openmpi-2.0.2"
setenv ParaView_DIR "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/ParaView-5.0.1"
setenv ParaView_INCLUDE_DIR "/opt/openfoam/dev/ThirdParty-dev/platforms/linux64Gcc/ParaView-5.0.1/include/paraview-5.0"
setenv ParaView_MAJOR "5.0"
setenv ParaView_VERSION "5.0.1"
setenv PV_PLUGIN_PATH "/opt/openfoam/dev/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/paraview-5.0"
setenv QT4_ROOT_DIR "/opt/qt/4.8.6"
setenv QT_BIN_DIR "/opt/qt/4.8.6/bin"
setenv QTDIR "/opt/qt/4.8.6"
setenv QTINC "/opt/qt/4.8.6/include"
setenv QTLIB "/opt/qt/4.8.6/lib"
setenv QT_PLUGIN_PATH "/opt/qt/4.8.6/plugins"
setenv WM_ARCH "linux64"
setenv WM_ARCH_OPTION "64"
setenv WM_CC "gcc"
setenv WM_CFLAGS "-m64 -fPIC"
setenv WM_COMPILE_OPTION "Opt"
setenv WM_COMPILER "Gcc"
setenv WM_COMPILER_LIB_ARCH "64"
setenv WM_COMPILER_TYPE "system"
setenv WM_CXXFLAGS "-m64 -fPIC -std \"c++0x\""
setenv WM_CXX "g++"
setenv WM_DIR "/opt/openfoam/dev/OpenFOAM-dev/wmake"
setenv WM_LABEL_OPTION "Int32"
setenv WM_LABEL_SIZE "32"
setenv WM_LDFLAGS "-m64"
setenv WM_LINK_LANGUAGE "c++"
setenv WM_MPLIB "OPENMPI"
setenv WM_OPTIONS "linux64GccDPInt32Opt"
setenv WM_OSTYPE "POSIX"
setenv WM_PRECISION_OPTION "DP"
setenv WM_PROJECT_DIR "/opt/openfoam/dev/OpenFOAM-dev"
setenv WM_PROJECT_INST_DIR "/opt/openfoam/dev"
setenv WM_PROJECT "OpenFOAM"
setenv WM_PROJECT_USER_DIR "$home/OpenFOAM/$user-dev"
setenv WM_PROJECT_VERSION "dev"
setenv WM_THIRD_PARTY_DIR "/opt/openfoam/dev/ThirdParty-dev"

Leave a Reply

Your email address will not be published. Required fields are marked *