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"

ruby 2.2.2 on centos 6.6

wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
tar -xzvf ruby-2.2.2.tar.gz
cd ruby-2.2.2
module load tcltk/8.5.13  #tcltk installation
./configure --prefix=/opt/ruby/2.2.2
make -j64 #(if you have 64 cores...)
make install

Module file /etc/modulefiles/ruby/2.2.2

#%Module1.0####################################################################
##
## Discretizer AB modulefile
##
##
setenv RUBY_INCLUDE /opt/ruby/2.2.2/include
prepend-path PATH /opt/ruby/2.2.2/bin
prepend-path LD_LIBRARY_PATH /opt/ruby/2.2.2/lib

mbdyn 1.6.0 installation on Centos 6.6

First install some stuff:

yum install ginac ginac-devel ginac-utils

Install metis 4 or update mbdyn..

module load metis/4.0.3

Download from:

wget https://www.mbdyn.org/userfiles/downloads/mbdyn-1.6.0.tar.gz
wget https://www.mbdyn.org/userfiles/downloads/mbdyn-1.6.0-nested-string-drive.1.patch
wget https://www.mbdyn.org/userfiles/downloads/mbdyn-1.6.0-function-in-statement.1.patch
tar -xzvf mbdyn-1.6.0.tar.gz
 cd mbdyn-1.6.0
 patch -p0 < ../mbdyn-1.6.0-nested-string-drive.1.patch
 patch -p0 < ../mbdyn-1.6.0-function-in-statement.1.patch
 ./configure -prefix=/opt/mbdyn/1.6.0 -exec-prefix=/opt/mbdyn/1.6.0 -oldincludedir=/opt/mbdyn/1.6.0/include

Some more stuff (with correct version) has to be installed (some day):

configure: WARNING: Umfpack not supported
 configure: WARNING: KLU not supported
 checking for jdqz... no
 configure: WARNING: MPI not supported

We just skip forward:

make -j4  # if you want to compile on 4 cores...
make install

Module file /etc/modulefiles/mbdyn/1.6.0

#%Module1.0####################################################################
 ##
 ## modulefile by Discretizer AB
 ##
 ##
 prepend-path PATH /opt/mbdyn/1.6.0/bin
 prepend-path LD_LIBRARY_PATH /opt/mbdyn/1.6.0/lib
 prepend-path MANPATH /opt/mbdyn/1.6.0/share/man
 prepend-path CPLUS_INCLUDE_PATH /opt/mbdyn/1.6.0/include
 prepend-path CPPFLAGS -I/opt/mbdyn/1.6.0/include
 prepend-path LIBS -L/opt/mbdyn/1.6.0/lib

Test run:

module load mbdyn/1.6.0
mkdir rigidbody
cd rigidbody
wget https://www.mbdyn.org/userfiles/documents/examples/rigidbody
mbdyn rigidbody
cd ..
mkdir rigidpendulum
cd rigidpendulum/
wget https://www.mbdyn.org/userfiles/documents/examples/rigidpendulum
mbdyn rigidpendulum
cd ..
mkdir planemech
cd planemech/
wget https://www.mbdyn.org/userfiles/documents/examples/planemech
mbdyn planemech

Install old Metis 4.0.3 for mbdyn on Centos 6.6

Get the latest version in the 4-series:

wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-4.0.3.tar.gz
tar -xzvf metis-4.0.3.tar.gz
cd metis-4.0.3
make -j4
mkdir -p /opt/metis/4.0.3/bin
mkdir /opt/metis/4.0.3/lib
mkdir /opt/metis/4.0.3/include
cp Lib/*.h /opt/metis/4.0.3/include/
cp libmetis.a /opt/metis/4.0.3/lib/libmetis.so
chmod +x /opt/metis/4.0.3/lib/libmetis.so
cp pmetis kmetis oemetis onmetis mesh2dual mesh2nodal partdmesh partnmesh graphchk /opt/metis/4.0.3/bin/
cp -r Doc/ /opt/metis/4.0.3/doc

Module file /etc/modulefiles/metis/4.0.3 :

#%Module1.0####################################################################
 ##
 ##  Discretizer AB modulefile
 ##
 ##
 ## Add directory to the path
 prepend-path PATH /opt/metis/4.0.3/bin
 prepend-path LD_LIBRARY_PATH /opt/metis/4.0.3/lib
 prepend-path CPLUS_INCLUDE_PATH /opt/metis/4.0.3/include
 prepend-path CPPFLAGS -I/opt/metis/4.0.3/include
 prepend-path LIBS -L/opt/metis/4.0.3/lib

 

Vortexje compilation error on Centos 6.6

 

First:

yum install eigen3-devel  (probably from epel)
module load cmake/2.8.12.2  # installation here

I downloaded vortexje from:

git clone git://git.baayen-heinz.com/Vortexje.git
cd Vortexje
cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/vortexje/git_20150326
make -j4

then I got this problem:

[ 93%] Building CXX object examples/hawt/CMakeFiles/hawt.dir/hawt.cpp.o
/root/build/Vortexje/examples/hawt/hawt.cpp: In function \u2018int main(int, char**)\u2019:
/root/build/Vortexje/examples/hawt/hawt.cpp:286: error: call of overloaded \u2018moment(std::shared_ptr<HAWT>&, Eigen::Vector3d&)\u2019 is ambiguous
/root/build/Vortexje/./vortexje/solver.hpp:112: note: candidates are: Eigen::Vector3d Vortexje::Solver::moment(const std::shared_ptr<Vortexje::Body>&, const Eigen::Vector3d&) const
/root/build/Vortexje/./vortexje/solver.hpp:113: note: Eigen::Vector3d Vortexje::Solver::moment(const std::shared_ptr<Vortexje::Surface>&, const Eigen::Vector3d&) const
make[2]: *** [examples/hawt/CMakeFiles/hawt.dir/hawt.cpp.o] Error 1
make[1]: *** [examples/hawt/CMakeFiles/hawt.dir/all] Error 2
make: *** [all] Error 2

which i resolved with a dynamic cast of the hawt and vawt object (in hawt.cpp and vawt.cpp):

// Log shaft moment:
Vector3d M = solver.moment( dynamic_pointer_cast< Vortexje::Body >(hawt), position);

module file: /etc/modulefiles/vortexje/git_20150326

#%Module1.0####################################################################
##
## Discretizer AB modulefile
##
##
prepend-path CPLUS_INCLUDE_PATH /opt/vortexje/git_20150326/include/vortexje/
prepend-path LD_LIBRARY_PATH /opt/vortexje/git_20150326/lib

Calculate pressure on incompressible

Install foamCalcEx

#(if necessary yum install mercurial)
hg clone https://code.google.com/p/foamcalcex/
cd foamcalcex
./Allwmake
#usage
foamCalcEx multiplyDivide p multiply -value 1000 -latestTime   #creates p_multiply_value
ptot -latestTime  #creates ptot based on p
foamCalcEx multiplyDivide ptot multiply -value 1000 -latestTime  #creates ptot_multiply_value

Install Octave 3.8.2 on CentOS 6.6

Download from: ftp://ftp.gnu.org/gnu/octave/octave-3.8.2.tar.gz

tar -xzvf octave-3.8.2.tar.gz
export JAVA_HOME=/usr/lib/jvm/java/
./configure --exec-prefix=/opt/octave/3.8.2 --exec-prefix=/opt/octave/3.8.2  --datadir=/opt/octave/3.8.2/share
make -j64 # if you want to compile on 64 cores...

Create module file /etc/modulefiles/octave/3.8.2:

#%Module1.0####################################################################
##
## octave modulefile
##
##
##
prepend-path PATH /opt/octave/3.8.2/bin
prepend-path LD_LIBRARY_PATH /opt/octave/3.8.2/lib
prepend-path MANPATH /opt/octave/3.8.2/share/man

 

Standalone install of boost 1.49.0 on Centos 6.6

Get file: http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz/download

tar -xzvf
module load openmpi-x86_64
./bootstrap.sh -prefix=/opt/boost/1.49.0
./b2 -j20 # if you want to compile on 20 cores :-)
mkdir -p /opt/boost/1.49.0
cp -r stage/ /opt/boost/1.49.0/

Create module file /etc/modulefiles/boost/1.49.0

#%Module1.0####################################################################
##
## boost modulefile
##
##
##

prepend-path LD_LIBRARY_PATH /opt/boost/1.49.0/stage/lib