install OpenFOAM 2.4.0 on CentOS 6.6

First install boost, qt and cmake

Get it:

mkdir -p /opt/openfoam/2.4.0
cd /opt/openfoam/2.4.0
wget http://downloads.sourceforge.net/foam/OpenFOAM-2.4.0.tgz?use_mirror=mesh
wget http://downloads.sourceforge.net/foam/ThirdParty-2.4.0.tgz?use_mirror=mesh
mv OpenFOAM-2.4.0.tgz\?use_mirror\=mesh OpenFOAM-2.4.0.tgz
mv ThirdParty-2.4.0.tgz\?use_mirror\=mesh ThirdParty-2.4.0.tgz
tar -xzvf OpenFOAM-2.4.0.tgz
tar -xzvf ThirdParty-2.4.0.tgz

Prepare:

yum install qtwebkit qtwebkit-devel  #from epel
module load boost/1.49.0    #installation
module load qt/4.8.6        #installation
module load openmpi-x86_64  #from openmpi-1.8.1-1.el6.x86_64
module load cmake/2.8.12.2  #installation

In OpenFOAM-2.4.0/etc/bashrc

foamInstall=/opt/openfoam/$WM_PROJECT_VERSION
#and
foamCompiler=ThirdParty

In OpenFOAM-2.4.0/etc/config/settings.sh

gcc_version=gcc-4.8.4  #from gcc-4.8.2

Source it:

. OpenFOAM-2.4.0/etc/bashrc

Compile on all cores:

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

Compile gcc:

cd ThirdParty-2.4.0
wget ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.2.tar.bz2
tar -xjvf gmp-5.1.2.tar.bz2
wget ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.bz2
tar -xjvf mpfr-3.1.2.tar.bz2
wget http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz
tar -xzvf mpc-1.0.1.tar.gz
wget ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-4.8.4/gcc-4.8.4.tar.bz2
tar -xjvf gcc-4.8.4.tar.bz2

edit makeGcc:

gccPACKAGE=gcc-4.8.4
./makeGcc

Control if gcc works after sourcing baschrc again ”. ../OpenFOAM-2.4.0/etc/bashrc”

which gcc
output:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/gcc-4.8.4/bin/gcc

Continue in ThirdParty:

./Allwmake
 ./makeParaView4

Time to compile OpenFOAM 2.4.0!!!

cd ../OpenFOAM-2.4.0
 ./Allwmake > build.log|tail -f build.log

The module file: /etc/modulefiles/openfoam/2.4.0

 

#%Module1.0####################################################################
##
## openfoam/2.4.0 modulefile
##
## 
##
proc ModulesHelp { } {
 puts stderr "\tSet OpenFOAM 2.4.0 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 foam3rdParty "cd \$WM_THIRD_PARTY_DIR"
set-alias foamApps "cd \$FOAM_APP"
set-alias foam "cd \$WM_PROJECT_DIR"
set-alias foamfv "cd \$FOAM_SRC/finiteVolume"
set-alias foamSite "cd \$WM_PROJECT_INST_DIR/site"
set-alias foamSol "cd \$FOAM_SOLVERS"
set-alias foamsrc "cd \$FOAM_SRC/\$WM_PROJECT"
set-alias foamTuts "cd \$FOAM_TUTORIALS"
set-alias foamUtils "cd \$FOAM_UTILITIES"
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 wmREFRESH "wmSET \$FOAM_SETTINGS"
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/unset.sh"
prepend-path PATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/gperftools-svn/bin:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/ParaView-4.1.0/bin:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/gcc-4.8.4/bin:$home/OpenFOAM/$user-2.4.0/platforms/linux64GccDPOpt/bin:/opt/openfoam/2.4.0/site/2.4.0/platforms/linux64GccDPOpt/bin:/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/bin:/opt/openfoam/2.4.0/OpenFOAM-2.4.0/bin:/opt/openfoam/2.4.0/OpenFOAM-2.4.0/wmake:/usr/lib64/openmpi/bin"
prepend-path LD_LIBRARY_PATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/gperftools-svn/lib:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/ParaView-4.1.0/lib/paraview-4.1:/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib/openmpi-system:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64GccDPOpt/lib/openmpi-system:/usr/lib64/openmpi/lib:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/mpc-1.0.1/lib:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/mpfr-3.1.2/lib:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/gmp-5.1.2/lib:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/gcc-4.8.4/lib64:$home/OpenFOAM/$user-2.4.0/platforms/linux64GccDPOpt/lib:/opt/openfoam/2.4.0/site/2.4.0/platforms/linux64GccDPOpt/lib:/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib:/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64GccDPOpt/lib:/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib/dummy"
setenv BOOST_ARCH_PATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/boost-system"
setenv CGAL_ARCH_PATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/CGAL-4.6"
setenv FOAM_APPBIN "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/bin"
setenv FOAM_APP "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/applications"
setenv FOAM_ETC "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/etc"
setenv FOAM_EXT_LIBBIN "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64GccDPOpt/lib"
setenv FOAM_INST_DIR "/opt/openfoam/2.4.0"
setenv FOAM_JOB_DIR "/opt/openfoam/2.4.0/jobControl"
setenv FOAM_LIBBIN "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib"
setenv FOAM_MPI "openmpi-system"
setenv FOAM_RUN "$home/OpenFOAM/$user-2.4.0/run"
setenv FOAM_SETTINGS ""
setenv FOAM_SIGFPE ""
setenv FOAM_SITE_APPBIN "/opt/openfoam/2.4.0/site/2.4.0/platforms/linux64GccDPOpt/bin"
setenv FOAM_SITE_LIBBIN "/opt/openfoam/2.4.0/site/2.4.0/platforms/linux64GccDPOpt/lib"
setenv FOAM_SOLVERS "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/applications/solvers"
setenv FOAM_SRC "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/src"
setenv FOAM_TUTORIALS "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/tutorials"
setenv FOAM_USER_APPBIN "$home/OpenFOAM/$user-2.4.0/platforms/linux64GccDPOpt/bin"
setenv FOAM_USER_LIBBIN "$home/OpenFOAM/$user-2.4.0/platforms/linux64GccDPOpt/lib"
setenv FOAM_UTILITIES "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/applications/utilities"
setenv GMP_ARCH_PATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/gmp-5.1.2"
setenv MANPATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/gcc-4.8.4/man:"
setenv MPFR_ARCH_PATH "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64/mpfr-3.1.2"
setenv MPI_ARCH_PATH "/usr/lib64/openmpi"
setenv MPI_BIN "/usr/lib64/openmpi/bin"
setenv MPI_BUFFER_SIZE "20000000"
setenv MPI_COMPILER "openmpi-x86_64"
setenv MPI_FORTRAN_MOD_DIR "/usr/lib64/gfortran/modules/openmpi-x86_64"
setenv MPI_INCLUDE "/usr/include/openmpi-x86_64"
setenv MPI_LIB "/usr/lib64/openmpi/lib"
setenv MPI_MAN "/usr/share/man/openmpi-x86_64"
setenv MPI_PYTHON_SITEARCH "/usr/lib64/python2.6/site-packages/openmpi"
setenv MPI_SUFFIX "_openmpi"
setenv MPI_SYSCONFIG "/etc/openmpi-x86_64"
setenv ParaView_DIR "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/ParaView-4.1.0"
setenv ParaView_INCLUDE_DIR "/opt/openfoam/2.4.0/ThirdParty-2.4.0/platforms/linux64Gcc/ParaView-4.1.0/include/paraview-4.1"
setenv ParaView_MAJOR "4.1"
setenv ParaView_VERSION "4.1.0"
setenv PV_PLUGIN_PATH "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib/paraview-4.1"
setenv PYTHONPATH "/usr/lib64/python2.6/site-packages/openmpi"
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_CXXFLAGS "-m64 -fPIC"
setenv WM_CXX "g++"
setenv WM_DIR "/opt/openfoam/2.4.0/OpenFOAM-2.4.0/wmake"
setenv WM_LDFLAGS "-m64"
setenv WM_LINK_LANGUAGE "c++"
setenv WM_MPLIB "SYSTEMOPENMPI"
setenv WM_OPTIONS "linux64GccDPOpt"
setenv WM_OSTYPE "POSIX"
setenv WM_PRECISION_OPTION "DP"
setenv WM_PROJECT_DIR "/opt/openfoam/2.4.0/OpenFOAM-2.4.0"
setenv WM_PROJECT_INST_DIR "/opt/openfoam/2.4.0"
setenv WM_PROJECT "OpenFOAM"
setenv WM_PROJECT_USER_DIR "$home/OpenFOAM/$user-2.4.0"
setenv WM_PROJECT_VERSION "2.4.0"
setenv WM_THIRD_PARTY_DIR "/opt/openfoam/2.4.0/ThirdParty-2.4.0"

Lämna ett svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *